Changeset 5909 for main/waeup.sirp


Ignore:
Timestamp:
1 Apr 2011, 14:21:41 (14 years ago)
Author:
uli
Message:

Extend docs and respect possibly set disabled attribute of
accesscodes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py

    r5907 r5909  
    187187class ApplicantsAuthenticatorPlugin(grok.GlobalUtility):
    188188    """Authenticate applicants.
    189 
    190     XXX: This plugin currently accepts any input and authenticates the
    191     user as applicant.
    192189    """
    193190    grok.provides(IAuthenticatorPlugin)
     
    195192
    196193    def authenticateCredentials(self, credentials):
     194        """Validate the given `credentials`
     195
     196        Credentials for applicants have to be passed as a regular
     197        dictionary with a key ``accesscode``. This access code is the
     198        password and username of an applicant.
     199
     200        Returns a :class:`ApplicantPrincipalInfo` in case of
     201        successful validation, ``None`` else.
     202
     203        Credentials are not valid if:
     204
     205        - The passed accesscode does not exist (i.e. was not generated
     206          by the :mod:`waeup.sirp.accesscode` module).
     207
     208        or
     209
     210        - the accesscode was disabled
     211
     212        or
     213       
     214        - the accesscode was already used and a dataset for this
     215          applicant was already generated with a different accesscode
     216          (currently impossible, as applicant datasets are indexed by
     217          accesscode)
     218
     219        or
     220
     221        - a dataset for the applicant already exists with an
     222          accesscode set and this accesscode does not match the given
     223          one.
     224         
     225        """
    197226        if not isinstance(credentials, dict):
    198227            return None
     
    204233        appl_ac = getattr(applicant_data, 'access_code', None)
    205234        if ac is None:
     235            return None
     236        if ac.disabled is not False:
    206237            return None
    207238        if ac.invalidation_date is not None and appl_ac != ac.representation:
Note: See TracChangeset for help on using the changeset viewer.