auth
Module for authentication and authorization
Module Contents
Classes
Enum for permissions |
|
Helper class that provides methods for checking permissions |
Functions
|
Checks if a user has a permission on a document |
|
Checks if a user has a permission on a project |
|
Checks if a user has system permission |
Attributes
- class auth.Permissions
Bases:
str
,enum.Enum
Enum for permissions
- create = create
- view = view
- edit = edit
- delete = delete
- edit_permissions = edit_permissions
- class auth.PermissionUtils(session, user_name, project_name=None, document_name=None)
Helper class that provides methods for checking permissions
- Parameters
session (sqlmodel.Session) –
user_name (str) –
project_name (str) –
document_name (str) –
- has_sys_perm(self, permission)
- Parameters
permission (datatypes.models.SysPermissions) –
- has_proj_perm(self, permission)
- Parameters
permission (datatypes.models.ProjPermissions) –
- has_doc_perm(self, permission)
- Parameters
permission (datatypes.models.DocPermissions) –
- auth.document_map
- auth.has_document_permission(session, user, project, document, permission)
Checks if a user has a permission on a document
- Parameters
session (sqlmodel.Session) – session to use
user (datatypes.models.User) – user to check
project (datatypes.models.Project) – project of document
document (datatypes.models.Document) – document to check
permission (Permissions) – permission to check
- Returns
True if user has permission, False otherwise
- auth.project_map
- auth.has_project_permission(session, user, project, permission)
Checks if a user has a permission on a project
- Parameters
session (sqlmodel.Session) – session to use
user (datatypes.models.User) – user to check
project (datatypes.models.Project) – project to check
permission (Permissions) – permission to check
- Returns
True if user has permission, False otherwise
- auth.system_map
- auth.has_system_user_permission(session, user, permission)
Checks if a user has system permission
- Parameters
session (sqlmodel.Session) – session to use
user (datatypes.models.User) – user to check
permission (Permissions) – permission to check
- Returns
True if user has permission, False otherwise