forked from sr2/cloud-api
feat: user and org defaults
Root and User defaults made more generic and merged. Root user group assignment merged with org default perm assignment. Root user granted all default org permissions at org creation.
This commit is contained in:
parent
2c5edd1b0f
commit
d5854cc2c4
4 changed files with 104 additions and 57 deletions
|
|
@ -10,7 +10,7 @@ Endpoints:
|
|||
|
||||
from fastapi import APIRouter, status, BackgroundTasks
|
||||
|
||||
from src.iam.service import assign_default_user_group
|
||||
from src.iam.models import Group
|
||||
from src.organisation.exceptions import OrgNotFoundException
|
||||
from src.user.schemas import (
|
||||
UserResponse,
|
||||
|
|
@ -200,7 +200,14 @@ async def accept_invitation(
|
|||
|
||||
org_model.user_rel.append(user_model)
|
||||
db.flush()
|
||||
await assign_default_user_group(db=db, org_model=org_model, user_model=user_model)
|
||||
group_model = (
|
||||
db.query(Group)
|
||||
.filter(Group.org_id == org_model.id)
|
||||
.filter(Group.name == "Default Users")
|
||||
.first()
|
||||
)
|
||||
if group_model is not None:
|
||||
user_model.group_rel.append(group_model)
|
||||
|
||||
response = {
|
||||
"organisation": org_model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue