mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-10 07:03:12 -05:00
Hide template folder permission editing for platform admin users
Platform admin users can access all template folders, so the folder permissions form always displays everything as checked for them, which makes it look like the form isn't actually working. We could do the check based on folder data, but the field still wouldn't have any effect on permissions. So instead, we hide it completely for platform admin users. Submitting the form will remove any folder permissions from the DB for the platform admin user (which can still be created by changing permissions on the template folder 'Manage' page), but that's only relevant if a user stops being a platform admin but keeps their Notify services.
This commit is contained in:
committed by
Chris Hill-Scott
parent
293a7c544f
commit
5dbd229781
@@ -103,11 +103,11 @@ def edit_user_permissions(service_id, user_id):
|
||||
form = PermissionsForm.from_user(
|
||||
user,
|
||||
service_id,
|
||||
folder_permissions=[
|
||||
folder_permissions=None if user.platform_admin else [
|
||||
f['id'] for f in current_service.all_template_folders
|
||||
if user.has_template_folder_permission(f)
|
||||
],
|
||||
all_template_folders=current_service.all_template_folders
|
||||
all_template_folders=None if user.platform_admin else current_service.all_template_folders
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
Reference in New Issue
Block a user