repocribro.security¶
-
class
repocribro.security.
Permissions
¶ Class for prividing various permissions
-
__dict__
= mappingproxy({'__module__': 'repocribro.security', '__doc__': 'Class for prividing various permissions', '__init__': <function Permissions.__init__>, 'register_role': <function Permissions.register_role>, 'register_action': <function Permissions.register_action>, 'all_roles': <property object>, 'all_actions': <property object>, '__dict__': <attribute '__dict__' of 'Permissions' objects>, '__weakref__': <attribute '__weakref__' of 'Permissions' objects>})¶
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'repocribro.security'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
all_actions
¶ All registered action privileges
Returns: set of str
-
all_roles
¶ All registered roles
Returns: set of str
-
register_action
(priv_name)¶ Register new action privilege by name
Parameters: priv_name (str) – name of action privilege to register
-
register_role
(role_name)¶ Register new role by name
Parameters: role_name (str) – name of role to register
-
-
class
repocribro.security.
PermissionsContainer
(name)¶ Container for permission to be used for decorators
-
__dict__
= mappingproxy({'__module__': 'repocribro.security', '__doc__': 'Container for permission to be used for decorators', '__init__': <function PermissionsContainer.__init__>, '__getattr__': <function PermissionsContainer.__getattr__>, '__dict__': <attribute '__dict__' of 'PermissionsContainer' objects>, '__weakref__': <attribute '__weakref__' of 'PermissionsContainer' objects>})¶
-
__getattr__
(key)¶
-
__init__
(name)¶ Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'repocribro.security'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
repocribro.security.
clear_session
(*args)¶ Simple helper for clearing variables from session
Parameters: args – names of session variables to remove
-
repocribro.security.
create_default_role
(app, db, role)¶ Create default role for the app
Parameters: - app (
repocribro.repocribro.Repocribro
) – Current flask application - db (
flask_sqlalchemy.SQLAlchemy
) – Database connection - role (
repocribro.models.Role
) – Role to be created
- app (
-
repocribro.security.
get_default_user_role
(app, db)¶ Get special default role for registered users
Parameters: - app (
repocribro.repocribro.Repocribro
) – Current flask application - db (
flask_sqlalchemy.SQLAlchemy
) – Database connection
- app (
-
repocribro.security.
init_login_manager
(db)¶ Init security extensions (login manager and principal)
Parameters: db ( flask_sqlalchemy.SQLAlchemy
) – Database which stores user accounts and rolesReturns: Login manager and principal extensions Return type: ( flask_login.LoginManager
,flask_principal.Principal
-
repocribro.security.
login
(user_account)¶ Login desired user into the app
Parameters: user_account ( repocribro.models.UserAccount
) – User account to be logged in
-
repocribro.security.
logout
()¶ Logout the current user from the app
-
repocribro.security.
on_identity_loaded
(sender, identity)¶ Principal helper for loading the identity of logged user
Parameters: - sender – Sender of the signal
- identity (
flask_principal.Identity
) – Identity container
-
repocribro.security.
permissions
= <repocribro.security.Permissions object>¶ All permissions in the app
-
repocribro.security.
reload_anonymous_role
(app, db)¶ Reload special role for anonymous users
Parameters: - app (
repocribro.repocribro.Repocribro
) – Current flask application - db (
flask_sqlalchemy.SQLAlchemy
) – Database connection
- app (