Changeset 5441
- Timestamp:
- 16 Aug 2010, 09:40:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/jambtables/authentication.py
r5440 r5441 47 47 class ApplicantAccount(Account): 48 48 """An account for applicants. 49 50 XXX: Very likely we do not need this at all. 49 51 """ 50 52 def __init__(self, reg_no, ac): … … 75 77 76 78 class ApplicantPrincipalInfo(object): 79 """Infos about an applicant principal. 80 """ 77 81 grok.implements(IApplicantPrincipalInfo) 78 82 79 83 # def __init__(self, id, title, description): 80 def __init__(self, reg_no, access_code): 81 self.id = '%s-%s' % (reg_no, access_code) 84 # def __init__(self, reg_no, access_code): 85 def __init__(self, access_code, jamb_reg_no=None): 86 self.id = princial_id(access_code, jamb_reg_no) 82 87 self.title = u'Applicant' 83 88 self.description = u'An Applicant' 84 89 self.credentialsPlugin = None 85 90 self.authenticatorPlugin = None 86 self.reg_no = reg_no91 self.reg_no = jamb_reg_no 87 92 self.access_code = access_code 88 93 89 94 class ApplicantPrincipal(Principal): 95 """An applicant principal. 96 97 Applicant principals provide an extra `access_code` and `reg_no` 98 attribute extending ordinary principals. 99 """ 90 100 91 101 grok.implements(IApplicantPrincipal) … … 104 114 class AuthenticatedApplicantPrincipalFactory(grok.MultiAdapter): 105 115 """Creates 'authenticated' applicant principals. 116 117 Adapts (principal info, request) to an ApplicantPrincipal instance. 118 119 This adapter is used by the standard PAU to transform 120 PrincipalInfos into Principal instances. 106 121 """ 107 122 grok.adapts(IApplicantPrincipalInfo, IRequest) … … 173 188 sessionData = session.get( 174 189 'zope.pluggableauth.browserplugins') 175 access_code = request.get(self.acc cesscode_field, None)190 access_code = request.get(self.accesscode_field, None) 176 191 jamb_reg_no = request.get(self.jamb_reg_no_field, None) 177 192 credentials = None … … 211 226 if not isinstance(credentials, dict): 212 227 return None 213 if not ' login' in credentials.keys():214 return None 215 if not ' password' in credentials.keys():216 returnNone228 if not 'accesscode' in credentials.keys(): 229 return None 230 if not 'jambregno' in credentials.keys(): 231 credentials['jambregno'] = None 217 232 return ApplicantPrincipalInfo( 218 credentials['login'], credentials['password'] 233 credentials['accesscode'], credentials['jambregno'] 234 # credentials['login'], credentials['password'] 219 235 ) 220 236 … … 222 238 """Returns an IPrincipalInfo object for the specified principal id. 223 239 224 Currently we always return ``None``, indicating, that the principal 225 could not be found. 240 This method is used by the stadard PAU to lookup for instance 241 groups. If a principal belongs to a group, the group is looked 242 up by the id. Currently we always return ``None``, 243 indicating, that the principal could not be found. This also 244 means, that is has no effect if applicant users belong to a 245 certain group. They can not gain extra-permissions this way. 226 246 """ 227 247 return None
Note: See TracChangeset for help on using the changeset viewer.