feat: default iam group on org join
All checks were successful
ci / lint_and_test (push) Successful in 15s
All checks were successful
ci / lint_and_test (push) Successful in 15s
Users joining an org are given the `Default User` IAM permission group automatically.
This commit is contained in:
parent
09d2fbafdc
commit
3433ba39ee
2 changed files with 3 additions and 0 deletions
|
|
@ -352,6 +352,7 @@ async def add_user_to_org(
|
||||||
raise ConflictException(message="User already a part of this organisation")
|
raise ConflictException(message="User already a part of this organisation")
|
||||||
org_model.user_rel.append(user_model)
|
org_model.user_rel.append(user_model)
|
||||||
db.flush()
|
db.flush()
|
||||||
|
await assign_default_user_group(db=db, org_model=org_model, user_model=user_model)
|
||||||
response = {
|
response = {
|
||||||
"organisation": org_model,
|
"organisation": org_model,
|
||||||
"users": [{"id": user.id, "email": user.email} for user in org_model.user_rel],
|
"users": [{"id": user.id, "email": user.email} for user in org_model.user_rel],
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ Endpoints:
|
||||||
|
|
||||||
from fastapi import APIRouter, status, BackgroundTasks
|
from fastapi import APIRouter, status, BackgroundTasks
|
||||||
|
|
||||||
|
from src.iam.service import assign_default_user_group
|
||||||
from src.organisation.exceptions import OrgNotFoundException
|
from src.organisation.exceptions import OrgNotFoundException
|
||||||
from src.user.schemas import (
|
from src.user.schemas import (
|
||||||
UserResponse,
|
UserResponse,
|
||||||
|
|
@ -199,6 +200,7 @@ async def accept_invitation(
|
||||||
|
|
||||||
org_model.user_rel.append(user_model)
|
org_model.user_rel.append(user_model)
|
||||||
db.flush()
|
db.flush()
|
||||||
|
await assign_default_user_group(db=db, org_model=org_model, user_model=user_model)
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
"organisation": org_model,
|
"organisation": org_model,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue