From 8376f5166f958ba9c798ee983c921f8aa0d008e4 Mon Sep 17 00:00:00 2001 From: AnuradhaSK Date: Sun, 15 Oct 2023 21:35:12 +0530 Subject: [PATCH] handle bad request --- .../carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4d83583e8..9eb932fc4 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 @@ -77,6 +77,7 @@ import static org.apache.commons.collections.CollectionUtils.isNotEmpty; import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ORGANIZATION_NOT_FOUND_FOR_TENANT; +import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.INVALID_PERMISSION; import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.OPERATION_FORBIDDEN; import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.ROLE_NOT_FOUND; import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.INVALID_AUDIENCE; @@ -156,7 +157,8 @@ public RoleV2 createRole(RoleV2 role) throw new ConflictException(e.getMessage()); } else if (StringUtils.equals(INVALID_REQUEST.getCode(), e.getErrorCode())) { throw new BadRequestException(e.getMessage()); - } else if (INVALID_AUDIENCE.getCode().equals(e.getErrorCode())) { + } else if (INVALID_AUDIENCE.getCode().equals(e.getErrorCode()) || + INVALID_PERMISSION.getCode().equals(e.getErrorCode())) { throw new BadRequestException(e.getMessage(), ResponseCodeConstants.INVALID_VALUE); } throw new CharonException(