Ignore:
Timestamp:
23 Nov 2011, 09:18:19 (13 years ago)
Author:
Henrik Bettermann
Message:

Role back some changes made earlier: global and local role strings with html tags should be better constructed in view not in permission module.

Rename some role related methods to avoid (my) confusion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7176 r7177  
    3737    ISessionConfiguration, ISessionConfigurationAdd, academic_sessions_vocab,
    3838    IPasswordValidator)
    39 from waeup.sirp.permissions import (
    40     get_users_with_local_roles,
    41     getGlobalRolesForAccount, getLocalRolesForAccount)
     39from waeup.sirp.permissions import get_users_with_local_roles, getAllRoles
    4240from waeup.sirp.university.catalog import search
    4341from waeup.sirp.university.vocabularies import course_levels
     
    263261
    264262    def getLocalRoles(self, account):
    265         return getLocalRolesForAccount(self, account)
     263        local_roles = account.getLocalRoles()
     264        local_roles_string = ''
     265        site_url = self.url(grok.getSite())
     266        for local_role in local_roles.keys():
     267            role_title = dict(getAllRoles())[local_role].title
     268            objects_string = ''
     269            for object in local_roles[local_role]:
     270                objects_string += '<a href="%s">%s</a>, ' %(self.url(object),
     271                    self.url(object).replace(site_url,''))
     272            local_roles_string += '%s: <br />%s <br />' %(role_title,
     273                objects_string.rstrip(', '))
     274        return local_roles_string
    266275
    267276    def getGlobalRoles(self, account):
    268         return getGlobalRolesForAccount(account)
     277        global_roles = account.roles
     278        global_roles_string = ''
     279        for global_role in global_roles:
     280            role_title = dict(getAllRoles())[global_role].title
     281            global_roles_string += '%s <br />' % role_title
     282        return global_roles_string
    269283
    270284class AddUserFormPage(WAeUPAddFormPage):
Note: See TracChangeset for help on using the changeset viewer.