diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py --- a/rhodecode/__init__.py +++ b/rhodecode/__init__.py @@ -89,4 +89,4 @@ BACKENDS = { CELERY_ON = False # link to config for pylons -CONFIG = None +CONFIG = {} diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -173,7 +173,7 @@ def authenticate(username, password): if user is not None and not user.ldap_dn: if user.active: if user.username == 'default' and user.active: - log.info('user %s authenticated correctly as anonymous user', + log.info('user %s authenticated correctly as anonymous user' % username) return True @@ -182,7 +182,7 @@ def authenticate(username, password): log.info('user %s authenticated correctly' % username) return True else: - log.warning('user %s is disabled' % username) + log.warning('user %s tried auth but is disabled' % username) else: log.debug('Regular authentication failed') @@ -434,13 +434,17 @@ class LoginRequired(object): api_access_ok = True else: log.debug("API KEY token not valid") - - log.debug('Checking if %s is authenticated @ %s' % (user.username, cls)) + loc = "%s:%s" % (cls.__class__.__name__, func.__name__) + log.debug('Checking if %s is authenticated @ %s' % (user.username, loc)) if user.is_authenticated or api_access_ok: - log.debug('user %s is authenticated' % user.username) + log.info('user %s is authenticated and granted access to %s' % ( + user.username, loc) + ) return func(*fargs, **fkwargs) else: - log.warn('user %s NOT authenticated' % user.username) + log.warn('user %s NOT authenticated on func: %s' % ( + user, loc) + ) p = url.current() log.debug('redirecting to login page with %s' % p) @@ -502,7 +506,7 @@ class PermsDecorator(object): return func(*fargs, **fkwargs) else: - log.warning('Permission denied for %s %s' % (cls, self.user)) + log.debug('Permission denied for %s %s' % (cls, self.user)) anonymous = self.user.username == 'default' if anonymous: @@ -649,7 +653,7 @@ class PermsFunction(object): return True else: - log.warning('Permission denied for %s @ %s', self.granted_for, + log.debug('Permission denied for %s @ %s', self.granted_for, check_Location or 'unspecified location') return False diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -147,9 +147,12 @@ class BaseController(WSGIController): session['rhodecode_user'] = self.rhodecode_user.get_cookie_store() session.save() + log.info('User: %s accessed %s' % (auth_user, + environ.get('PATH_INFO'))) return WSGIController.__call__(self, environ, start_response) finally: - log.debug('Request time: %.3fs' % (time.time() - start)) + log.info('Request to %s time: %.3fs' % (environ.get('PATH_INFO'), + time.time() - start)) meta.Session.remove() diff --git a/rhodecode/lib/vcs/utils/__init__.py b/rhodecode/lib/vcs/utils/__init__.py --- a/rhodecode/lib/vcs/utils/__init__.py +++ b/rhodecode/lib/vcs/utils/__init__.py @@ -42,7 +42,7 @@ def safe_unicode(str_, from_encoding=Non return str_ if not from_encoding: import rhodecode - DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding', 'utf8') from_encoding = DEFAULT_ENCODING try: return unicode(str_) @@ -80,7 +80,7 @@ def safe_str(unicode_, to_encoding=None) return unicode_ if not to_encoding: import rhodecode - DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding','utf8') + DEFAULT_ENCODING = rhodecode.CONFIG.get('default_encoding', 'utf8') to_encoding = DEFAULT_ENCODING try: return unicode_.encode(to_encoding) diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -256,7 +256,7 @@ class ValidAuth(formencode.validators.Fa error_dict=self.e_dict_disable ) else: - log.warning('user %s not authenticated' % username) + log.warning('user %s failed to authenticate' % username) raise formencode.Invalid( self.message('invalid_password', state=State_obj), value, state,