fix: should allow org owners and admins to delete members from subteams (#11710)
Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
1 parent
d4d96eb5cd
commit
703bcd861e
3 files changed
+16
-5
No files matched your search
@@ -23,7 +23,8 @@ export const removeMemberHandler = async ({ ctx, input }: RemoveMemberOptions) =
|
||||
const isOrgAdmin = ctx.user.organizationId
|
||||
? await isTeamAdmin(ctx.user.id, ctx.user.organizationId)
|
||||
: false;
|
||||
if (!isAdmin && ctx.user.id !== input.memberId) throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
if (!(isAdmin || isOrgAdmin) && ctx.user.id !== input.memberId)
|
||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
// Only a team owner can remove another team owner.
|
||||
if ((await isTeamOwner(input.memberId, input.teamId)) && !(await isTeamOwner(ctx.user.id, input.teamId)))
|
||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
|
||||
Reference in new issue
Block a user