mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Add a temporary check for service folder permission
Since we're calling `User.has_template_folder_permission` directly in a few places (notably the `folder_path` template macro), we need to check that the service has the feature flag enabled first. This is usually done by the caller, but template macro doesn't have access to `current_service`. To avoid passing it in each time the macro is called we're adding a temporary check inside the method itself. This commit can be reverted completely when we remove the service feature flag.
This commit is contained in:
@@ -151,7 +151,15 @@ class User(UserMixin):
|
||||
def has_permission_for_service(self, service_id, permission):
|
||||
return permission in self._permissions.get(service_id, [])
|
||||
|
||||
def has_template_folder_permission(self, template_folder):
|
||||
def has_template_folder_permission(self, template_folder, service=None):
|
||||
from app import current_service
|
||||
|
||||
if service is None:
|
||||
service = current_service
|
||||
|
||||
if not service.has_permission('edit_folder_permissions'):
|
||||
return True
|
||||
|
||||
if self.platform_admin:
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user