feat(groups): unique names

This commit is contained in:
Daniel Hougaard
2025-01-16 01:01:01 +01:00
parent b8115d481c
commit c4d0896609
9 changed files with 103 additions and 12 deletions
@@ -790,6 +790,18 @@ export const scimServiceFactory = ({
});
const newGroup = await groupDAL.transaction(async (tx) => {
const conflictingGroup = await groupDAL.findOne({
name: displayName,
orgId
});
if (conflictingGroup) {
throw new ScimRequestError({
detail: `Group with name '${displayName}' already exists in the organization`,
status: 409
});
}
const group = await groupDAL.create(
{
name: displayName,