Package s3 :: Module s3aaa :: Class S3PersonRoleManager
[frames] | no frames]

Class S3PersonRoleManager

source code

     object --+        
              |        
s3rest.S3Method --+    
                  |    
S3EntityRoleManager --+
                      |
                     S3PersonRoleManager

Role Manager for Person Records

Instance Methods
 
__init__(self, *args, **kwargs)
Constructor
source code
 
get_context_data(self, r, **attr)
Override to set the context from the perspective of a person
source code
 
get_entity(self)
An entity needs to be specified with the "edit" query string parameter.
source code
 
get_user(self)
We are on a person record so we need to find the associated user account.
source code
 
get_foreign_object(self)
We are on a user/person so we want to target an entity (org/office)
source code
 
get_assigned_roles(self, entity_id=None, user_id=None)
Returns: dictionary of assigned roles with entity pe_id as the keys
source code
 
get_form_fields(self)
Return a list of fields, including a field for selecting a realm entity (such as an organisation or office).
source code

Inherited from S3EntityRoleManager: apply_method, get_access_levels, get_form, get_form_vars, get_modules, get_realm, update_roles

Inherited from s3rest.S3Method: __call__, widget

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

Class Methods

Inherited from S3EntityRoleManager: set_method

Static Methods

Inherited from s3rest.S3Method: crud_string

Class Variables

Inherited from S3EntityRoleManager: ENTITY_TYPES

Properties

Inherited from object: __class__

Method Details

__init__(self, *args, **kwargs)
(Constructor)

source code 

Constructor

Overrides: object.__init__

get_context_data(self, r, **attr)

source code 

Override to set the context from the perspective of a person

Returns:
dictionary for view
Overrides: S3EntityRoleManager.get_context_data

get_entity(self)

source code 

An entity needs to be specified with the "edit" query string parameter.

Returns:
dictionary with pe_id and name of the org/office.

get_user(self)

source code 

We are on a person record so we need to find the associated user account.

Returns:
dictionary with ID and username/email of the user account

get_foreign_object(self)

source code 

We are on a user/person so we want to target an entity (org/office)

get_assigned_roles(self, entity_id=None, user_id=None)

source code 

If an entity ID is provided, the dict will be the users
with roles assigned to that entity. The key will be the user IDs.

If a user ID is provided, the dict will be the entities the
user has roles for. The key will be the entity pe_ids.

If both an entity and user ID is provided, the dict will be
the roles assigned to that user for that entity. The key will be
the user ID.

@type entity_id: int
@param entity_id: the pe_id of the entity
@type user_id: int
@param user_id: id of the user account

@return: dict
{
    1: [
        "staff_reader",
        "project_reader",
        ...
    ]
    2: [
        ...
    ],
    ...
}

Returns:
dictionary of assigned roles with entity pe_id as the keys
Overrides: S3EntityRoleManager.get_assigned_roles

To Do: description?

get_form_fields(self)

source code 

Return a list of fields, including a field for selecting a realm entity (such as an organisation or office).

Returns:
list of Fields
Overrides: S3EntityRoleManager.get_form_fields