Package eggbasket :: Module permissions :: Class has_permission
[hide private]

Class has_permission

source code

                                            object --+    
                                                     |    
              turbogears.identity.conditions.Predicate --+
                                                         |
                                            object --+   |
                                                     |   |
turbogears.identity.conditions.IdentityPredicateHelper --+
                                                         |
                                                        has_permission

Checks if user attached to current identity has given permission.

This extends the standard ``identity.has_permission`` predicate in that it allows to define extra groups for anonymous users (named "anonymous" per default) and all authenticated users ("authenticated") to which additional permissions for these groups of users can be attached.

You can set the names of the extra groups in the configuration with the ``identity.anonymous_groups`` resp. ``identity.authenticated_groups``. Both settings expect a list of group names. Appropriatly named groups must be created in the database, but if they are missing the check will still work but always fail for anonymous users.

Instance Methods [hide private]
 
__init__(self, permission_name, error_message=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
eval_with_object(self, identity, errors=None)
Determine whether predicate is True or False for the given object.
source code

Inherited from turbogears.identity.conditions.Predicate: append_error_message

Inherited from turbogears.identity.conditions.IdentityPredicateHelper: __nonzero__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  error_message = 'Permission denied: %(permission_name)s'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, permission_name, error_message=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

eval_with_object(self, identity, errors=None)

source code 

Determine whether predicate is True or False for the given object.

Overrides: turbogears.identity.conditions.Predicate.eval_with_object
(inherited documentation)