geonature.core.gn_permissions.tools#

Attributes#

log

Functions#

_get_user_permissions(id_role)

get_user_permissions([id_role])

_get_permissions(id_role, module_code, object_code, ...)

get_permissions(action_code[, id_role, module_code, ...])

This function returns a set of all the permissions that match (action_code, id_role, module_code, object_code).

get_scope(action_code[, id_role, module_code, ...])

This function gets the final scope permission.

get_scopes_by_action([id_role, module_code, object_code])

This function gets the scopes permissions for each one of the 6 actions in "CRUVED",

has_any_permissions(→ bool)

This function return the scope for an action, a module and an object as a Boolean

has_any_permissions_by_action([id_role, module_code, ...])

This function gets the scopes permissions for each one of the 6 actions in "CRUVED",

Module Contents#

geonature.core.gn_permissions.tools.log[source]#
geonature.core.gn_permissions.tools._get_user_permissions(id_role)[source]#
geonature.core.gn_permissions.tools.get_user_permissions(id_role=None)[source]#
geonature.core.gn_permissions.tools._get_permissions(id_role, module_code, object_code, action_code)[source]#
geonature.core.gn_permissions.tools.get_permissions(action_code, id_role=None, module_code=None, object_code=None)[source]#

This function returns a set of all the permissions that match (action_code, id_role, module_code, object_code). If module_code is None, it is set as the code of the current module or as « GEONATURE » if no current module found. If object_code is None, it is set as the code of the current object or as « ALL » if no current object found.

:returns : the list of permissions that match, and an empty list if no match

geonature.core.gn_permissions.tools.get_scope(action_code, id_role=None, module_code=None, object_code=None, bypass_warning=False)[source]#

This function gets the final scope permission.

It takes the maximum for all the permissions that match (action_code, id_role, module_code, object_code) and with of a « SCOPE » filter type.

:returns : (int) The scope computed for specified arguments

geonature.core.gn_permissions.tools.get_scopes_by_action(id_role=None, module_code=None, object_code=None)[source]#

This function gets the scopes permissions for each one of the 6 actions in « CRUVED », that match (id_role, module_code, object_code)

:returns : (dict) A dict of the scope for each one of the 6 actions (the char in « CRUVED »)

geonature.core.gn_permissions.tools.has_any_permissions(action_code, id_role=None, module_code=None, object_code=None) bool[source]#

This function return the scope for an action, a module and an object as a Boolean Use for frontend

geonature.core.gn_permissions.tools.has_any_permissions_by_action(id_role=None, module_code=None, object_code=None)[source]#

This function gets the scopes permissions for each one of the 6 actions in « CRUVED », that match (id_role, module_code, object_code)

:returns : (dict) A dict of the boolean for each one of the 6 actions (the char in « CRUVED »)