Ignore:
Timestamp:
21 May 2011, 17:04:59 (14 years ago)
Author:
Henrik Bettermann
Message:

Render human readable local role assignments including links to the corresponding objects.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
2 edited

Legend:

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

    r6181 r6183  
    3737    IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor,
    3838    ILocalRolesAssignable)
    39 from waeup.sirp.permissions import get_users_with_local_roles
     39from waeup.sirp.permissions import get_users_with_local_roles, getRoles
    4040from waeup.sirp.university.catalog import search
    4141from waeup.sirp.university.vocabularies import course_levels
     
    262262            self.flash('User %s successfully deleted.' % userid)
    263263
     264    def getLocalRoles(self,account):
     265        local_roles = account.getLocalRoles()
     266        local_roles_string = ''
     267        site_url = self.url(grok.getSite())
     268        for local_role in local_roles.keys():
     269            role_title = dict(getRoles())[local_role].title
     270            objects_string = ''
     271            for object in local_roles[local_role]:
     272                objects_string += '<a href="%s">%s</a>, ' %(self.url(object),
     273                    self.url(object).replace(site_url,''))
     274            local_roles_string += '%s: %s <br />' %(role_title,
     275                objects_string.rstrip(', '))
     276        return local_roles_string
     277
    264278class AddUserFormPage(WAeUPAddFormPage):
    265279    grok.require('waeup.manageUsers')
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/usercontainerpage.pt

    r6181 r6183  
    2020      <td tal:content="account/title">Title</td>
    2121      <td tal:content="account/description">Description</td>
    22       <td tal:content="account/getLocalRoles">Local Roles</td>
     22      <td tal:content="structure python:view.getLocalRoles(account)">Local Roles</td>
    2323      <td class="text-right">
    2424        <form method="post">
Note: See TracChangeset for help on using the changeset viewer.