Authentication class mixins
This module defines various mixins that can be used within the Authentication views to implement the different user creation strategies.
Classes:
A mixin to create new users. |
|
Mixin to login a user. |
|
A mixin to create new users. |
|
|
Metaclass for classes that can have media definitions. |
Mixin to perform an update on the user. |
- class django_helmholtz_aai.views.auth.mixins.CheckEmailMixin
Bases:
objectClasses:
PermissionDeniedReasons(value)An enumeration.
Methods:
email_exists(email[, UserModel])Get a user from the email.
- class django_helmholtz_aai.views.auth.mixins.CreateUserMixin
Bases:
objectA mixin to create new users.
Methods:
create_user(**kwargs)Create a Django user for a Helmholtz AAI User.
get_or_create_user(**kwargs)Create a Django user for a Helmholtz AAI User.
Attributes:
- create_user(**kwargs) HelmholtzUser
Create a Django user for a Helmholtz AAI User.
This method uses the
create_aai_user()to create a new user.Notes
Emits the
aai_user_createdsignal
- get_or_create_user(**kwargs) HelmholtzUser
Create a Django user for a Helmholtz AAI User.
This method uses the
create_aai_user()to create a new user.Notes
Emits the
aai_user_createdsignal
- class django_helmholtz_aai.views.auth.mixins.LoginUserMixin
Bases:
objectMixin to login a user.
Attributes:
Methods:
Return the URL to redirect to after processing a valid form.
login_user(user)Login the Helmholtz AAI user to the Django Application.
- login_user(user: HelmholtzUser)
Login the Helmholtz AAI user to the Django Application.
Login is done via the top-level
django_helmholtz_aai.login()function.Notes
Emits the
aai_user_logged_insignal
- class django_helmholtz_aai.views.auth.mixins.MapUserMixin
Bases:
objectA mixin to create new users.
Methods:
get_user_from_email(email, **kwargs)Get a user from the email.
map_user(**kwargs)Create an Helmholtz AAI User for an existing django user.
Attributes:
- get_user_from_email(email: str, **kwargs) User
Get a user from the email.
**kwargsare used to filter the existing django users.
- map_user(**kwargs) HelmholtzUser
Create an Helmholtz AAI User for an existing django user.
This method creates a new helmholtz user for an already existing django user.
**kwargsare used to filter the existing django users.
- class django_helmholtz_aai.views.auth.mixins.NoUserExistsMixin
Bases:
objectClasses:
PermissionDeniedReasons(value)Reasons why permissions are denied to login.
Methods:
user_exists(*args, **kwargs)Test if a user with the given id exists.
- class django_helmholtz_aai.views.auth.mixins.PermissionDeniedReasonsClass(name, bases, attrs)
Bases:
typeMetaclass for classes that can have media definitions.
- class django_helmholtz_aai.views.auth.mixins.PermissionRequiredReasoningMixin
Bases:
PermissionRequiredMixinClasses:
PermissionDeniedReasons(value)Reasons why permissions are denied to login.
Methods:
Get the permission denied message for a specific reason.
Attributes:
The reason why the user cannot login.
- class PermissionDeniedReasons(value)
Bases:
TextChoicesReasons why permissions are denied to login.
Attributes:
the virtual organization is not part of
- email_not_verified = 'email_not_verified'
- vo_not_allowed = 'vo_not_allowed'
the virtual organization is not part of
- get_permission_denied_message() str
Get the permission denied message for a specific reason.
This method is called by the super-classes
handle_no_permission()method.
- handle_no_permission()
- permission_denied_reason: PermissionDeniedReasons
The reason why the user cannot login.
- class django_helmholtz_aai.views.auth.mixins.UpdateUserMixin
Bases:
objectMixin to perform an update on the user.
Attributes:
Methods:
apply_updates(to_update)Apply the update to the user and send the signal.
create_vo(vo_name)Create a new VO with the given name.
join_vo(vo)Join the given VO.
leave_vo(vo)Leave the given VO.
Synchronize the memberships in the virtual organizations.
update_user(**to_update)Update the user from the userinfo provided by the Helmholtz AAI.
- aai_user: HelmholtzUser
- create_vo(vo_name: str) HelmholtzVirtualOrganization
Create a new VO with the given name.
- join_vo(vo: HelmholtzVirtualOrganization)
Join the given VO.
- leave_vo(vo: HelmholtzVirtualOrganization)
Leave the given VO.
- synchronize_vos()
Synchronize the memberships in the virtual organizations.
This method checks the
eduperson_entitlementof the AAI userinfo andcreates the missing virtual organizations
removes the user from virtual organizations that he or she does not belong to anymore
adds the user to the virtual organizations that are new.
Notes
As we remove users from virtual organizations, this might end up in a lot of VOs without any users. One can remove these VOs via:
python manage.py remove_empty_vos
Notes
Emits the
aai_vo_created,aai_vo_enteredandaai_vo_leftsignals.
- update_user(**to_update)
Update the user from the userinfo provided by the Helmholtz AAI.
Notes
Emits the
aai_user_updatedsignal