Decorators to protects routes with permissions

Module Contents


_forbidden_message(action, module_code, object_code)

check_cruved_scope(action[, module_code, object_code, ...])

Decorator to protect routes with SCOPE CRUVED

permissions_required(action[, module_code, object_code])

geonature.core.gn_permissions.decorators._forbidden_message(action, module_code, object_code)[source]
geonature.core.gn_permissions.decorators.check_cruved_scope(action, module_code=None, object_code=None, *, get_scope=False)[source]

Decorator to protect routes with SCOPE CRUVED The decorator first check if the user is connected and then return the max user SCOPE permission for the action in parameter The decorator manages herited CRUVED from user’s group and parent module (GeoNature)



the requested action of the route <”C”, “R”, “U”, “V”, “E”, “D”>

module_codestr, optional

the code of the module (gn_commons.t_modules) (e.g. “OCCTAX”) for the requested permission, by default None

object_codestr, optional

the code of the object (gn_permissions.t_object) for the requested permission (e.g. “PERMISSIONS”), by default None

get_scopebool, optional

does the decorator should add the scope to view kwargs, by default False

geonature.core.gn_permissions.decorators.permissions_required(action, module_code=None, object_code=None)[source]