gcampus.auth¶
- class gcampus.auth.models.BaseToken(*args, **kwargs)¶
Bases:
DateModelMixinThe base token provides a common interface and attributes that are shared across the
AccessKeyandCourseTokenmodels.- DEFAULT_PERMISSIONS: List[Tuple[str, str]]¶
List of permissions that should be applied by default to all newly created instances. Note that this is attribute is only available in subclasses.
- TOKEN_LENGTH: int¶
Length in characters of the token. Required to generate a random and unique value for the
tokenfield. Note that this is attribute is only available in subclasses.
- apply_default_permissions()¶
Apply all default permissions as specified in
DEFAULT_PERMISSIONS.
- course: ForeignKey | Course¶
The course associated with this token. Note that this is a foreign key relation (many to one) for access keys while it is a one-to-one relation for course tokens.
- deactivated: BooleanField¶
Whether the token is deactivated. Deactivated tokens can not be used to log in and have no permissions.
- get_all_permissions() List[str]¶
Return a list of all permissions in the style of
{app_label}.{codename}.
- property is_active: bool¶
Whether the user is active. This is only the case when the user is not
deactivatedand the course email is verified (seegcampus.auth.models.Course.email_verified).
- last_login: DateTimeField¶
Date and time of the last login. Updated using the
gcampus.auth.signals.token_user_logged_insignal.
- permissions: ManyToManyField | PermissionManager¶
List of permissions (many to many field) for this token.
- token: CharField | str¶
The token field contains a unique character of length
TOKEN_LENGTHused for authentication. Note that this is attribute is only available in subclasses as the length varies from model to model.
- type: TokenType¶
Type of the token.