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
Files:
5 edited

Legend:

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

    r10632 r10639  
    115115    grok.name('waeup.local.ClearanceOfficer')
    116116    grok.title(u'Clearance Officer')
     117    grok.permissions('waeup.showStudents',
     118                     'waeup.viewAcademics',
     119                     'waeup.exportData')
     120
     121class LocalStudentsManager(grok.Role):
     122    """The local students manager role is meant for the
     123    assignment of dynamic roles only.
     124    """
     125    grok.name('waeup.local.LocalStudentsManager')
     126    grok.title(u'Students Manager')
     127    grok.permissions('waeup.showStudents',
     128                     'waeup.viewAcademics',
     129                     'waeup.exportData')
     130
     131class LocalWorkflowManager(grok.Role):
     132    """The local workflow manager role is meant for the
     133    assignment of dynamic roles only.
     134    """
     135    grok.name('waeup.local.LocalWorkflowManager')
     136    grok.title(u'Student Workflow Manager')
    117137    grok.permissions('waeup.showStudents',
    118138                     'waeup.viewAcademics',
  • main/waeup.kofa/trunk/src/waeup/kofa/permissions.txt

    r10347 r10639  
    4242
    4343    >>> len(list(get_waeup_roles(also_local=True)))
    44     40
     44    42
    4545
    4646
  • 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
  • main/waeup.kofa/trunk/src/waeup/kofa/university/faculty.py

    r10561 r10639  
    5454        'waeup.local.CourseAdviser700',
    5555        'waeup.local.CourseAdviser800',
     56        'waeup.local.LocalStudentsManager',
     57        'waeup.local.LocalWorkflowManager',
    5658        ]
    5759
Note: See TracChangeset for help on using the changeset viewer.