Package web :: Package user :: Module userdecorators
[hide private]
[frames] | no frames]

Module userdecorators

source code

Functions [hide private]
 
has_permissions(actions=None)
Checks whether the current user (which may well be the anonymous user) has been granted permission to execute a task related to a given list of actions.
source code
 
authenticated(function)
If the user is authenticated it allows access to the resource, else ir redirect to login page
source code
Function Details [hide private]

has_permissions(actions=None)

source code 

Checks whether the current user (which may well be the anonymous user) has been granted permission to execute a task related to a given list of actions. The argument can be either a string with a single action name or a list of strings of action identifiers.

To check these permissions, we retrieve all the roles to which the current user belongs, and then check if the roles grant the user permissions for the given actions.

Note that if any of the given action names is not defined in the database, an exception will be raised, because it's a bug that the develop should fix: actions are managed by the plugin developer and the usage of this decorator.