From 069f07a1797b69192587b8aa782badf6d76ff8b4 Mon Sep 17 00:00:00 2001 From: AnuradhaSK Date: Thu, 2 Nov 2023 10:18:24 +0530 Subject: [PATCH] fix error log on restart --- .../identity/scim2/common/utils/SCIMCommonUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); }