##// END OF EJS Templates
more work on improving info logging
marcink -
r2025:7e979933 beta
parent child Browse files
Show More
@@ -89,4 +89,4 b' BACKENDS = {'
89 CELERY_ON = False
89 CELERY_ON = False
90
90
91 # link to config for pylons
91 # link to config for pylons
92 CONFIG = None
92 CONFIG = {}
@@ -173,7 +173,7 b' def authenticate(username, password):'
173 if user is not None and not user.ldap_dn:
173 if user is not None and not user.ldap_dn:
174 if user.active:
174 if user.active:
175 if user.username == 'default' and user.active:
175 if user.username == 'default' and user.active:
176 log.info('user %s authenticated correctly as anonymous user',
176 log.info('user %s authenticated correctly as anonymous user' %
177 username)
177 username)
178 return True
178 return True
179
179
@@ -182,7 +182,7 b' def authenticate(username, password):'
182 log.info('user %s authenticated correctly' % username)
182 log.info('user %s authenticated correctly' % username)
183 return True
183 return True
184 else:
184 else:
185 log.warning('user %s is disabled' % username)
185 log.warning('user %s tried auth but is disabled' % username)
186
186
187 else:
187 else:
188 log.debug('Regular authentication failed')
188 log.debug('Regular authentication failed')
@@ -434,13 +434,17 b' class LoginRequired(object):'
434 api_access_ok = True
434 api_access_ok = True
435 else:
435 else:
436 log.debug("API KEY token not valid")
436 log.debug("API KEY token not valid")
437
437 loc = "%s:%s" % (cls.__class__.__name__, func.__name__)
438 log.debug('Checking if %s is authenticated @ %s' % (user.username, cls))
438 log.debug('Checking if %s is authenticated @ %s' % (user.username, loc))
439 if user.is_authenticated or api_access_ok:
439 if user.is_authenticated or api_access_ok:
440 log.debug('user %s is authenticated' % user.username)
440 log.info('user %s is authenticated and granted access to %s' % (
441 user.username, loc)
442 )
441 return func(*fargs, **fkwargs)
443 return func(*fargs, **fkwargs)
442 else:
444 else:
443 log.warn('user %s NOT authenticated' % user.username)
445 log.warn('user %s NOT authenticated on func: %s' % (
446 user, loc)
447 )
444 p = url.current()
448 p = url.current()
445
449
446 log.debug('redirecting to login page with %s' % p)
450 log.debug('redirecting to login page with %s' % p)
@@ -502,7 +506,7 b' class PermsDecorator(object):'
502 return func(*fargs, **fkwargs)
506 return func(*fargs, **fkwargs)
503
507
504 else:
508 else:
505 log.warning('Permission denied for %s %s' % (cls, self.user))
509 log.debug('Permission denied for %s %s' % (cls, self.user))
506 anonymous = self.user.username == 'default'
510 anonymous = self.user.username == 'default'
507
511
508 if anonymous:
512 if anonymous:
@@ -649,7 +653,7 b' class PermsFunction(object):'
649 return True
653 return True
650
654
651 else:
655 else:
652 log.warning('Permission denied for %s @ %s', self.granted_for,
656 log.debug('Permission denied for %s @ %s', self.granted_for,
653 check_Location or 'unspecified location')
657 check_Location or 'unspecified location')
654 return False
658 return False
655
659
@@ -147,9 +147,12 b' class BaseController(WSGIController):'
147
147
148 session['rhodecode_user'] = self.rhodecode_user.get_cookie_store()
148 session['rhodecode_user'] = self.rhodecode_user.get_cookie_store()
149 session.save()
149 session.save()
150 log.info('User: %s accessed %s' % (auth_user,
151 environ.get('PATH_INFO')))
150 return WSGIController.__call__(self, environ, start_response)
152 return WSGIController.__call__(self, environ, start_response)
151 finally:
153 finally:
152 log.debug('Request time: %.3fs' % (time.time() - start))
154 log.info('Request to %s time: %.3fs' % (environ.get('PATH_INFO'),
155 time.time() - start))
153 meta.Session.remove()
156 meta.Session.remove()
154
157
155
158
@@ -256,7 +256,7 b' class ValidAuth(formencode.validators.Fa'
256 error_dict=self.e_dict_disable
256 error_dict=self.e_dict_disable
257 )
257 )
258 else:
258 else:
259 log.warning('user %s not authenticated' % username)
259 log.warning('user %s failed to authenticate' % username)
260 raise formencode.Invalid(
260 raise formencode.Invalid(
261 self.message('invalid_password',
261 self.message('invalid_password',
262 state=State_obj), value, state,
262 state=State_obj), value, state,
General Comments 0
You need to be logged in to leave comments. Login now