{"action":"created","issue":{"url":"https://api.github.com/repos/django/django/issues/4749","labels_url":"https://api.github.com/repos/django/django/issues/4749/labels{/name}","comments_url":"https://api.github.com/repos/django/django/issues/4749/comments","events_url":"https://api.github.com/repos/django/django/issues/4749/events","html_url":"https://github.com/django/django/pull/4749","id":85010450,"number":4749,"title":"Fixed #24914 -- Added basic permission mixins to contrib.auth","user":{"login":"raphaelm","id":64280,"avatar_url":"https://avatars.githubusercontent.com/u/64280?v=3","gravatar_id":"","url":"https://api.github.com/users/raphaelm","html_url":"https://github.com/raphaelm","followers_url":"https://api.github.com/users/raphaelm/followers","following_url":"https://api.github.com/users/raphaelm/following{/other_user}","gists_url":"https://api.github.com/users/raphaelm/gists{/gist_id}","starred_url":"https://api.github.com/users/raphaelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphaelm/subscriptions","organizations_url":"https://api.github.com/users/raphaelm/orgs","repos_url":"https://api.github.com/users/raphaelm/repos","events_url":"https://api.github.com/users/raphaelm/events{/privacy}","received_events_url":"https://api.github.com/users/raphaelm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-06-04T09:46:49Z","updated_at":"2015-06-05T11:09:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/4749","html_url":"https://github.com/django/django/pull/4749","diff_url":"https://github.com/django/django/pull/4749.diff","patch_url":"https://github.com/django/django/pull/4749.patch"},"body":"https://code.djangoproject.com/ticket/24914\r\n\r\nAn initial version of implementation and tests is in the pull request, documentation is yet to be done. Comments on the code are very welcome.\r\n\r\nThis proposal provides all the and only the functionality of all three authentication decorators from contrib.auth.\r\n\r\nWhile it is slightly differently implemented, it tries to stay compatible with the widely-used 3rd-party package django-braces in terms of parameter and method names. django-braces does have more functionality than the decorators have, but implementing this functionality in django itself is outside the scope of this ticket."},"comment":{"url":"https://api.github.com/repos/django/django/issues/comments/109259466","html_url":"https://github.com/django/django/pull/4749#issuecomment-109259466","issue_url":"https://api.github.com/repos/django/django/issues/4749","id":109259466,"user":{"login":"raphaelm","id":64280,"avatar_url":"https://avatars.githubusercontent.com/u/64280?v=3","gravatar_id":"","url":"https://api.github.com/users/raphaelm","html_url":"https://github.com/raphaelm","followers_url":"https://api.github.com/users/raphaelm/followers","following_url":"https://api.github.com/users/raphaelm/following{/other_user}","gists_url":"https://api.github.com/users/raphaelm/gists{/gist_id}","starred_url":"https://api.github.com/users/raphaelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphaelm/subscriptions","organizations_url":"https://api.github.com/users/raphaelm/orgs","repos_url":"https://api.github.com/users/raphaelm/repos","events_url":"https://api.github.com/users/raphaelm/events{/privacy}","received_events_url":"https://api.github.com/users/raphaelm/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T11:09:15Z","updated_at":"2015-06-05T11:09:15Z","body":"I updated the pull request and fixed/changed everything you remarked, except those two:\r\n\r\n> There's a bunch of docs duplication with regards to login_url, raise_exception and redirect_field_name. I'd document them on the UserPassesTestMixin and reference their documentation from LoginRequiredMixin and PermissionRequiredMixin instead.\r\n\r\nI am unsure whether this is the best solution. I feel that UserPassesTestMixin is the least important one of those and most users will only be interested in LoginRequiredMixin and maybe PermissionRequiredMixin. Therefore, I think it would be more confusing then helpful.\r\n\r\n> I'm missing tests for the UserPassesTestMixin.\r\n\r\nMe too, but how would you test this properly? UserPassesTest only makes sense to use if you override test_func and test that subclass -- however, this is exactly what the tests for LoginRequiredMixin and PermissionRequiredMixin do. All aspects of UserPassesTest are tested, but I do not see a nice way to do it directly.\r\n\r\n(There is no test for the user_passes_test decorator, I guess for the same reason. Also, most mistakes you pointed out in my code in your last comments, are present in the decorators as well.)"}}