Skip to content

Commit

Permalink
Remove IDN_SCIM_GROUP table involvemnet
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshiAthapaththu committed Aug 14, 2023
1 parent d74cfb2 commit ba5ec86
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2627,19 +2627,23 @@ public Group createGroup(Group group, Map<String, Boolean> requiredAttributes)
}
}
// Add other scim attributes in the identity DB since user store doesn't support some attributes.
SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
scimGroupHandler.createSCIMAttributes(group);
// Commented by Lakshi as we don't need to save this in the identity DB if there is ID support
// enabled in user store level.
// SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
// scimGroupHandler.createSCIMAttributes(group);
// carbonUM.addRoleWithID(group.getDisplayName(), members.toArray(new String[0]), null, false);
coreGroup = carbonUM.addGroupWithID(group.getDisplayName(), members.toArray(new String[0]), null, false);
coreGroup = carbonUM.addGroupWithID(group.getDisplayName(), members.toArray(new String[0]));
if (log.isDebugEnabled()) {
log.debug("Group: " + group.getDisplayName() + " is created through SCIM.");
}
} else {
// Add other scim attributes in the identity DB since user store doesn't support some attributes.
SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
scimGroupHandler.createSCIMAttributes(group);
// Commented by Lakshi as we don't need to save this in the identity DB if there is ID support
// enabled in user store level.
// SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
// scimGroupHandler.createSCIMAttributes(group);
// carbonUM.addRoleWithID(group.getDisplayName(), null, null, false);
coreGroup = carbonUM.addGroupWithID(group.getDisplayName(), null, null, false);
coreGroup = carbonUM.addGroupWithID(group.getDisplayName(), null);

if (log.isDebugEnabled()) {
log.debug("Group: " + group.getDisplayName() + " is created through SCIM.");
Expand All @@ -2650,13 +2654,15 @@ public Group createGroup(Group group, Map<String, Boolean> requiredAttributes)
group.setId(coreGroup.getGroupID());
}
} catch (UserStoreException e) {
try {
SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
scimGroupHandler.deleteGroupAttributes(group.getDisplayName());
} catch (UserStoreException | IdentitySCIMException ex) {
throw resolveError(e, "Error occurred while doing rollback operation of the SCIM " +
"table entry for role: " + group.getDisplayName());
}
// Commented by Lakshi as we don't need to save this in the identity DB if there is ID support
// enabled in user store level.
// try {
// SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(carbonUM.getTenantId());
// scimGroupHandler.deleteGroupAttributes(group.getDisplayName());
// } catch (UserStoreException | IdentitySCIMException ex) {
// throw resolveError(e, "Error occurred while doing rollback operation of the SCIM " +
// "table entry for role: " + group.getDisplayName());
// }
handleErrorsOnRoleNamePolicy(e);
throw resolveError(e, "Error occurred while adding role : " + group.getDisplayName());
} catch (IdentitySCIMException | BadRequestException e) {
Expand Down

0 comments on commit ba5ec86

Please sign in to comment.