mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-02 15:11:13 -04:00
Permissions added for templates and send_messages pages. All tests passing.
Fix up page heading.
This commit is contained in:
@@ -94,14 +94,14 @@ def validate_recipient(recipient, template_type):
|
||||
}[template_type](recipient)
|
||||
|
||||
|
||||
def user_has_permissions(*permissions):
|
||||
def user_has_permissions(*permissions, or_=False):
|
||||
def wrap(func):
|
||||
@wraps(func)
|
||||
def wrap_func(*args, **kwargs):
|
||||
# We are making the assumption that the user is logged in.
|
||||
from flask_login import current_user
|
||||
service_id = session.get('service_id', '')
|
||||
if current_user and current_user.has_permissions(service_id, permissions):
|
||||
if current_user and current_user.has_permissions(service_id, permissions, or_=or_):
|
||||
return func(*args, **kwargs)
|
||||
else:
|
||||
abort(403)
|
||||
|
||||
Reference in New Issue
Block a user