feat: distinguish managed platform users (#14207)

* feat: add isPlatformManaged property to user

* do not allow deleting non managed users

* refactor: rename managed user create and update inputs

* refactor response code

* feat: add isPlatformManaged when creating managed user

* fix TS
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2024-03-25 18:48:51 +01:00
1 parent bec1453148
commit ef498c6ed6
12 files changed
+52 -27

No files matched your search

@@ -224,12 +224,14 @@ export async function createNewUsersConnectToOrgIfExists({
parentId,
autoAcceptEmailDomain,
connectionInfoMap,
isPlatformManaged,
}: {
usernamesOrEmails: string[];
input: InviteMemberOptions["input"];
parentId?: number | null;
autoAcceptEmailDomain?: string;
connectionInfoMap: Record<string, ReturnType<typeof getOrgConnectionInfo>>;
isPlatformManaged?: boolean;
}) {
// fail if we have invalid emails
usernamesOrEmails.forEach((usernameOrEmail) => checkInputEmailIsValid(usernameOrEmail));
@@ -260,6 +262,7 @@ export async function createNewUsersConnectToOrgIfExists({
email: usernameOrEmail,
verified: true,
invitedTo: input.teamId,
isPlatformManaged: !!isPlatformManaged,
organizationId: orgId || null, // If the user is invited to a child team, they are automatically added to the parent org
...(orgId
? {