Models

Models to mimic users and virtual organizations of the Helmholtz AAI in Django.

Models:

HelmholtzUser(*args, **kwargs)

A User in the in the Helmholtz AAI.

HelmholtzVirtualOrganization(*args, **kwargs)

A VO in the Helmholtz AAI.

Classes:

HelmholtzUserManager(*args, **kwargs)

A manager for the helmholtz User.

HelmholtzVirtualOrganizationManager(*args, ...)

Database manager for the HelmholtzVirtualOrganization model.

HelmholtzVirtualOrganizationQuerySet([...])

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 to Group) – 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 to Permission) – User permissions. Specific permissions for this user. (related name: user_set)

  • user_ptr (OneToOneField to User) – Primary key: User ptr (related name: helmholtzuser)

Reverse relationships:

Parameters:

logentry (Reverse ForeignKey from LogEntry) – All log entries of this user (related name of user)

Miscellaneous:

DoesNotExist

MultipleObjectsReturned

Model Fields:

eduperson_unique_id

Type: CharField

user_ptr

Type: OneToOneField to User

Attributes:

objects

user_ptr_id

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 to User

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')
user_ptr_id

Internal field, use user_ptr instead.

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:

Reverse relationships:

Parameters:

user (Reverse ManyToManyField from User) – All user set of this group (related name of groups)

Miscellaneous:

DoesNotExist

MultipleObjectsReturned

Attributes:

display_name

group_ptr_id

Internal field, use group_ptr instead.

objects

Model Fields:

eduperson_entitlement

Type: CharField

group_ptr

Type: OneToOneField to Group

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

property display_name: str
eduperson_entitlement

Type: CharField

Eduperson entitlement

A wrapper for a deferred-loading field. When the value is read from this

group_ptr

Type: OneToOneField to Group

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')
group_ptr_id

Internal field, use group_ptr instead.

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:

list[HelmholtzVirtualOrganization]