repocribro.security

class repocribro.security.Permissions

Class for prividing various permissions

Todo

allow extensions provide permissions to others

__dict__ = mappingproxy({'__module__': 'repocribro.security', 'admin_role': <Permission needs={Need(method='role', value='admin')} excludes=set()>, '__dict__': <attribute '__dict__' of 'Permissions' objects>, '__weakref__': <attribute '__weakref__' of 'Permissions' objects>, '__doc__': ' Class for prividing various permissions\n\n .. todo:: allow extensions provide permissions to others\n '})
__module__ = 'repocribro.security'
__weakref__

list of weak references to the object (if defined)

admin_role = <Permission needs={Need(method='role', value='admin')} excludes=set()>

Administrator role permission

repocribro.security.clear_session(*args)

Simple helper for clearing variables from session

Parameters:args – names of session variables to remove
repocribro.security.init_login_manager(db)

Init security extensions (login manager and principal)

Parameters:db (flask_sqlalchemy.SQLAlchemy) – Database which stores user accounts and roles
Returns: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