Log as error when project admin group isn't properly configured.

This commit is contained in:
Sybren A. Stüvel 2017-10-25 14:57:55 +02:00
parent e983d0756d
commit a4addbfd22

View File

@ -5,6 +5,8 @@ from flask import current_app
from werkzeug import exceptions as wz_exceptions
from werkzeug.exceptions import abort
from pillar.auth import current_user
log = logging.getLogger(__name__)
@ -58,6 +60,9 @@ def get_admin_group(project: dict) -> dict:
raise ValueError('Unable to handle project without admin group.')
if group['name'] != str(project['_id']):
log.error('User %s tries to get admin group for project %s, '
'but that does not have the project ID as group name: %s',
current_user.user_id, project.get('_id', '-unknown-'), group)
return abort_with_error(403)
return group