Ignore:
Timestamp:
22 Sep 2013, 08:54:03 (11 years ago)
Author:
Henrik Bettermann
Message:

Define new local roles (see uniben ticket 900).

Allow the dynamical assignment of multiple local roles.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/dynamicroles.py

    r9565 r10639  
    4444    rolename_mapping = {
    4545        'waeup.local.ClearanceOfficer':'waeup.StudentsClearanceOfficer',
     46        'waeup.local.LocalStudentsManager': 'waeup.StudentsManager',
     47        'waeup.local.LocalWorkflowManager': 'waeup.WorkflowManager',
    4648        }
    4749
     
    109111                    result.append(
    110112                        (self.rolename_mapping[role_id], setting))
    111                     return result
     113                    # Local roles have been found, no need to climb up further.
     114                    obj = None
    112115            obj = getattr(obj, '__parent__', None)
    113116        return result
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_dynamicroles.py

    r10226 r10639  
    4949    def setUp(self):
    5050        super(StudentPrincipalRoleManagerFunctionalTests, self).setUp()
    51         # assign clearance permissions for a virtual officer
     51        # assign permissions for a virtual officers
    5252        prm = IPrincipalRoleManager(self.app['faculties']['fac1']['dep1'])
    5353        prm.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'alice')
    5454        prm.assignRoleToPrincipal('waeup.local.PGClearanceOfficer', 'bob')
    5555        prm.assignRoleToPrincipal('waeup.local.UGClearanceOfficer', 'anne')
     56        prm.assignRoleToPrincipal('waeup.local.LocalStudentsManager', 'benita')
     57        prm.assignRoleToPrincipal('waeup.local.LocalWorkflowManager', 'benita')
    5658        return
    5759
     
    100102        result = prm.getRolesForPrincipal('anne')
    101103        self.assertEqual(result, [('waeup.StudentsOfficer', Allow)])
     104        # Multiple roles can be assigned
     105        result = prm.getRolesForPrincipal('benita')
     106        self.assertEqual(result, [
     107            ('waeup.WorkflowManager', Allow),
     108            ('waeup.StudentsManager', Allow)
     109            ])
    102110        return
Note: See TracChangeset for help on using the changeset viewer.