Ignore:
Timestamp:
30 Nov 2011, 23:13:26 (13 years ago)
Author:
Henrik Bettermann
Message:

Rebuild applicants package (1st part). Applicants now have an applicant_id and a password and can use the regular login page to enter the portal.

Add user_type attribute to SIRPPrincipal objects.

Add some permissions in students package.

Some tests are still missing and will be re-added soon.

File:
1 edited

Legend:

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

    r7195 r7240  
    3232from waeup.sirp.browser.theming import get_all_themes, WAeUPThemeGray1
    3333from waeup.sirp.students.interfaces import IStudentNavigation
     34from waeup.sirp.applicants.interfaces import IApplicant
    3435from waeup.sirp.authentication import get_principal_role_manager
    3536
     
    163164        if usertitle == 'Unauthenticated User':
    164165            return u'Anonymous User'
    165         elif usertitle == 'Applicant':
    166             return self.request.principal.id
    167166        return usertitle
    168167
     
    172171        userid = self.request.principal.id
    173172        return userid
     173
     174    def isStudent(self):
     175        usertype = getattr(self.request.principal, 'user_type', None)
     176        if not usertype:
     177            return False
     178        return self.request.principal.user_type == 'student'
     179
     180    def isApplicant(self):
     181        usertype = getattr(self.request.principal, 'user_type', None)
     182        if not usertype:
     183            return False
     184        return self.request.principal.user_type == 'applicant'
    174185
    175186    def getStudentName(self):
     
    180191        return
    181192
    182     def isStudent(self):
    183         prm = get_principal_role_manager()
    184         roles = [x[0] for x in
    185             prm.getRolesForPrincipal(self.request.principal.id)]
    186         return 'waeup.Student' in roles
     193    def getApplicantName(self):
     194        """Return the applicant name.
     195        """
     196        if IApplicant.providedBy(self.context):
     197            return self.context.fullname
     198        return
    187199
    188200    def update(self):
     
    209221
    210222    def render(self):
    211         if self.isStudent() or not self.isAuthenticated():
     223        if self.isStudent() or self.isApplicant() or not self.isAuthenticated():
    212224            return self.studenttemp.render(self)
    213225        return self.stafftemp.render(self)
Note: See TracChangeset for help on using the changeset viewer.