Package expedient :: Package common :: Package permissions :: Module models :: Class ObjectPermission
[hide private]
[frames] | no frames]

Class ObjectPermission

source code


Links a permission to its object using the contenttypes framework and to the set of permittees holding the permission.

Nested Classes [hide private]
  Meta
  DoesNotExist
  MultipleObjectsReturned

Inherited from django.db.models.base.Model: __metaclass__

Instance Methods [hide private]
 
objects(...)
ObjectPermissionManager for the class.
 
__unicode__(self) source code
 
give_to(self, receiver, giver=None, can_delegate=False)
Give permission ownership to an object.
source code

Inherited from django.db.models.base.Model: __eq__, __hash__, __init__, __ne__, __reduce__, __repr__, __str__, clean, clean_fields, date_error_message, delete, full_clean, prepare_database_save, save, save_base, serializable_value, unique_error_message, validate_unique

Inherited from django.db.models.base.Model (private): _collect_sub_objects, _get_FIELD_display, _get_next_or_previous_by_FIELD, _get_next_or_previous_in_order, _get_pk_val, _get_unique_checks, _perform_date_checks, _perform_unique_checks, _set_pk_val

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  _base_manager = <expedient.common.permissions.managers.ObjectP...
  _default_manager = <expedient.common.permissions.managers.Obje...
  _meta = <Options for ObjectPermission>
  permissionownership_set = <django.db.models.fields.related.For...
  permissionrequest_set = <django.db.models.fields.related.Forei...
  projectrole_set = <django.db.models.fields.related.ManyRelated...

Inherited from django.db.models.base.Model (private): _deferred

Instance Variables [hide private]
ExpedientPermission permission = models.ForeignKey(ExpedientPermission)
The ExpedientPermission of which this ObjectPermission is a sort of instance.
ForeignKey to ContentType object_type = models.ForeignKey(ContentType)
The ContentType indicating the class of the target.
positive int object_id = models.PositiveIntegerField()
The id of the target.
varies target = GenericForeignKey("object_type", "object_id")
the object for this target.
ManyToManyField to Permittee through PermissionOwnership permittees = models.ManyToManyField("Permittee", through= "Per...
many-to-many relationship to permittees who own the object permission
Properties [hide private]

Inherited from django.db.models.base.Model: pk

Inherited from object: __class__

Method Details [hide private]

give_to(self, receiver, giver=None, can_delegate=False)

source code 

Give permission ownership to an object. This method also checks that the action is allowed (the giver can actually give the permission to receiver).

Parameters:
  • receiver (Permittee or Model instance.) - The permittee receiving the permission. If not a Permittee instance, one will be created (if not found).
  • giver (Permittee or Model instance.) - The permission owner giving the permission. If not a Permittee instance, one will be created (if not found). Defaults to None.
  • can_delegate (bool) - Can the receiver in turn give the permission out? Default is False.
Returns:
The new PermissionOwnership instance.

Class Variable Details [hide private]

_base_manager

Value:
<expedient.common.permissions.managers.ObjectPermissionManager object \
at 0x8c5f52c>

_default_manager

Value:
<expedient.common.permissions.managers.ObjectPermissionManager object \
at 0x8c5f52c>

permissionownership_set

Value:
<django.db.models.fields.related.ForeignRelatedObjectsDescriptor objec\
t at 0x8c6622c>

permissionrequest_set

Value:
<django.db.models.fields.related.ForeignRelatedObjectsDescriptor objec\
t at 0x8c6680c>

projectrole_set

Value:
<django.db.models.fields.related.ManyRelatedObjectsDescriptor object a\
t 0x8d7454c>

Instance Variable Details [hide private]

permittees

many-to-many relationship to permittees who own the object permission
Type:
ManyToManyField to Permittee through PermissionOwnership
Value:
models.ManyToManyField("Permittee", through= "PermissionOwnership")