-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Juniper Upgrade - Changed inheritance for OrganizationMemberBackend #13
Conversation
39b0e7d
to
690a43b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thank you for debugging through this very difficult issue! This is a very challenging part of Open edX! I read the comments and reviewed the PR and I think this is the way to go.
I have one suggestion and it should be good to be merged:
- Import
from django.contrib.auth.backends import AllowAllUsersModelBackend
instead ofModelBackend
AllowAllUsersModelBackend
should be used instead ofNoActiveCanAuthenticateMixin
organizations/backends.py
Outdated
return None | ||
|
||
|
||
class OrganizationMemberBackend(ModelBackend): | ||
class OrganizationMemberBackend(NoActiveCanAuthenticateMixin, ModelBackend): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class OrganizationMemberBackend(NoActiveCanAuthenticateMixin, ModelBackend): | |
class OrganizationMemberBackend(AllowAllUsersModelBackend): |
organizations/backends.py
Outdated
@@ -11,6 +11,66 @@ | |||
) | |||
|
|||
|
|||
class NoActiveCanAuthenticateMixin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've read the documentation the pointers you've posted which lead me to lms/envs/common.py:
AUTHENTICATION_BACKENDS = [
'rules.permissions.ObjectPermissionBackend',
'openedx.core.djangoapps.oauth_dispatch.dot_overrides.backends.EdxRateLimitedAllowAllUsersModelBackend',
'bridgekeeper.backends.RulePermissionBackend',
]
Looking at EdxRateLimitedAllowAllUsersModelBackend
it turns out it extends AllowAllUsersModelBackend
which does exactly what NoActiveCanAuthenticateMixin
does.
# Standard Django backend.
# see https://docs.djangoproject.com/en/3.1/ref/contrib/auth/#django.contrib.auth.backends.AllowAllUsersModelBackend
class AllowAllUsersModelBackend(ModelBackend):
def user_can_authenticate(self, user):
return True
690a43b
to
66faaf6
Compare
This commit changes the base model to AllowAllUsersModelBackend from ModelBackend for which Organizations.backends.OrganizationMemberBackend inherits. The purpose of this is to address an architectural issue with how Open edX handles authentication and authorization on email vericification. See the source code in this commit for more details
66faaf6
to
5e264ce
Compare
@OmarIthawi Great find and suggestion! Implemented and also updated documentation. Please review and approve if you don't see anything else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @johnbaldwin! Look great!
Show better error message for inactive users and ask them to check email as described in RED-1864 . Brings over changes from appsembler/edx-organizations#13
This commit changes the base model to AllowAllUsersModelBackend from
ModelBackend for which Organizations.backends.OrganizationMemberBackend
inherits. The purpose of this is to address an architectural issue with how
Open edX handles authentication and authorization on email vericification.
See the source code in this commit for more details
https://appsembler.atlassian.net/browse/RED-1864