diff --git a/CHANGES.txt b/CHANGES.txt index 60f11b5..666b26f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,8 @@ $Id$ 1.1 --- +- allow for adoption of relations to a predicate interface; + with example implementation for a 'has Role' predicate in loops.organize - external collection: provide functionality for automatically populate meta information of media assets - new query for retrieving work items independently of task or user diff --git a/interfaces.py b/interfaces.py index eb63b96..4b107f0 100644 --- a/interfaces.py +++ b/interfaces.py @@ -729,6 +729,12 @@ class IPredicate(IConceptSchema): required=False) +class IRelationAdapter(Interface): + """ Base interface for adapters to relations that allow the specification + of special properties of a relation. + """ + + # probably not useful class xxIMappingAttributeRelation(IConceptSchema): """ A relation based on a predicate ('mappingAttribute') that provides diff --git a/organize/README.txt b/organize/README.txt index 3ed8cfb..cbd7bd7 100644 --- a/organize/README.txt +++ b/organize/README.txt @@ -390,15 +390,6 @@ Events listing >>> list(listing.events()) [] -Allocation of persons to tasks ------------------------------- - - >>> from loops.organize.interfaces import IAllocated - >>> predicate = concepts['predicate'] - >>> allocated = addAndConfigureObject(concepts, Concept, 'allocated', - ... title=u'allocated', - ... conceptType=predicate, predicateInterface=IAllocated) - Send Email to Members ===================== @@ -423,6 +414,45 @@ Show Presence of Other Users >>> component.provideUtility(Presence()) +Roles of Persons +================ + +When persons are assigned to a parent (e.g. an instutution or a project) +this assignment may be characterized by a certain role. This role may +be specified by using a special predicate that is associated with a +predicate interface that allows to specify the role. + +(Note that the security-relevant assignment of persons is managed via +other special predicates: 'ismember', 'ismaster'. The 'hasrole' +predicate described here is intended for situations where the roles +may be chosen from an arbitrary list.) + + >>> from loops.organize.interfaces import IHasRole + >>> predicate = concepts['predicate'] + >>> hasRole = addAndConfigureObject(concepts, Concept, 'hasrole', + ... title=u'has Role', + ... conceptType=predicate, predicateInterface=IHasRole) + +Let's now assign john to task01 and have a look at the relation created. + + >>> task01.assignChild(john, hasRole) + >>> relation = task01.getChildRelations([hasRole])[0] + +The role may be accessed by getting a relation adapter + + >>> from loops.predicate import adaptedRelation + >>> adRelation = adaptedRelation(relation) + >>> adRelation.role is None + True + + >>> adRelation.role = 'member' + >>> relation._role + 'member' + >>> adRelation = adaptedRelation(relation) + >>> adRelation.role + 'member' + + Calendar ======== diff --git a/organize/configure.zcml b/organize/configure.zcml index 7e075ab..e760a03 100644 --- a/organize/configure.zcml +++ b/organize/configure.zcml @@ -39,6 +39,16 @@ set_schema="loops.organize.interfaces.ITask" /> + + + + + +