mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-04 08:01:34 -04:00
A platform admin user is able to see a list of all services.
Each service on the list is linked to the dashboard page of the service. The platform admin user can see/edit templates, see/invite users, see/edit service settings. The platform admin user can not send messages, see/edit api keys and developer docs.
This commit is contained in:
@@ -30,12 +30,14 @@ class BrowsableItem(object):
|
||||
pass
|
||||
|
||||
|
||||
def user_has_permissions(*permissions, or_=False):
|
||||
def user_has_permissions(*permissions, admin_override=False, or_=False):
|
||||
def wrap(func):
|
||||
@wraps(func)
|
||||
def wrap_func(*args, **kwargs):
|
||||
from flask_login import current_user
|
||||
if current_user and current_user.has_permissions(permissions, or_=or_):
|
||||
if current_user and admin_override and current_user.platform_admin:
|
||||
return func(*args, **kwargs)
|
||||
if current_user and current_user.has_permissions(permissions, admin_override=admin_override, or_=or_):
|
||||
return func(*args, **kwargs)
|
||||
else:
|
||||
abort(403)
|
||||
|
||||
Reference in New Issue
Block a user