magpie.api.management.group.group_views¶
Classes¶
Model that defines a token for temporary URL completion of a given pending operation. |
|
Supported operations by the temporary tokens. |
|
Supported statuses of user-group relationships. |
Functions¶
|
Search in order for matched value of |
|
Get list of group names. |
|
Create a group. |
|
Get group information. |
|
Update a group by name. |
|
Delete a group by name. |
|
List all users from a group. |
|
List all services a group has permission on. |
|
List all permissions a group has on a specific service. |
|
Create a permission on a specific resource for a group. |
Create or modify an existing permission on a service for a group. |
|
|
Delete a permission from a specific resource for a group. |
Delete a permission by name from a specific service for a group. |
|
|
List all resources a group has permission on. |
|
List all permissions a group has on a specific resource. |
Create a permission on a specific resource for a group. |
|
Create or modify an existing permission on a resource for a group. |
|
Delete a permission from a specific resource for a group. |
|
Delete a permission by name from a specific resource for a group. |
|
|
List all resources under a service a group has permission on. |
Module Contents¶
- magpie.api.management.group.group_views.get_constant(constant_name: magpie.typedefs.Str, settings_container: magpie.typedefs.AnySettingsContainer | None = None, settings_name: magpie.typedefs.Str | None = None, default_value: magpie.typedefs.SettingValue | None = None, raise_not_set: bool = True, raise_missing: bool = True, print_missing: bool = False, empty_missing: bool = False) magpie.typedefs.SettingValue[source]¶
- Search in order for matched value of
constant_name: search in
MAGPIE_CONSTANTSsearch in settings if specified
search alternative setting names (see below)
search in
magpie.constantsdefinitionssearch in environment variables
Parameter
constant_nameis expected to have the formatMAGPIE_[VARIABLE_NAME]although any value can be passed to retrieve generic settings from all above-mentioned search locations.If
settings_nameis provided as alternative name, it is used as is to search for results ifconstant_namewas not found. Otherwise,magpie.[variable_name]is used for additional search when the formatMAGPIE_[VARIABLE_NAME]was used forconstant_name(i.e.:MAGPIE_ADMIN_USERwill also search formagpie.admin_userand so on for corresponding constants).- Parameters:
constant_name – key to search for a value
settings_container – WSGI application settings container (if not provided, uses found one in current thread)
settings_name – alternative name for settings if specified
default_value – default value to be returned if not found anywhere, and exception raises are disabled.
raise_not_set – raise an exception if the found key is
None, search until last case if others areNoneraise_missing – raise exception if key is not found anywhere
print_missing – print message if key is not found anywhere, return
Noneempty_missing – consider an empty value for an existing key as if it was missing (i.e.: as if not set).
- Returns:
found value or default_value
- Raises:
ValueError – if resulting value is invalid based on options (by default raise missing/empty/
Nonevalue)LookupError – if no appropriate value could be found from all search locations (according to options)
- Search in order for matched value of
- class magpie.api.management.group.group_views.TemporaryToken(*_, **__)[source]¶
Bases:
ziggurat_foundations.models.base.BaseModel,BaseModel that defines a token for temporary URL completion of a given pending operation.
- __tablename__ = 'tmp_tokens'¶
- token¶
- operation¶
- created¶
- user_id¶
- _user¶
- user_pending_id¶
- _pending_user¶
- group_id¶
- group¶
- static by_token(token: magpie.typedefs.Str | sqlalchemy.dialects.postgresql.UUID, db_session: sqlalchemy.orm.session.Session | None = None) TemporaryToken | None[source]¶
- class magpie.api.management.group.group_views.TokenOperation[source]¶
Bases:
magpie.utils.ExtendedEnumSupported operations by the temporary tokens.
- GROUP_ACCEPT_TERMS = 'group-accept-terms'¶
Temporary token associated to an URL endpoint called by a user that accepts the terms and conditions (T&C) to join a particular group.
- USER_PASSWORD_RESET = 'user-password-reset'¶
Temporary token associated to an URL endpoint to request a user password reset.
- USER_REGISTRATION_CONFIRM_EMAIL = 'user-registration-confirm-email'¶
Temporary token associated to a pending user registration that requires email validation by visiting the link.
- USER_REGISTRATION_ADMIN_APPROVE = 'user-registration-admin-approve'¶
Temporary token associated to a pending user registration that will be approved by an administrator when visited.
- USER_REGISTRATION_ADMIN_DECLINE = 'user-registration-admin-decline'¶
Temporary token associated to a pending user registration that will be declined by an administrator when visited.
- WEBHOOK_USER_STATUS_ERROR = 'webhook-user-status-error'¶
Temporary token employed to provide a callback URL that a registered webhook can call following the triggered event to indicate that the corresponding operation resulted into an invalid user status.
- class magpie.api.management.group.group_views.UserGroupStatus[source]¶
Bases:
magpie.utils.FlexibleNameEnumSupported statuses of user-group relationships.
- ALL = 'all'¶
- ACTIVE = 'active'¶
- PENDING = 'pending'¶
- magpie.api.management.group.group_views.get_group_users_view(request)[source]¶
List all users from a group.
Users can be filtered by status depending of input arguments.
- magpie.api.management.group.group_views.get_group_services_view(request)[source]¶
List all services a group has permission on.
- magpie.api.management.group.group_views.get_group_service_permissions_view(request)[source]¶
List all permissions a group has on a specific service.
- magpie.api.management.group.group_views.create_group_service_permission_view(request)[source]¶
Create a permission on a specific resource for a group.
- magpie.api.management.group.group_views.replace_group_service_permissions_view(request)[source]¶
Create or modify an existing permission on a service for a group.
Can be used to adjust permission modifiers.
- magpie.api.management.group.group_views.delete_group_service_permission_view(request)[source]¶
Delete a permission from a specific resource for a group.
- magpie.api.management.group.group_views.delete_group_service_permission_name_view(request)[source]¶
Delete a permission by name from a specific service for a group.
- magpie.api.management.group.group_views.get_group_resources_view(request)[source]¶
List all resources a group has permission on.
- magpie.api.management.group.group_views.get_group_resource_permissions_view(request)[source]¶
List all permissions a group has on a specific resource.
- magpie.api.management.group.group_views.create_group_resource_permissions_view(request)[source]¶
Create a permission on a specific resource for a group.
- magpie.api.management.group.group_views.replace_group_resource_permissions_view(request)[source]¶
Create or modify an existing permission on a resource for a group.
Can be used to adjust permission modifiers.
- magpie.api.management.group.group_views.delete_group_resource_permissions_view(request)[source]¶
Delete a permission from a specific resource for a group.