fix perms for role
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
parent
495a9ab4ea
commit
a0173d1b01
|
@ -3,6 +3,8 @@ from flask import jsonify
|
||||||
from database import db
|
from database import db
|
||||||
from models import Organization, User, File
|
from models import Organization, User, File
|
||||||
from sqlalchemy.orm.attributes import flag_modified
|
from sqlalchemy.orm.attributes import flag_modified
|
||||||
|
|
||||||
|
from services import FileService, OrganizationService
|
||||||
from utils import Perm, PermOperation
|
from utils import Perm, PermOperation
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +101,11 @@ class RoleService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_perms_for_role(org: Organization, role: str, return_str=False) -> list[Perm | str]:
|
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
|
@staticmethod
|
||||||
def get_roles_for_perm(org: Organization, perm: Perm) -> list:
|
def get_roles_for_perm(org: Organization, perm: Perm) -> list:
|
||||||
|
|
Loading…
Reference in New Issue