mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
notify-admin-571 add platform_admin condition for create service and create user
This commit is contained in:
@@ -6,7 +6,7 @@ from app import service_api_client
|
||||
from app.formatters import email_safe
|
||||
from app.main import main
|
||||
from app.main.forms import CreateServiceForm
|
||||
from app.utils.user import user_is_gov_user, user_is_logged_in
|
||||
from app.utils.user import user_is_gov_user, user_is_platform_admin
|
||||
|
||||
|
||||
def _create_service(service_name, organization_type, email_from, form):
|
||||
@@ -41,8 +41,8 @@ def _create_example_template(service_id):
|
||||
|
||||
|
||||
@main.route("/add-service", methods=["GET", "POST"])
|
||||
@user_is_logged_in
|
||||
@user_is_gov_user
|
||||
@user_is_platform_admin
|
||||
def add_service():
|
||||
default_organization_type = current_user.default_organization_type
|
||||
if default_organization_type is None:
|
||||
|
||||
@@ -21,7 +21,7 @@ from app.main.forms import (
|
||||
SearchUsersForm,
|
||||
)
|
||||
from app.models.user import InvitedUser, User
|
||||
from app.utils.user import is_gov_user, user_has_permissions
|
||||
from app.utils.user import is_gov_user, user_has_permissions, user_is_platform_admin
|
||||
from app.utils.user_permissions import permission_options
|
||||
|
||||
|
||||
@@ -42,10 +42,9 @@ def manage_users(service_id):
|
||||
@main.route(
|
||||
"/services/<uuid:service_id>/users/invite/<uuid:user_id>", methods=["GET", "POST"]
|
||||
)
|
||||
@user_has_permissions("manage_service")
|
||||
@user_is_platform_admin
|
||||
def invite_user(service_id, user_id=None):
|
||||
form_class = InviteUserForm
|
||||
|
||||
form = form_class(
|
||||
inviter_email_address=current_user.email_address,
|
||||
all_template_folders=current_service.all_template_folders,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from datetime import datetime
|
||||
|
||||
from notifications_utils.clients.redis import daily_total_cache_key
|
||||
|
||||
from app.extensions import redis_client
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||
|
||||
# from notifications_utils.clients.redis import daily_total_cache_key
|
||||
|
||||
|
||||
class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
@cache.delete("user-{user_id}")
|
||||
@@ -499,8 +499,8 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
|
||||
def get_global_notification_count(self):
|
||||
# if cache is not set, or not enabled, return 0
|
||||
count = redis_client.get(daily_total_cache_key()) or 0
|
||||
|
||||
# count = redis_client.get(daily_total_cache_key()) or 0
|
||||
count = 0
|
||||
return int(count)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user