Package vita :: Package modules :: Package eden :: Module pr
[frames] | no frames]

Module pr

source code

Sahana Eden Person Registry Model


Copyright: 2009-2012 (c) Sahana Software Foundation

License: MIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Classes
  S3PersonEntity
Person Super-Entity
  S3OrgAuthModel
Organisation-based Authorization Model
  S3PersonModel
Persons and Groups
  S3GroupModel
Groups
  S3ContactModel
Person Contacts
  S3PersonAddressModel
Addresses for Persons
  S3PersonImageModel
Images for Persons
  S3PersonIdentityModel
Identities for Persons
  S3SavedSearch
Saved Searches
  S3PersonPresence
Presence Log for Persons
  S3PersonDescription
Additional tables for DVI/MPR
Functions
 
pr_pentity_represent(id, show_label=True, default_label="[No ID Tag]")
Represent a Person Entity in option fields or list views
source code
 
pr_person_represent(id)
Representation
source code
 
pr_person_comment(title=None, comment=None, caller=None, child=None) source code
 
pr_rheader(r, tabs=[])
Person Registry resource headers...
source code
 
pr_contacts(r, **attr)
Custom Method to provide the details for the Person's Contacts Tab: - provides a single view on: Addresses (pr_address) Contacts (pr_contact) Emergency Contacts
source code
 
pr_profile(r, **attr)
Custom Method to provide the auth_user profile as a Tab of the Person
source code
 
pr_update_affiliations(table, record)
Update OU affiliations related to this record
source code
 
pr_add_affiliation(master, affiliate, role=None, role_type=OU)
Add a new affiliation record
source code
 
pr_remove_affiliation(master, affiliate, role=None)
Remove affiliation records
source code
 
pr_get_pe_id(entity, record_id=None)
Get the PE-ID of an instance record
source code
 
pr_define_role(pe_id, role=None, role_type=None, entity_type=None, sub_type=None)
Back-end method to define a new affiliates-role for a person entity
source code
 
pr_delete_role(role_id)
Back-end method to delete a role
source code
 
pr_add_to_role(role_id, pe_id)
Back-end method to add a person entity to a role.
source code
 
pr_remove_from_role(role_id, pe_id)
Back-end method to remove a person entity from a role.
source code
 
pr_get_role_paths(pe_id, roles=None, role_types=None)
Get the ancestor paths of the ancestor OUs this person entity is affiliated with, sorted by roles.
source code
 
pr_get_role_branches(pe_id, roles=None, role_types=None, entity_type=None)
Get all descendants of the immediate ancestors of the entity within these roles/role types
source code
 
pr_get_path(pe_id)
Get all ancestor paths of a person entity
source code
 
pr_get_ancestors(pe_id)
Find all ancestor entities of a person entity in the OU hierarchy (performs a path lookup where paths are available, otherwise rebuilds paths).
source code
 
pr_realm(entity)
Get the default realm (=the immediate OU ancestors) of an entity
source code
 
pr_ancestors(entities)
Find all ancestor entities of the given entities in the OU hierarchy.
source code
 
pr_descendants(pe_ids, skip=[]) source code
 
pr_get_descendants(pe_ids, skip=[], entity_type=None, ids=True)
Find descendant entities of a person entity in the OU hierarchy (performs a real search, not a path lookup).
source code
 
pr_rebuild_path(pe_id, clear=False)
Rebuild the ancestor path of all roles in the OU hierarchy a person entity defines.
source code
 
pr_role_rebuild_path(role_id, skip=[], clear=False)
Rebuild the ancestor path of a role within the OU hierarchy
source code
Function Details

pr_pentity_represent(id, show_label=True, default_label="[No ID Tag]")

source code 

Represent a Person Entity in option fields or list views

pr_person_represent(id)

source code 

Representation

pr_person_comment(title=None, comment=None, caller=None, child=None)

source code 

pr_rheader(r, tabs=[])

source code 

Person Registry resource headers
- used in PR, HRM, DVI, MPR, MSG, VOL

pr_contacts(r, **attr)

source code 

Custom Method to provide the details for the Person's Contacts Tab:
- provides a single view on:
    Addresses (pr_address)
    Contacts (pr_contact)
    Emergency Contacts

@ToDo: Fix Map in Address' LocationSelector
@ToDo: Allow Address Create's LocationSelector to work in Debug mode

pr_profile(r, **attr)

source code 

Custom Method to provide the auth_user profile as a Tab of the Person

To Do: Complete this (currently unfinished)

pr_update_affiliations(table, record)

source code 

Update OU affiliations related to this record

Parameters:
  • table - the table
  • record - the record

pr_add_affiliation(master, affiliate, role=None, role_type=OU)

source code 

Add a new affiliation record

