diff --git a/components/org.wso2.carbon.identity.organization.user.invitation.management/pom.xml b/components/org.wso2.carbon.identity.organization.user.invitation.management/pom.xml index 54cf2cd3c..99059c21c 100644 --- a/components/org.wso2.carbon.identity.organization.user.invitation.management/pom.xml +++ b/components/org.wso2.carbon.identity.organization.user.invitation.management/pom.xml @@ -124,6 +124,7 @@ org.wso2.carbon.identity.event; version="${carbon.identity.package.import.version.range}", org.wso2.carbon.identity.event.services; version="${carbon.identity.package.import.version.range}", org.wso2.carbon.identity.organization.management.service; version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}", + org.wso2.carbon.identity.organization.management.service.constant; version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}", org.wso2.carbon.identity.organization.management.service.util;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", org.wso2.carbon.identity.organization.management.service.exception;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", org.wso2.carbon.user.api;version="${carbon.user.api.imp.pkg.version.range}", diff --git a/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/InvitationCoreServiceImpl.java b/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/InvitationCoreServiceImpl.java index c12cffbaf..ba62e4086 100644 --- a/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/InvitationCoreServiceImpl.java +++ b/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/InvitationCoreServiceImpl.java @@ -57,6 +57,7 @@ import java.util.Map; import java.util.UUID; +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.organization.user.invitation.management.constant.UserInvitationMgtConstants.CLAIM_EMAIL_ADDRESS; import static org.wso2.carbon.identity.organization.user.invitation.management.constant.UserInvitationMgtConstants.CLAIM_MANAGED_ORGANIZATION; import static org.wso2.carbon.identity.organization.user.invitation.management.constant.UserInvitationMgtConstants.DEFAULT_PROFILE; @@ -353,6 +354,13 @@ public boolean deleteInvitedUserAssociation(String userId, UserStoreManager user try { authenticatedOrganizationId = organizationManager.resolveOrganizationId(authenticatedTenant); } catch (OrganizationManagementException e) { + // This is to handle the scenario where the tenant is not an organization. + if (e.getErrorCode().equals(ERROR_CODE_ORGANIZATION_NOT_FOUND_FOR_TENANT.getCode())) { + if (LOG.isDebugEnabled()) { + LOG.debug("Organization not found for the tenant: " + authenticatedTenant); + } + return true; + } throw new UserInvitationMgtServerException(ERROR_CODE_GET_ORG_ID_FROM_TENANT.getCode(), ERROR_CODE_GET_ORG_ID_FROM_TENANT.getMessage(), String.format(ERROR_CODE_GET_ORG_ID_FROM_TENANT.getDescription(), authenticatedTenant), e); diff --git a/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/listener/OrgSharedUserOperationEventListener.java b/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/listener/OrgSharedUserOperationEventListener.java index cbe37c23b..d54c20420 100644 --- a/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/listener/OrgSharedUserOperationEventListener.java +++ b/components/org.wso2.carbon.identity.organization.user.invitation.management/src/main/java/org/wso2/carbon/identity/organization/user/invitation/management/listener/OrgSharedUserOperationEventListener.java @@ -94,10 +94,4 @@ public boolean doPreSetUserClaimValueWithID(String userID, String claimURI, Stri } return true; } - - @Override - public boolean isEnable() { - - return false; - } }