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:
User
A 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
Relationship fields:
- Parameters:
groups (
ManyToManyField
toGroup
) – 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 (
ManyToManyField
toPermission
) – User permissions. Specific permissions for this user. (related name:user_set
)user_ptr (
OneToOneField
toUser
) – Primary key: User ptr (related name:helmholtzuser
)
Reverse relationships:
- Parameters:
logentry (Reverse
ForeignKey
fromLogEntry
) – All log entries of this user (related name ofuser
)
Miscellaneous:
Model Fields:
Type:
CharField
Type:
OneToOneField
toUser
Attributes:
Internal field, use
user_ptr
instead.- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- eduperson_unique_id
Type:
CharField
Eduperson unique id
A wrapper for a deferred-loading field. When the value is read from this
- objects = <django_helmholtz_aai.models.HelmholtzUserManager object>
- user_ptr
Type:
OneToOneField
toUser
Primary 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:
UserManager
A manager for the helmholtz User.
Methods:
create_aai_user
(userinfo)Create a user from the Helmholtz AAI userinfo.
- create_aai_user(userinfo)
Create a user from the Helmholtz AAI userinfo.
- class django_helmholtz_aai.models.HelmholtzVirtualOrganization(*args, **kwargs)
Bases:
Group
A VO in the Helmholtz AAI.
- Parameters:
Relationship fields:
- Parameters:
permissions (
ManyToManyField
toPermission
) – Permissions (related name:group
)group_ptr (
OneToOneField
toGroup
) – Primary key: Group ptr (related name:helmholtzvirtualorganization
)
Reverse relationships:
- Parameters:
user (Reverse
ManyToManyField
fromUser
) – All user set of this group (related name ofgroups
)
Miscellaneous:
Attributes:
Internal field, use
group_ptr
instead.Model Fields:
Type:
CharField
Type:
OneToOneField
toGroup
- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- eduperson_entitlement
Type:
CharField
Eduperson entitlement
A wrapper for a deferred-loading field. When the value is read from this
- group_ptr
Type:
OneToOneField
toGroup
Primary 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:
GroupManagerFromHelmholtzVirtualOrganizationQuerySet
Database manager for the
HelmholtzVirtualOrganization
model.
- class django_helmholtz_aai.models.HelmholtzVirtualOrganizationQuerySet(model=None, query=None, using=None, hints=None)
Bases:
QuerySet
A 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_entitlement
matches 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: