mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Show checkboxes for users with permission to view the managed folder
This commit is contained in:
@@ -1285,6 +1285,15 @@ class ReturnedLettersForm(StripWhitespaceForm):
|
||||
|
||||
|
||||
class TemplateFolderForm(StripWhitespaceForm):
|
||||
def __init__(self, users_with_permission=None, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if users_with_permission is not None:
|
||||
self.viewing_permissions.users_with_permission = users_with_permission
|
||||
self.viewing_permissions.choices = [
|
||||
(item.id, item.name) for item in users_with_permission
|
||||
]
|
||||
|
||||
viewing_permissions = MultiCheckboxField('Users who can see this folder:')
|
||||
name = StringField('Folder name', validators=[DataRequired(message='Can’t be empty')])
|
||||
|
||||
|
||||
|
||||
@@ -430,9 +430,13 @@ def action_blocked(service_id, notification_type, return_to, template_id):
|
||||
@login_required
|
||||
@user_has_permissions('manage_templates')
|
||||
def manage_template_folder(service_id, template_folder_id):
|
||||
|
||||
current_folder = current_service.get_template_folder(template_folder_id)
|
||||
users_with_folder_permission = [
|
||||
current_service.get_team_member(user_id) for user_id in current_folder['users_with_permission']
|
||||
]
|
||||
form = TemplateFolderForm(
|
||||
name=current_service.get_template_folder(template_folder_id)['name']
|
||||
name=current_folder['name'],
|
||||
users_with_permission=users_with_folder_permission
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
@@ -449,7 +453,7 @@ def manage_template_folder(service_id, template_folder_id):
|
||||
template_folder_path=current_service.get_template_folder_path(template_folder_id),
|
||||
current_service_id=current_service.id,
|
||||
template_folder_id=template_folder_id,
|
||||
template_type="all"
|
||||
template_type="all",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox, checkbox_group %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
@@ -24,8 +25,9 @@
|
||||
{% call form_wrapper(action=url_for('main.manage_template_folder', service_id=current_service.id, template_folder_id=template_folder_id)) %}
|
||||
{{ textbox(form.name) }}
|
||||
{% if current_service.has_permission("edit_folder_permissions") %}
|
||||
<p id="users-with-permissions">Users who can see this folder:</p>
|
||||
{{ checkbox_group("Users who can see this folder:", form.viewing_permissions) }}
|
||||
{% endif %}
|
||||
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
delete_link=url_for(
|
||||
|
||||
Reference in New Issue
Block a user