diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java index d1b326ace..5cc3d7522 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java @@ -862,7 +862,9 @@ public static void updateEveryOneRoleV2MetaData(int tenantId) { getTenantUserRealm(tenantId).getUserStoreManager(); SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(userStoreManager.getTenantId()); String everyoneRoleName = userStoreManager.getRealmConfiguration().getEveryOneRoleName(); - scimGroupHandler.addRoleV2MandatoryAttributes(everyoneRoleName); + if (!scimGroupHandler.isGroupExisting(everyoneRoleName)) { + scimGroupHandler.addRoleV2MandatoryAttributes(everyoneRoleName); + } } catch (org.wso2.carbon.user.api.UserStoreException | IdentitySCIMException e) { log.error(e); } @@ -882,7 +884,9 @@ public static void updateSystemRoleV2MetaData(int tenantId) { UserStoreManager userStoreManager = (UserStoreManager) SCIMCommonComponentHolder.getRealmService(). getTenantUserRealm(tenantId).getUserStoreManager(); SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(userStoreManager.getTenantId()); - scimGroupHandler.addRoleV2MandatoryAttributes(AccountConstants.ACCOUNT_LOCK_BYPASS_ROLE); + if (!scimGroupHandler.isGroupExisting(AccountConstants.ACCOUNT_LOCK_BYPASS_ROLE)) { + scimGroupHandler.addRoleV2MandatoryAttributes(AccountConstants.ACCOUNT_LOCK_BYPASS_ROLE); + } } catch (org.wso2.carbon.user.api.UserStoreException | IdentitySCIMException e) { log.error(e); }