Package expedient :: Package common :: Package permissions :: Module decorators :: Class require_obj_permissions_for_method
[hide private]
[frames] | no frames]

Class require_obj_permissions_for_method

source code


Decorator that checks that one model has permissions to use another.

The decorator requires the following parameters on initialization:

Instance Methods [hide private]
 
__init__(self, permittee_kw, perm_names)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__call__(self, f)
This method is called on execution of the decorator to get the wrapper defined inside.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, permittee_kw, perm_names)
(Constructor)

source code 

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

Parameters:
  • permittee_kw (str) - the keyword used to store the permittee object in threadlocals.
  • perm_names (list of str

    For example:

       class TestModel(models.Model):
           @require_obj_permissions_for_method(
               "user", ["can_call_methods", "can_call_test"])
           def test_method(self, paramA, paramB):
               pass
    
    ) - a list of permission names that are required.
Overrides: object.__init__
(inherited documentation)