web/application.py
changeset 5590 a56eb02f9ce7
parent 5508 6718ba5db0eb
parent 5587 72679e450f6d
child 5591 c6edefa9b3f1
equal deleted inserted replaced
5578:6b9fee0c5c42 5590:a56eb02f9ce7
   231         if not session.anonymous_session:
   231         if not session.anonymous_session:
   232             self._postlogin(req)
   232             self._postlogin(req)
   233         return session
   233         return session
   234 
   234 
   235     def _update_last_login_time(self, req):
   235     def _update_last_login_time(self, req):
       
   236         # XXX should properly detect missing permission / non writeable source
       
   237         # and avoid "except (RepositoryError, Unauthorized)" below
       
   238         if req.user.metainformation()['source']['adapter'] == 'ldapuser':
       
   239             return
   236         try:
   240         try:
   237             req.execute('SET X last_login_time NOW WHERE X eid %(x)s',
   241             req.execute('SET X last_login_time NOW WHERE X eid %(x)s',
   238                         {'x' : req.user.eid})
   242                         {'x' : req.user.eid})
   239             req.cnx.commit()
   243             req.cnx.commit()
   240         except (RepositoryError, Unauthorized):
   244         except (RepositoryError, Unauthorized):
   241             # ldap user are not writeable for instance
       
   242             req.cnx.rollback()
   245             req.cnx.rollback()
   243         except:
   246         except:
   244             req.cnx.rollback()
   247             req.cnx.rollback()
   245             raise
   248             raise
   246 
   249 
   377                 ctrlid, rset = self.url_resolver.process(req, path)
   380                 ctrlid, rset = self.url_resolver.process(req, path)
   378                 try:
   381                 try:
   379                     controller = self.vreg['controllers'].select(ctrlid, req,
   382                     controller = self.vreg['controllers'].select(ctrlid, req,
   380                                                                  appli=self)
   383                                                                  appli=self)
   381                 except NoSelectableObject:
   384                 except NoSelectableObject:
       
   385                     if ctrlid == 'login':
       
   386                         raise Unauthorized(req._('log out first'))
   382                     raise Unauthorized(req._('not authorized'))
   387                     raise Unauthorized(req._('not authorized'))
   383                 req.update_search_state()
   388                 req.update_search_state()
   384                 result = controller.publish(rset=rset)
   389                 result = controller.publish(rset=rset)
   385                 if req.cnx:
   390                 if req.cnx:
   386                     # no req.cnx if anonymous aren't allowed and we are
   391                     # no req.cnx if anonymous aren't allowed and we are