Package expedient :: Package common :: Package permissions :: Module managers :: Class PermitteeManager
[hide private]
[frames] | no frames]

Class PermitteeManager

source code


Extends GenericObjectManager to add useful functions for getting Permittees.

Instance Methods [hide private]
 
filter_for_class_and_permission_name(self, klass, permission, target_obj_or_class, can_delegate=False)
Return a queryset filtered for only those who own a permission for a particular object.
source code
 
filter_for_permission_name(self, permission, target_obj_or_class, can_delegate=False)
Return a queryset filtered for only those who own a permission for a particular object.
source code
 
filter_for_obj_permission(self, obj_permission, can_delegate=False)
Return a queryset filtered for only those who own a permission for a particular object.
source code
Permittee
get_as_permittee(self, obj)
Get the object as a Permittee instance if it is not already.
source code

Inherited from utils.managers.GenericObjectManager: __init__, filter_for_class, filter_for_objects, filter_from_instance, filter_from_queryset, get_objects_queryset, get_or_create_from_instance

Inherited from django.db.models.manager.Manager: aggregate, all, annotate, complex_filter, contribute_to_class, count, create, dates, db_manager, defer, distinct, exclude, exists, extra, filter, get, get_empty_query_set, get_or_create, get_query_set, in_bulk, iterator, latest, none, only, order_by, raw, reverse, select_related, update, using, values, values_list

Inherited from django.db.models.manager.Manager (private): _copy_to_model, _insert, _set_creation_counter, _update

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

Class Variables [hide private]

Inherited from utils.managers.GenericObjectManager: use_for_related_fields

Inherited from django.db.models.manager.Manager: creation_counter

Properties [hide private]

Inherited from django.db.models.manager.Manager: db

Inherited from object: __class__

Method Details [hide private]

filter_for_class_and_permission_name(self, klass, permission, target_obj_or_class, can_delegate=False)

source code 

Return a queryset filtered for only those who own a permission for a particular object. Further, the returned queryset is of class given by klass.

Parameters:
  • klass (class or ContentType.) - The class of the objects in the returned queryset.
  • permission (str or ExpedientPermission.) - name of the permission or the ExpedientPermission object itself that we want the permittee to have
  • target_obj_or_class (a model instance or class.) - The object or class which we are looking for permissions for.
  • can_delegate (bool default False.) - If true then only look for permittees who can give the permission to others.

filter_for_permission_name(self, permission, target_obj_or_class, can_delegate=False)

source code 

Return a queryset filtered for only those who own a permission for a particular object.

Parameters:
  • permission (str or ExpedientPermission.) - name of the permission or the ExpedientPermission object itself that we want the permittee to have
  • target_obj_or_class (a model instance or class.) - The object or class which we are looking for permissions for.
  • can_delegate (bool default False.) - If true then only look for permittees who can give the permission to others.

filter_for_obj_permission(self, obj_permission, can_delegate=False)

source code 

Return a queryset filtered for only those who own a permission for a particular object.

Parameters:
  • obj_permission (ObjectPermission) - permission we want the permittees to have
  • can_delegate (bool default False.) - If true then only look for permittees who can give the permission to others.

get_as_permittee(self, obj)

source code 

Get the object as a Permittee instance if it is not already. If the Permittee for the object does not exist, then create it.

Parameters:
  • obj (a Model instance or a Permittee instance.) - the object to return as a Permittee instance.
Returns: Permittee
the Permittee instance pointing to the object.