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: django.contrib.auth.models.User

A User in the in the Helmholtz AAI.

Parameters
  • id (AutoField) – 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

  • groups (ManyToManyField) – Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups.

  • user_permissions (ManyToManyField) – User permissions. Specific permissions for this user.

  • user_ptr (OneToOneField to User) – User ptr

  • eduperson_unique_id (CharField) – Eduperson unique id

Miscellaneous:

DoesNotExist

MultipleObjectsReturned

Model Fields:

eduperson_unique_id

Model field: eduperson unique id

user_ptr

Model field: user ptr, accesses the User model.

Attributes:

objects

user_ptr_id

Model field: user ptr

exception DoesNotExist

Bases: django.contrib.auth.models.User.DoesNotExist

exception MultipleObjectsReturned

Bases: django.contrib.auth.models.User.MultipleObjectsReturned

eduperson_unique_id

Model field: eduperson unique id

objects = <django_helmholtz_aai.models.HelmholtzUserManager object>
user_ptr

Model field: user ptr, accesses the User model.

user_ptr_id

Model field: user ptr

class django_helmholtz_aai.models.HelmholtzUserManager(*args, **kwargs)

Bases: django.contrib.auth.models.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: django.contrib.auth.models.Group

A VO in the Helmholtz AAI.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • permissions (ManyToManyField) – Permissions

  • group_ptr (OneToOneField to Group) – Group ptr

  • eduperson_entitlement (CharField) – Eduperson entitlement

Miscellaneous:

DoesNotExist

MultipleObjectsReturned

Attributes:

display_name

group_ptr_id

Model field: group ptr

objects

Model Fields:

eduperson_entitlement

Model field: eduperson entitlement

group_ptr

Model field: group ptr, accesses the Group model.

exception DoesNotExist

Bases: django.contrib.auth.models.Group.DoesNotExist

exception MultipleObjectsReturned

Bases: django.contrib.auth.models.Group.MultipleObjectsReturned

property display_name: str
eduperson_entitlement

Model field: eduperson entitlement

group_ptr

Model field: group ptr, accesses the Group model.

group_ptr_id

Model field: group ptr

objects = <django_helmholtz_aai.models.HelmholtzVirtualOrganizationManager object>
class django_helmholtz_aai.models.HelmholtzVirtualOrganizationManager(*args, **kwargs)

Bases: django.db.models.manager.GroupManagerFromHelmholtzVirtualOrganizationQuerySet

Database manager for the HelmholtzVirtualOrganization model.

class django_helmholtz_aai.models.HelmholtzVirtualOrganizationQuerySet(model=None, query=None, using=None, hints=None)

Bases: django.db.models.query.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]