mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 17:38:02 -04:00
Include list of users_with_permission in all folders response
This adds a list of user_ids of the users who have permission to view a folder to the `get_template_folders_for_service` endpoint.
This commit is contained in:
@@ -754,7 +754,8 @@ class TemplateFolder(db.Model):
|
||||
'id': self.id,
|
||||
'name': self.name,
|
||||
'parent_id': self.parent_id,
|
||||
'service_id': self.service_id
|
||||
'service_id': self.service_id,
|
||||
'users_with_permission': self.get_users_with_permission()
|
||||
}
|
||||
|
||||
def is_parent_of(self, other):
|
||||
@@ -764,6 +765,12 @@ class TemplateFolder(db.Model):
|
||||
other = other.parent
|
||||
return False
|
||||
|
||||
def get_users_with_permission(self):
|
||||
service_users = self.users
|
||||
users_with_permission = [str(service_user.user_id) for service_user in service_users]
|
||||
|
||||
return users_with_permission
|
||||
|
||||
|
||||
template_folder_map = db.Table(
|
||||
'template_folder_map',
|
||||
|
||||
Reference in New Issue
Block a user