From ef2cc44cebc62e3be9b8027302bec7859b2461b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 3 Jan 2018 11:12:17 +0100 Subject: [PATCH] Reduce log level when user lacks required roles/caps This prevents logging those at Sentry. --- pillar/api/utils/authorization.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pillar/api/utils/authorization.py b/pillar/api/utils/authorization.py index bdac5d5c..569020e1 100644 --- a/pillar/api/utils/authorization.py +++ b/pillar/api/utils/authorization.py @@ -345,13 +345,13 @@ def require_login(*, require_roles=set(), return render_error() if require_roles and not current_user.matches_roles(require_roles, require_all): - log.warning('User %s is authenticated, but does not have required roles %s to ' - 'access %s', current_user.user_id, require_roles, func) + log.info('User %s is authenticated, but does not have required roles %s to ' + 'access %s', current_user.user_id, require_roles, func) return render_error() if require_cap and not current_user.has_cap(require_cap): - log.warning('User %s is authenticated, but does not have required capability %s to ' - 'access %s', current_user.user_id, require_cap, func) + log.info('User %s is authenticated, but does not have required capability %s to ' + 'access %s', current_user.user_id, require_cap, func) return render_error() return func(*args, **kwargs)