Commit 85ca6c6c authored by Pierre-Yves Chibon's avatar Pierre-Yves Chibon

Add global site admins having access to everything

parent c03453ea
......@@ -107,7 +107,6 @@ if APP.config.get('PAGURE_AUTH', None) in ['fas', 'openid']:
def set_user(return_url):
''' After login method. '''
try:
pagure.lib.set_up_user(
session=SESSION,
username=flask.g.fas_user.username,
......@@ -223,6 +222,12 @@ def is_admin():
if not user.cla_done or len(user.groups) < 1:
return False
admin_users = APP.config.get('PAGURE_ADMIN_USERS', [])
if not isinstance(admin_users, list):
admin_users = [admin_users]
if user.username in admin_users:
return True
admins = APP.config['ADMIN_GROUP']
if isinstance(admins, basestring):
admins = [admins]
......@@ -239,6 +244,12 @@ def is_repo_admin(repo_obj):
user = flask.g.fas_user.username
admin_users = APP.config.get('PAGURE_ADMIN_USERS', [])
if not isinstance(admin_users, list):
admin_users = [admin_users]
if user in admin_users:
return True
usergrps = [
usr.user
for grp in repo_obj.groups
......
......@@ -28,6 +28,9 @@ DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite'
# The FAS group in which the admin of pagure are
ADMIN_GROUP = 'sysadmin-main'
# Hard-code a list of users that are global admins
PAGURE_ADMIN_USERS = []
# Whether or not to send emails
EMAIL_SEND = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment