From a0173d1b012b801ba5a3f0cbe9f5d10ce32d064e Mon Sep 17 00:00:00 2001 From: Tiago Garcia Date: Tue, 17 Dec 2024 01:18:45 +0000 Subject: [PATCH] fix perms for role Signed-off-by: Tiago Garcia --- delivery2/server/services/roles.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/delivery2/server/services/roles.py b/delivery2/server/services/roles.py index 5457ede..e480a20 100644 --- a/delivery2/server/services/roles.py +++ b/delivery2/server/services/roles.py @@ -3,6 +3,8 @@ from flask import jsonify from database import db from models import Organization, User, File from sqlalchemy.orm.attributes import flag_modified + +from services import FileService, OrganizationService from utils import Perm, PermOperation @@ -99,7 +101,11 @@ class RoleService: @staticmethod def get_perms_for_role(org: Organization, role: str, return_str=False) -> list[Perm | str]: - return Perm.get_perms(org.roles[role]["permissions"], return_str) + perms_list = Perm.get_perms(org.roles[role]["permissions"], return_str) + for f in FileService.list_files_in_org(org): + perms_list.append({f.document_handle: Perm.get_perms(f.acl[role], return_str)}) + return perms_list + @staticmethod def get_roles_for_perm(org: Organization, perm: Perm) -> list: