Changeset 7:279473355e9b in OKFNAnnotator (for Zope)


Ignore:
Timestamp:
Nov 9, 2012, 5:05:11 PM (12 years ago)
Author:
root@…
Branch:
default
Message:

authentication works with hierarchy of acl_users now.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • AuthTokenGenerator.py

    r6 r7  
    44from AccessControl import getSecurityManager
    55from zExceptions import Unauthorized
     6from Acquisition import aq_chain
    67
    78import logging
     
    7879            self.REQUEST.RESPONSE.setStatus('Unauthorized')
    7980            return "Please Authenticate!"
    80        
    8181
    8282    def _user_allowed(self, user=None, password=None):
     
    9696        if password:
    9797            logging.debug("trying password")
    98             # TODO: should we care about aquisition?
    99             authuser = self.acl_users.authenticate(user, password, None)
    100             return authuser
     98            # try all user folders in aq_chain
     99            authuser = None
     100            userfolder = None
     101            for ctx in aq_chain(self):
     102                new_uf = getattr(ctx, 'acl_users', None)
     103                if new_uf != userfolder:
     104                    userfolder = new_uf
     105                    authuser = userfolder.authenticate(user, password, None)
     106                    if authuser is not None:
     107                        return authuser
    101108           
    102109        return None
  • version.txt

    r6 r7  
    1 0.5
     10.6
Note: See TracChangeset for help on using the changeset viewer.