fix: correct update role mapping for identity/user and prevent updating role slug to "custom"

This commit is contained in:
Scott Wilson
2024-11-22 13:02:00 -08:00
parent d7b494c6f8
commit 24b50651c9
3 changed files with 60 additions and 6 deletions
@@ -182,7 +182,12 @@ export const identityProjectServiceFactory = ({
// validate custom roles input
const customInputRoles = roles.filter(
({ role }) => !Object.values(ProjectMembershipRole).includes(role as ProjectMembershipRole)
({ role }) =>
!Object.values(ProjectMembershipRole)
// we don't want to include custom in this check;
// this unintentionally lets users set slug to custom which is reserved
.filter((r) => r !== ProjectMembershipRole.Custom)
.includes(role as ProjectMembershipRole)
);
const hasCustomRole = Boolean(customInputRoles.length);
const customRoles = hasCustomRole