Also note that `get_all_permissions()` and `get_group_permissions()` exist
on the User model, but `get_user_permissions()` does not. I think this is
confisuing for backend authors.
Mailinglist thread: https://groups.google.com/forum/#!topic/django-
developers/CNmz22gEsCc
Pull request: https://github.com/django/django/pull/11037
--
Ticket URL: <https://code.djangoproject.com/ticket/30226>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
* type: Cleanup/optimization => New feature
* version: 2.1 => master
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:1>
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:2>
* needs_better_patch: 0 => 1
Comment:
I left a few comments on the PR. When they're addressed, good to go.
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:3>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:4>
Old description:
> Currently, writing a new authentication backend requires quite some
> boilerplate e.g. `has_perm()` can be derived from `get_all_permissions()`
> which in turn can be derived from `get_user_permissions()` and
> `get_group_permissions()`. Additionally, `authenticate()` and
> `get_user()` should always return `None` for backends that only handle
> permissions.
>
> Also note that `get_all_permissions()` and `get_group_permissions()`
> exist on the User model, but `get_user_permissions()` does not. I think
> this is confisuing for backend authors.
>
> Mailinglist thread: https://groups.google.com/forum/#!topic/django-
> developers/CNmz22gEsCc
> Pull request: https://github.com/django/django/pull/11037
New description:
Currently, writing a new authentication backend requires quite some
boilerplate e.g. `has_perm()` can be derived from `get_all_permissions()`
which in turn can be derived from `get_user_permissions()` and
`get_group_permissions()`. Additionally, `authenticate()` and `get_user()`
should always return `None` for backends that only handle permissions.
Also note that `get_all_permissions()` and `get_group_permissions()` exist
on the User model, but `get_user_permissions()` does not. I think this is
confusing for backend authors.
Mailinglist thread: https://groups.google.com/forum/#!topic/django-
developers/CNmz22gEsCc
Pull request: https://github.com/django/django/pull/11037
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:5>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:6>
* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:7>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"581a0f45453f178b8abc0d09bd16ce06309ed33a" 581a0f45]:
{{{
#!CommitTicketReference repository=""
revision="581a0f45453f178b8abc0d09bd16ce06309ed33a"
Refs #30226 -- Added User.get_user_permissions() method.
Added to mirror the existing User.get_group_permissions().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:10>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"75337a60509fdfdd321a5caf8e30d57fff6b9518" 75337a6]:
{{{
#!CommitTicketReference repository=""
revision="75337a60509fdfdd321a5caf8e30d57fff6b9518"
Fixed #30226 -- Added BaseBackend for authentication.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30226#comment:9>