Parameters:
  • master - the master entity, either as PE-ID or as tuple (instance_type, instance_id)
  • affiliate - the affiliated entity, either as PE-ID or as tuple (instance_type, instance_id)
  • role - the role to add the affiliate to (will be created if it doesn't yet exist)
  • role_type - the type of the role, defaults to OU

pr_remove_affiliation(master, affiliate, role=None)

source code 

Remove affiliation records

Parameters:
  • master - the master entity, either as PE-ID or as tuple (instance_type, instance_id), if this is None, then all affiliations with all entities will be removed
  • affiliate - the affiliated entity, either as PE-ID or as tuple (instance_type, instance_id)
  • affiliate - the affiliated PE, either as pe_id or as tuple (instance_type, instance_id)
  • role - name of the role to remove the affiliate from, if None, the affiliate will be removed from all roles

pr_get_pe_id(entity, record_id=None)

source code 

Get the PE-ID of an instance record

Parameters:
  • entity - the entity, either a tablename, a tuple (tablename, record_id), a Row of the instance type, or a PE-ID
  • record_id - the record ID, if entity is a tablename
Returns:
the PE-ID

pr_define_role(pe_id, role=None, role_type=None, entity_type=None, sub_type=None)

source code 

Back-end method to define a new affiliates-role for a person entity

Parameters:
  • pe_id - the person entity ID
  • role - the role name
  • role_type - the role type (from pr_role_types), default 9
  • entity_type - limit selection in CRUD forms to this entity type
  • sub_type - limit selection in CRUD forms to this entity sub-type
Returns:
the role ID

pr_delete_role(role_id)

source code 

Back-end method to delete a role

Parameters:
  • role_id - the role ID

pr_add_to_role(role_id, pe_id)

source code 

Back-end method to add a person entity to a role.

Parameters:
  • role_id - the role ID
  • pe_id - the person entity ID

To Do: update descendant paths only if the role is a OU role

pr_remove_from_role(role_id, pe_id)

source code 

Back-end method to remove a person entity from a role.

Parameters:
  • role_id - the role ID
  • pe_id - the person entity ID

To Do: update descendant paths only if the role is a OU role

pr_get_role_paths(pe_id, roles=None, role_types=None)

source code 

Get the ancestor paths of the ancestor OUs this person entity is affiliated with, sorted by roles.

Used by gis.set_config()

Parameters:
  • pe_id - the person entity ID
  • roles - list of roles to limit the search
  • role_types - list of role types to limit the search
Returns:
a Storage() of S3MultiPaths with the role names as keys

Note: role_types is ignored if roles gets specified

pr_get_role_branches(pe_id, roles=None, role_types=None, entity_type=None)

source code 

Get all descendants of the immediate ancestors of the entity within these roles/role types

Parameters:
  • pe_id - the person entity ID
  • roles - list of roles to limit the search
  • role_types - list of role types to limit the search
  • entity_type - limit the result to this entity type
Returns:
a list of PE-IDs

Note: role_types is ignored if roles gets specified

pr_get_path(pe_id)

source code 

Get all ancestor paths of a person entity

Parameters:
  • pe_id - the person entity ID
Returns:
an S3MultiPath instance

pr_get_ancestors(pe_id)

source code 

Find all ancestor entities of a person entity in the OU hierarchy (performs a path lookup where paths are available, otherwise rebuilds paths).

Parameters:
  • pe_id - the person entity ID
  • roles - list of roles to limit the search
Returns:
a list of PE-IDs

pr_realm(entity)

source code 

Get the default realm (=the immediate OU ancestors) of an entity

Parameters:
  • entity - the entity (pe_id)

pr_ancestors(entities)

source code 

Find all ancestor entities of the given entities in the OU hierarchy.

Parameters:
  • pe_id - the person entity ID
  • roles - list of roles to limit the search
Returns:
Storage of lists of PE-IDs

pr_descendants(pe_ids, skip=[])

source code 

pr_get_descendants(pe_ids, skip=[], entity_type=None, ids=True)

source code 

Find descendant entities of a person entity in the OU hierarchy (performs a real search, not a path lookup).

Parameters:
  • pe_ids - person entity ID or list of IDs
  • skip - list of person entity IDs to skip during descending
Returns:
a list of PE-IDs

pr_rebuild_path(pe_id, clear=False)

source code 

Rebuild the ancestor path of all roles in the OU hierarchy a person entity defines.

Parameters:
  • pe_id - the person entity ID
  • clear - clear paths in descendant roles (triggers lazy rebuild)

pr_role_rebuild_path(role_id, skip=[], clear=False)

source code 

Rebuild the ancestor path of a role within the OU hierarchy

Parameters:
  • role_id - the role ID
  • skip - list of role IDs to skip during recursion
  • clear - clear paths in descendant roles (triggers lazy rebuild)