From c4b9f348480f0e3a1926b05c67785bf93725f83f Mon Sep 17 00:00:00 2001 From: Bhagyasakalanka Date: Thu, 7 Mar 2024 15:07:17 +0530 Subject: [PATCH] Improve tenanat endpoint to support b2b association creation --- .../management/v1/OrganizationsApi.java | 24 +++++++++ .../v1/OrganizationsApiService.java | 2 + .../v1/impl/OrganizationsApiServiceImpl.java | 6 +++ .../OrganizationManagementService.java | 19 +++++++ ...rbon.identity.organization.management.yaml | 35 ++++++++++++- .../pom.xml | 4 ++ .../common/TenantManagementServiceHolder.java | 35 +++++++++++++ ...OrganizationSharingOSGIServiceFactory.java | 37 +++++++++++++ .../common/factory/RealmServiceFactory.java | 52 +++++++++++++++++++ .../pom.xml | 4 ++ .../tenant/management/v1/model/Owner.java | 26 +++++++++- .../core/ServerTenantManagementService.java | 20 +++++++ .../cxf/tenant-management-server-v1-cxf.xml | 13 +++++ .../src/main/resources/tenant-management.yaml | 4 ++ pom.xml | 8 ++- 15 files changed, 285 insertions(+), 4 deletions(-) create mode 100644 components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/OrganizationSharingOSGIServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/RealmServiceFactory.java diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java index 7f231f1c91..02183a3304 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java @@ -249,6 +249,30 @@ public Response organizationsGet( @Valid@ApiParam(value = "Condition to filte return delegate.organizationsGet(filter, limit, after, before, recursive ); } + @Valid + @GET + @Path("/name/{organization-name}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Get an existing organization, identified by the organization name.", notes = "This API is used to get an existing organization identified by the organization name.", response = GetOrganizationResponse.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ "Organization", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful response", response = GetOrganizationResponse.class), + @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class), + @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class), + @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class), + @ApiResponse(code = 404, message = "Requested resource is not found.", response = Error.class), + @ApiResponse(code = 500, message = "Internal server error.", response = Error.class) + }) + public Response organizationsNameOrganizationNameGet(@ApiParam(value = "Name of the organization.",required=true) @PathParam("organization-name") String organizationName, @Valid@ApiParam(value = "Returns the organization details along with permissions assigned for the requested user in this organization.", defaultValue="false") @DefaultValue("false") @QueryParam("includePermissions") Boolean includePermissions) { + + return delegate.organizationsNameOrganizationNameGet(organizationName, includePermissions ); + } + @Valid @DELETE @Path("/{organization-id}") diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java index 3630216e9e..2eee2e6a28 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java @@ -64,6 +64,8 @@ public interface OrganizationsApiService { public Response organizationsGet(String filter, Integer limit, String after, String before, Boolean recursive); + public Response organizationsNameOrganizationNameGet(String organizationName, Boolean includePermissions); + public Response organizationsOrganizationIdDelete(String organizationId); public Response organizationsOrganizationIdDiscoveryDelete(String organizationId); diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java index 53211f1054..a966c9f715 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java @@ -175,4 +175,10 @@ public Response organizationsDiscoveryGet(String filter, Integer offset, Integer return organizationManagementService.getOrganizationsDiscoveryAttributes(filter, offset, limit); } + + @Override + public Response organizationsNameOrganizationNameGet(String organizationName, Boolean includePermissions) { + + return organizationManagementService.getOrganizationByName(organizationName); + } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java index 45555081d8..2cea9e6981 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java @@ -130,6 +130,25 @@ public Response getOrganizations(String filter, Integer limit, String after, Str } } + /** + * Retrieve organization Id by organization name. + * + * @param organizationName Organization Name + * @return The list of organization IDs. + */ + public Response getOrganizationByName(String organizationName) { + + try { + + String organizationId = getOrganizationManager().getOrganizationIdByName(organizationName); + return Response.ok().entity(organizationId).build(); + } catch (OrganizationManagementClientException e) { + return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG); + } catch (OrganizationManagementException e) { + return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG); + } + } + /** * Check if organization exist for given name. * diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml index b2bec25f4a..25890e76bc 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml @@ -121,7 +121,40 @@ paths: $ref: '#/components/responses/ServerError' tags: - Organization - + /organizations/name/{organization-name}: + get: + description: + This API is used to get an existing organization identified by the organization name. + summary: + Get an existing organization, identified by the organization name. + parameters: + - name: organization-name + in: path + description: Name of the organization. + required: true + schema: + type: string + example: org1 + - $ref: '#/components/parameters/includePermissionsQueryParam' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/GetOrganizationResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + tags: + - Organization /organizations/{organization-id}: get: description: diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/pom.xml index 0682c6b15c..e3f34bfd94 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/pom.xml @@ -58,5 +58,9 @@ org.wso2.carbon.multitenancy org.wso2.carbon.tenant.mgt + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.management.organization.user.sharing + diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/TenantManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/TenantManagementServiceHolder.java index b1d16bc533..f4b828a788 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/TenantManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/TenantManagementServiceHolder.java @@ -15,7 +15,9 @@ */ package org.wso2.carbon.identity.api.server.tenant.management.common; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.OrganizationUserSharingService; import org.wso2.carbon.tenant.mgt.services.TenantMgtService; +import org.wso2.carbon.user.core.service.RealmService; /** * Service holder class for tenant management. @@ -23,6 +25,8 @@ public class TenantManagementServiceHolder { private static TenantMgtService tenantMgtService; + private static OrganizationUserSharingService organizationUserSharingService; + private static RealmService realmService; /** * Get TenantMgtService osgi service. @@ -43,4 +47,35 @@ public static void setTenantMgtService(TenantMgtService tenantMgtService) { TenantManagementServiceHolder.tenantMgtService = tenantMgtService; } + + /** + * Get OrganizationUserSharingService osgi service. + * + * @return OrganizationUserSharingService + */ + public static OrganizationUserSharingService getOrganizationUserSharingService() { + + return organizationUserSharingService; + } + + /** + * Set OrganizationUserSharingService osgi service. + * + * @param organizationUserSharingService OrganizationUserSharingService. + */ + public static void setOrganizationUserSharingService( + OrganizationUserSharingService organizationUserSharingService) { + + TenantManagementServiceHolder.organizationUserSharingService = organizationUserSharingService; + } + + public static RealmService getRealmService() { + + return realmService; + } + + public static void setRealmService(RealmService realmService) { + + TenantManagementServiceHolder.realmService = realmService; + } } diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/OrganizationSharingOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/OrganizationSharingOSGIServiceFactory.java new file mode 100644 index 0000000000..611a5acb18 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/OrganizationSharingOSGIServiceFactory.java @@ -0,0 +1,37 @@ +package org.wso2.carbon.identity.api.server.tenant.management.common.factory; + +import org.springframework.beans.factory.config.AbstractFactoryBean; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.OrganizationUserSharingService; + +/** + * + */ +public class OrganizationSharingOSGIServiceFactory extends AbstractFactoryBean { + + private OrganizationUserSharingService organizationUserSharingService; + + @Override + public Class getObjectType() { + + return Object.class; + } + + @Override + protected OrganizationUserSharingService createInstance() throws Exception { + + OrganizationUserSharingService organizationUserSharingService = null; + if (this.organizationUserSharingService == null) { + organizationUserSharingService = (OrganizationUserSharingService) + PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getOSGiService(OrganizationUserSharingService.class, + null); + if (organizationUserSharingService != null) { + this.organizationUserSharingService = organizationUserSharingService; + } else { + throw new Exception("Unable to get the OrganizationUserSharingService"); + } + } + return this.organizationUserSharingService; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/RealmServiceFactory.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/RealmServiceFactory.java new file mode 100644 index 0000000000..13be54dda3 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.common/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/common/factory/RealmServiceFactory.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.carbon.identity.api.server.tenant.management.common.factory; + +import org.springframework.beans.factory.config.AbstractFactoryBean; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.user.core.service.RealmService; + +/** + * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to + * instantiate the RealmService type of object inside the container. + */ +public class RealmServiceFactory extends AbstractFactoryBean { + + private RealmService realmService; + + @Override + public Class getObjectType() { + + return RealmService.class; + } + + @Override + protected RealmService createInstance() throws Exception { + + if (this.realmService == null) { + RealmService realmService = (RealmService) + PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getOSGiService(RealmService.class, null); + if (realmService != null) { + this.realmService = realmService; + } else { + throw new Exception("Unable to retrieve UserStoreConfig Service."); + } + } + return this.realmService; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/pom.xml index 1740c14eab..bf160e0f40 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/pom.xml @@ -169,6 +169,10 @@ org.wso2.carbon.identity.api.server.common provided + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.management.organization.user.sharing + commons-beanutils commons-beanutils diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/tenant/management/v1/model/Owner.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/tenant/management/v1/model/Owner.java index 4fb88118fc..e25278bab7 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/tenant/management/v1/model/Owner.java +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/tenant/management/v1/model/Owner.java @@ -41,6 +41,7 @@ public class Owner { private String provisioningMethod; private List additionalClaims = null; + private String userId; /** * Username for the tenant owner. @@ -188,7 +189,26 @@ public Owner addAdditionalClaimsItem(AdditionalClaims additionalClaimsItem) { return this; } + /** + * id of the tenant owner. + **/ + public Owner userId(String userId) { + + this.userId = userId; + return this; + } + @ApiModelProperty(example = "4875-jhgr-454hb", value = "id of the tenant owner.") + @JsonProperty("userId") + @Valid + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + + @Override public boolean equals(java.lang.Object o) { @@ -206,12 +226,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.firstname, owner.firstname) && Objects.equals(this.lastname, owner.lastname) && Objects.equals(this.provisioningMethod, owner.provisioningMethod) && - Objects.equals(this.additionalClaims, owner.additionalClaims); + Objects.equals(this.additionalClaims, owner.additionalClaims) && + Objects.equals(this.userId, owner.userId); } @Override public int hashCode() { - return Objects.hash(username, password, email, firstname, lastname, provisioningMethod, additionalClaims); + return Objects.hash(username, password, email, firstname, lastname, provisioningMethod, additionalClaims, userId); } @Override @@ -227,6 +248,7 @@ public String toString() { sb.append(" lastname: ").append(toIndentedString(lastname)).append("\n"); sb.append(" provisioningMethod: ").append(toIndentedString(provisioningMethod)).append("\n"); sb.append(" additionalClaims: ").append(toIndentedString(additionalClaims)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/core/ServerTenantManagementService.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/core/ServerTenantManagementService.java index 330dc1112e..ca9b5b0ac3 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/core/ServerTenantManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/core/ServerTenantManagementService.java @@ -43,6 +43,8 @@ import org.wso2.carbon.stratos.common.exception.TenantManagementServerException; import org.wso2.carbon.stratos.common.exception.TenantMgtException; import org.wso2.carbon.tenant.mgt.services.TenantMgtService; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.core.common.AbstractUserStoreManager; import org.wso2.carbon.user.core.common.User; import org.wso2.carbon.user.core.tenant.Tenant; import org.wso2.carbon.user.core.tenant.TenantSearchResult; @@ -92,10 +94,28 @@ public String addTenant(TenantModel tenantModel) { TenantMgtService tenantMgtService = TenantManagementServiceHolder.getTenantMgtService(); try { Tenant tenant = createTenantInfoBean(tenantModel); + tenant.setAdminUserId(tenantModel.getOwners().get(0).getUserId()); resourceId = tenantMgtService.addTenant(tenant); + tenant = tenantMgtService.getTenantByDomain(tenantModel.getDomain()); + String userId = + ((AbstractUserStoreManager) (TenantManagementServiceHolder.getRealmService()).getTenantUserRealm( + tenant.getId()).getUserStoreManager()).getUserIDFromUserName(tenant.getAdminName()); + try { + TenantManagementServiceHolder.getOrganizationUserSharingService() + .createOrganizationUserAssociation(userId, tenant.getAssociatedOrganizationUUID(), + tenantModel.getOwners().get(0).getUserId(), "10084a8d-113f-4211-a0d5-efe36b082211"); +// TenantManagementServiceHolder.getOrganizationUserSharingService() +// .shareOrganizationUser(tenant.getAssociatedOrganizationUUID(), +// tenantModel.getOwners().get(0).getUserId(), "10084a8d-113f-4211-a0d5-efe36b082211", +// tenant.getAdminName()); + } catch (Exception e) { + log.error("Error while sharing organization user.", e); + } } catch (TenantMgtException e) { throw handleTenantManagementException(e, TenantManagementConstants.ErrorMessage .ERROR_CODE_ERROR_ADDING_TENANT, null); + } catch (UserStoreException e) { + throw new APIError(Response.Status.INTERNAL_SERVER_ERROR, new ErrorResponse()); } return resourceId; } diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/META-INF/cxf/tenant-management-server-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/META-INF/cxf/tenant-management-server-v1-cxf.xml index 9c5677860a..62eab563a3 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/META-INF/cxf/tenant-management-server-v1-cxf.xml +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/META-INF/cxf/tenant-management-server-v1-cxf.xml @@ -25,6 +25,19 @@ class="org.wso2.carbon.identity.api.server.tenant.management.common.TenantManagementServiceHolder"> + + + + + + + + + diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/tenant-management.yaml b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/tenant-management.yaml index 5419baf114..180ff55283 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/tenant-management.yaml +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/resources/tenant-management.yaml @@ -637,6 +637,10 @@ components: type: array items: $ref: '#/components/schemas/AdditionalClaims' + userId: + type: string + example: "4875-jhgr-454hb" + description: id of the tenant owner. OwnerResponse: type: object diff --git a/pom.xml b/pom.xml index 80982502c4..58ee37ddd7 100644 --- a/pom.xml +++ b/pom.xml @@ -543,6 +543,12 @@ ${org.wso2.carbon.identity.organization.management.version} provided + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.management.organization.user.sharing + ${org.wso2.carbon.identity.organization.management.version} + provided + org.wso2.carbon.identity.organization.management org.wso2.carbon.identity.organization.management.role.management.service @@ -809,7 +815,7 @@ - 1.3.142 + 1.3.146