Models
Models to mimic users and virtual organizations of the Helmholtz AAI in Django.
Models:
|
A User in the in the Helmholtz AAI. |
|
A VO in the Helmholtz AAI. |
Classes:
|
A manager for the helmholtz User. |
|
Database manager for the |
A queryset with an extra command to remove empty VOs. |
- class django_helmholtz_aai.models.HelmholtzUser(*args, **kwargs)
Bases:
UserA User in the in the Helmholtz AAI.
- Parameters:
id (AutoField) – Primary key: ID
password (CharField) – Password
last_login (DateTimeField) – Last login
is_superuser (BooleanField) – Superuser status. Designates that this user has all permissions without explicitly assigning them.
username (CharField) – Username. Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
first_name (CharField) – First name
last_name (CharField) – Last name
email (EmailField) – Email address
is_staff (BooleanField) – Staff status. Designates whether the user can log into this admin site.
is_active (BooleanField) – Active. Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
date_joined (DateTimeField) – Date joined
eduperson_unique_id (CharField) – Eduperson unique id
userinfo (JSONField) – Userinfo. Userinfo from the Helmholtz AAI.
is_temporary (BooleanField) – Is temporary. Has the user been created temporarily because the mapping is not yet finished?
Relationship fields:
- Parameters:
groups (
ManyToManyFieldtoGroup) – Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups. (related name:user_set)user_permissions (
ManyToManyFieldtoPermission) – User permissions. Specific permissions for this user. (related name:user_set)user_ptr (
OneToOneFieldtoUser) – Primary key: User ptr (related name:helmholtzuser)
Reverse relationships:
- Parameters:
logentry (Reverse
ForeignKeyfromLogEntry) – All log entries of this user (related name ofuser)
Miscellaneous:
Model Fields:
Type:
CharFieldType:
BooleanFieldType:
OneToOneFieldtoUserType:
JSONFieldAttributes:
Internal field, use
user_ptrinstead.- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- eduperson_unique_id
Type:
CharFieldEduperson unique id
A wrapper for a deferred-loading field. When the value is read from this
- is_temporary
Type:
BooleanFieldIs temporary. Has the user been created temporarily because the mapping is not yet finished?
A wrapper for a deferred-loading field. When the value is read from this
- objects = <django_helmholtz_aai.models.HelmholtzUserManager object>
- user_ptr
Type:
OneToOneFieldtoUserPrimary key: User ptr (related name:
helmholtzuser)Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
- class django_helmholtz_aai.models.HelmholtzUserManager(*args, **kwargs)
Bases:
UserManagerA manager for the helmholtz User.
Methods:
create_aai_user(userinfo, **kwargs)Create a user from the Helmholtz AAI userinfo.
get_or_create_aai_user(userinfo, **kwargs)Create a user from the Helmholtz AAI userinfo.
- create_aai_user(userinfo, **kwargs)
Create a user from the Helmholtz AAI userinfo.
- get_or_create_aai_user(userinfo, **kwargs)
Create a user from the Helmholtz AAI userinfo.
- class django_helmholtz_aai.models.HelmholtzVirtualOrganization(*args, **kwargs)
Bases:
GroupA VO in the Helmholtz AAI.
- Parameters:
Relationship fields:
- Parameters:
permissions (
ManyToManyFieldtoPermission) – Permissions (related name:group)group_ptr (
OneToOneFieldtoGroup) – Primary key: Group ptr (related name:helmholtzvirtualorganization)
Reverse relationships:
- Parameters:
user (Reverse
ManyToManyFieldfromUser) – All user set of this group (related name ofgroups)
Miscellaneous:
Attributes:
Internal field, use
group_ptrinstead.Model Fields:
Type:
CharFieldType:
OneToOneFieldtoGroup- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- eduperson_entitlement
Type:
CharFieldEduperson entitlement
A wrapper for a deferred-loading field. When the value is read from this
- group_ptr
Type:
OneToOneFieldtoGroupPrimary key: Group ptr (related name:
helmholtzvirtualorganization)Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
- objects = <django_helmholtz_aai.models.HelmholtzVirtualOrganizationManager object>
- class django_helmholtz_aai.models.HelmholtzVirtualOrganizationManager(*args, **kwargs)
Bases:
GroupManagerFromHelmholtzVirtualOrganizationQuerySetDatabase manager for the
HelmholtzVirtualOrganizationmodel.
- class django_helmholtz_aai.models.HelmholtzVirtualOrganizationQuerySet(model=None, query=None, using=None, hints=None)
Bases:
QuerySetA queryset with an extra command to remove empty VOs.
Methods:
remove_empty_vos([exclude, without_confirmation])Remove empty virtual organizations.
- remove_empty_vos(exclude: list[str] = [], without_confirmation: bool = True) list[HelmholtzVirtualOrganization]
Remove empty virtual organizations.
This method filters for virtual organizations in the queryset and removes them.
- Parameters:
exclude (list[str]) – A list of strings that will be interpreted as regular expressions. If a
eduperson_entitlementmatches any of these strings, it will not be removed.without_confirmation (bool) – If True (default), remove the VO without asking for confirmation using python’s built-in
input()from the command-line.
- Returns:
The list of virtual organizations that have been removed
- Return type: