feat: more ids returned on endpoints
All checks were successful
ci / lint_and_test (push) Successful in 14s
All checks were successful
ci / lint_and_test (push) Successful in 14s
Issue: #23
This commit is contained in:
parent
5a433dfe41
commit
294baadcb7
7 changed files with 90 additions and 19 deletions
|
|
@ -21,6 +21,7 @@ from sqlalchemy.exc import IntegrityError
|
|||
|
||||
from src.iam.exceptions import GroupNotFoundException
|
||||
from src.organisation.exceptions import OrgNotFoundException
|
||||
from src.schemas import GroupSummary, OrgSummary
|
||||
from src.service.exceptions import ServiceNotFoundException
|
||||
from src.exceptions import ConflictException
|
||||
from src.database import db_dependency
|
||||
|
|
@ -127,7 +128,11 @@ async def get_group_permissions(
|
|||
):
|
||||
if group_model.org_id != org_model.id:
|
||||
raise UnauthorizedException("Group does not belong to this organization")
|
||||
return {"permissions": group_model.permission_rel}
|
||||
return {
|
||||
"organisation": org_model,
|
||||
"group": group_model,
|
||||
"permissions": group_model.permission_rel,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/group/users", response_model=IAMGetGroupUsersResponse)
|
||||
|
|
@ -137,7 +142,11 @@ async def get_group_users(
|
|||
):
|
||||
if group_model.org_id != org_model.id:
|
||||
raise UnauthorizedException("Group does not belong to this organization")
|
||||
return {"users": group_model.user_rel}
|
||||
return {
|
||||
"organisation": org_model,
|
||||
"group": group_model,
|
||||
"users": group_model.user_rel,
|
||||
}
|
||||
|
||||
|
||||
@router.post("/group", response_model=IAMPostGroupResponse)
|
||||
|
|
@ -180,7 +189,8 @@ async def add_group_permission(
|
|||
|
||||
db.flush()
|
||||
response = IAMPutGroupPermissionResponse(
|
||||
group=GroupSchema(**group_model.__dict__),
|
||||
organisation=OrgSummary(**org_model.__dict__),
|
||||
group=GroupSummary(**group_model.__dict__),
|
||||
permissions=group_model.permission_rel,
|
||||
)
|
||||
db.commit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue