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

Class ExpedientPermission

source code


This class holds all instances of ObjectPermission that have a particular name. ObjectPermission links permittees to a particular object.

A permission may optionally have a view where the browser should be redirected if the permission is missing (for example to request the permission). The view is specified by its full path in view.

The signature for the view function should be the following:

   missing_perm_view(
           request, permission, permittee, target_obj_or_class,
           redirect_to=None)

   - C{permission} is the missing L{ExpedientPermission}.
   - C{permittee} is the object that needs to exercise the permission.
   - C{target_obj_or_class} is the object or class whose permission is
       missing.
   - C{redirect_to} is the URL from which the request was made.

One limitation of the system right now is that we can only link to objects that use a PositiveIntegerField as the object ID.

Nested Classes [hide private]
  DoesNotExist
  MultipleObjectsReturned

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

Instance Methods [hide private]
 
objects(...)
a ExpedientPermissionManager instance.
 
__unicode__(self) source code
 
_base_manager(...)

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]
  _default_manager = <expedient.common.permissions.managers.Expe...
  _meta = <Options for ExpedientPermission>
  objectpermission_set = <django.db.models.fields.related.Foreig...

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

Instance Variables [hide private]
str name = models.CharField(max_length= 100, unique= True)
The permission's name
str description = models.TextField(blank= True, default= "")
Information about the permission.
str view = models.CharField("Permission View", max_length= 300, bl...
The full path to the view for the permission
m2m relationship to ObjectPermission. object_permissions
Per-object permissions with this permission name.
Properties [hide private]

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

Inherited from object: __class__

Class Variable Details [hide private]

_default_manager

Value:
<expedient.common.permissions.managers.ExpedientPermissionManager obje\
ct at 0x8c5f28c>

objectpermission_set

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

Instance Variable Details [hide private]

view

The full path to the view for the permission
Type:
str
Value:
models.CharField("Permission View", max_length= 300, blank= True, null\
= True)