Logo Search packages:      
Sourcecode: zope-exuserfolder version File versions

def zope-exuserfolder-0.50.0::exUserFolder::exUserFolder::validate (   self,
  request,
  auth = '',
  roles = _noroles 
)

Perform identification, authentication, and authorization.

Definition at line 853 of file exUserFolder.py.

00853                                                           :
            """
            Perform identification, authentication, and authorization.
            """

            v = request['PUBLISHED']
            a, c, n, v = self._getobcontext(v, request)

            name, password = self.identify(auth)
            zLOG.LOG('exUserFolder', zLOG.DEBUG, 'identify returned %s, %s' % (name, password))

            response = request.RESPONSE
            if name is not None:
                  try:
                        xcached_user = self.xcache_getUser(name)
                        if xcached_user:
                              return None
                  except:
                        zLOG.LOG('exUserFolder', zLOG.ERROR,
                                     "error while looking up '%s' on the xcache" % name,
                                     '',
                                     sys.exc_info())

                  user = self.authenticate(name, password, request)
                  if user is None:
                        # If it's none, because there's no user by that name,
                        # don't raise a login, allow it to go higher...
                        # This kinda breaks for people putting in the wrong username
                        # when the Folder above uses a different auth method.
                        # But it doesn't lock Manager users out inside Zope.
                        # Perhaps this should be a tunable.
                        if self.listOneUser(name):
                              self.challenge(request, response, 'login_failed', auth)
                        return None
                  self.remember(name, password, request)
                  self.cache_addToCache(name, password, user)
                  emergency = self._emergency_user
                  if emergency and user is emergency:
                        if self._isTop():
                              return emergency.__of__(self)
                        else:
                              return None
                  if self.authorize(user, a, c, n, v, roles):
                        return user.__of__(self)
                  if self._isTop() and self.authorize(self._nobody, a, c, n, v, roles):
                        return self._nobody.__of__(self)
                  self.challenge(request, response, 'unauthorized')
                  return None
            else:
                  if self.sessionTracking and self.currentPropSource:
                        user = self.createAnonymousUser(request, response)
                        if self.authorize(user, a, c, n, v, roles):
                              return user.__of__(self)
                  if self.authorize(self._nobody, a, c, n, v, roles):
                        if self._isTop():
                              return self._nobody.__of__(self)
                        else:
                              return None
                  else:
                        self.challenge(request, response, None, auth)
                        return None
      
      def authenticate(self, name, password, request):


Generated by  Doxygen 1.6.0   Back to index