Package expedient :: Package clearinghouse :: Package roles :: Module models :: Class ProjectRole
[hide private]
[frames] | no frames]

Class ProjectRole

source code


Groups object permissions together for easier fine-grained management. This role is local to a project.

Nested Classes [hide private]
  Meta
  DoesNotExist
  MultipleObjectsReturned

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

Instance Methods [hide private]
 
objects(...)
a ProjectRoleManager.
 
__unicode__(self) source code
 
give_to_permittee(self, permittee, giver=None, can_delegate=False)
Give the role to a permittee.
source code
 
delete(self) source code
 
remove_from_permittee(self, permittee)
Remove all the permissions in this role from the permittee except for ones given by another role.
source code
 
add_permission(self, obj_permission, giver=None, can_delegate=False)
Add the object permission to the role and to all permittees who have this role.
source code
 
remove_permission(self, obj_permission)
Opposite of add_permission but does not remove the permission from permittees with other roles that have the permission.
source code
 
_base_manager(...)

Inherited from django.db.models.base.Model: __eq__, __hash__, __init__, __ne__, __reduce__, __repr__, __str__, clean, clean_fields, date_error_message, 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.clearinghouse.roles.models.Proje...
  _meta = <Options for ProjectRole>
  projectrolerequest_set = <django.db.models.fields.related.Fore...

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

Instance Variables [hide private]
str, max length=100 name = models.CharField(max_length= 100, help_text= "Enter the...
The name of the role.
TextField description = models.TextField(blank= True, default= "", help_...
Information about the role.
Project project = models.ForeignKey(Project)
The project for this role.
ManyToManyField to ObjectPermission. obj_permissions = models.ManyToManyField(ObjectPermission, ver...
object permissions that this roles groups.
ManyToManyField to Permittee. permittees = models.ManyToManyField(Permittee)
Set of permittees that have this role.
Properties [hide private]

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

Inherited from object: __class__

Method Details [hide private]

give_to_permittee(self, permittee, giver=None, can_delegate=False)

source code 

Give the role to a permittee. This combines the permittee's permissions.

Parameters:
  • permittee (object or Permittee instance.) - object to give the role to.
  • giver (Model instance or Permittee) - The giver of all the permissions in the roles. If not None, the giver will be checked for authorization to delegate the permission.
  • can_delegate (bool.) - Should the permittee be able to give the permissions in the role to others? Default False.

delete(self)

source code 
Overrides: django.db.models.base.Model.delete

add_permission(self, obj_permission, giver=None, can_delegate=False)

source code 

Add the object permission to the role and to all permittees who have this role.

Parameters:
  • obj_permission (ObjectPermission.) - The object permission to add.
  • giver (Model instance or Permittee) - The giver of the permission in the roles. If not None, the giver will be checked for authorization to delegate the permission.
  • can_delegate (bool.) - Should the permittees with this role be able to give the permission to others?

Class Variable Details [hide private]

_default_manager

Value:
<expedient.clearinghouse.roles.models.ProjectRoleManager object at 0x8\
d6d8ac>

projectrolerequest_set

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

Instance Variable Details [hide private]

name

The name of the role. Doesn't needs to be unique within a project.
Type:
str, max length=100
Value:
models.CharField(max_length= 100, help_text= "Enter the name of the ro\
le. This should be unique within " "the project.")

description

Information about the role.
Type:
TextField
Value:
models.TextField(blank= True, default= "", help_text= "The role's desc\
ription should help users know what the " "role is meant for and what \
capabilities the role gives.")

obj_permissions

object permissions that this roles groups.
Type:
ManyToManyField to ObjectPermission.
Value:
models.ManyToManyField(ObjectPermission, verbose_name= "Role's permiss\
ions", help_text= "Select the permissions that users who have role " "\
should have.")