Fix the super user default config. Slight style tweaks to the super user permission implementation.

This commit is contained in:
jakedt 2014-04-10 15:51:39 -04:00
parent 73f23f155c
commit 0fd5da172e
2 changed files with 6 additions and 5 deletions

View file

@ -22,7 +22,7 @@ _TeamTypeNeed = namedtuple('teamwideneed', ['type', 'orgname', 'teamname', 'role
_TeamNeed = partial(_TeamTypeNeed, 'orgteam')
_UserTypeNeed = namedtuple('userspecificneed', ['type', 'username', 'role'])
_UserNeed = partial(_UserTypeNeed, 'user')
_SuperUserNeed = partial(namedtuple('superuserneed', ['type']), '_superuser')
_SuperUserNeed = partial(namedtuple('superuserneed', ['type']), 'superuser')
REPO_ROLES = [None, 'read', 'write', 'admin']
@ -90,7 +90,8 @@ class QuayDeferredPermissionUser(Identity):
user_object = model.get_user(self.id)
# Add the superuser need, if applicable.
if user_object.username is not None and user_object.username in app.config.get('SUPER_USERS', []):
if (user_object.username is not None and
user_object.username in app.config.get('SUPER_USERS', [])):
self.provides.add(_SuperUserNeed())
# Add the user specific permissions, only for non-oauth permission

View file

@ -124,8 +124,8 @@ class DefaultConfig(object):
STATUS_TAGS[tag_name] = tag_svg.read()
# Super user config. Note: This MUST BE None for the default config.
SUPER_USERS = None
# Super user config. Note: This MUST BE an empty list for the default config.
SUPER_USERS = []
# Feature Flag: Whether billing is required.
FEATURE_BILLING = True
@ -137,7 +137,7 @@ class DefaultConfig(object):
FEATURE_GITHUB_LOGIN = True
# Feature flag, whether to enable olark chat
FEATURE_OLARK_CHAT = True
FEATURE_OLARK_CHAT = False
# Feature Flag: Whether super users are supported.
FEATURE_SUPER_USERS = False