From f11949a39f9fddcb258f3638f5f8f577ddc88824 Mon Sep 17 00:00:00 2001 From: ChanikaRuchini Date: Thu, 2 Nov 2023 11:30:52 +0530 Subject: [PATCH] Fix invalid permission error handling issues --- .../carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java index e4bc1119d..90c0cbe88 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java @@ -942,9 +942,8 @@ private void doUpdatePermissions(String roleId, Set addedPermissions, Se } catch (IdentityRoleManagementException e) { if (RoleConstants.Error.INVALID_REQUEST.getCode().equals(e.getErrorCode())) { throw new BadRequestException(e.getMessage()); - } else if (RoleConstants.Error.INVALID_PERMISSION.getCode() - .equals(ROLE_MANAGEMENT_ERROR_CODE_PREFIX + e.getErrorCode())) { - throw new BadRequestException(e.getMessage()); + } else if (RoleConstants.Error.INVALID_PERMISSION.getCode().equals(e.getErrorCode())) { + throw new BadRequestException(e.getMessage(), ResponseCodeConstants.INVALID_VALUE); } throw new CharonException( String.format("Error occurred while updating permissions of the role with ID: %s", roleId), e);