Skip to content

Commit

Permalink
Don't write reduntant document template permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Oct 24, 2024
1 parent 7cf9f05 commit ad1a0a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/config_generator/document_service_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def permissions(self, role):
'document_templates': non_public_resources('document_templates', session)
}

is_public_role = (role == self.permissions_query.public_role())

# Collect available templates
available_document_templates = []
for root, dirs, files in os.walk(self.report_dir):
Expand Down Expand Up @@ -130,7 +132,10 @@ def permissions(self, role):
):
continue

permitted_templates.append(template)
if is_public_role:
permitted_templates.append(template)
elif template_restricted_for_public:
permitted_templates.append(template)

permissions['document_templates'] = permitted_templates

Expand Down

0 comments on commit ad1a0a8

Please sign in to comment.