mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Refactor gov user check into a decorator
We quite often use it in the same way as `@user_has_permissions`.
This commit is contained in:
@@ -62,6 +62,15 @@ def user_has_permissions(*permissions, **permission_kwargs):
|
||||
return wrap
|
||||
|
||||
|
||||
def user_is_gov_user(f):
|
||||
@wraps(f)
|
||||
def wrapped(*args, **kwargs):
|
||||
if not current_user.is_gov_user:
|
||||
abort(403)
|
||||
return f(*args, **kwargs)
|
||||
return wrapped
|
||||
|
||||
|
||||
def user_is_platform_admin(f):
|
||||
@wraps(f)
|
||||
def wrapped(*args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user