From 11e7260d4e1d2c1cddad9ad9b3e4918f0f27bcdc Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 09:53:32 +0530 Subject: [PATCH 01/34] Initiate user sharing api --- .../pom.xml | 107 +++ .../common/UserSharingMgtConstants.java | 143 ++++ .../common/UserSharingMgtServiceHolder.java | 49 ++ .../UserSharingMgtOSGIServiceFactory.java | 54 ++ .../pom.xml | 178 +++++ .../user/sharing/management/v1/UsersApi.java | 148 +++++ .../management/v1/UsersApiService.java | 51 ++ .../v1/factories/UsersApiServiceFactory.java | 32 + .../sharing/management/v1/model/Error.java | 175 +++++ .../v1/model/ProcessSuccessResponse.java | 124 ++++ .../management/v1/model/RoleWithAudience.java | 128 ++++ .../v1/model/RoleWithAudienceAudience.java | 125 ++++ .../v1/model/UserShareRequestBody.java | 136 ++++ .../UserShareRequestBodyOrganizations.java | 188 ++++++ .../UserShareRequestBodyUserCriteria.java | 113 ++++ .../v1/model/UserShareWithAllRequestBody.java | 191 ++++++ .../UserSharedOrganizationsResponse.java | 168 +++++ .../UserSharedOrganizationsResponseLinks.java | 121 ++++ ...anizationsResponseSharedOrganizations.java | 220 ++++++ .../v1/model/UserSharedRolesResponse.java | 146 ++++ .../v1/model/UserUnshareRequestBody.java | 135 ++++ .../UserUnshareRequestBodyUserCriteria.java | 113 ++++ .../model/UserUnshareWithAllRequestBody.java | 102 +++ .../v1/core/UsersApiServiceCore.java | 5 + .../v1/impl/UsersApiServiceImpl.java | 70 ++ .../organization-user-sharing-mgt-v1-cxf.xml | 33 + .../resources/organization-user-share.yaml | 626 ++++++++++++++++++ .../pom.xml | 36 + pom.xml | 23 +- 29 files changed, 3739 insertions(+), 1 deletion(-) create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApiService.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/Error.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/ProcessSuccessResponse.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudience.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudienceAudience.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBody.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyUserCriteria.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseLinks.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedRolesResponse.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBody.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBodyUserCriteria.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareWithAllRequestBody.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml new file mode 100644 index 0000000000..508096dfe3 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -0,0 +1,107 @@ + + + + 4.0.0 + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.user.sharing.management + 1.2.246-SNAPSHOT + ../pom.xml + + + org.wso2.carbon.identity.api.server.organization.user.sharing.management.common + jar + + + + org.wso2.carbon.multitenancy + org.wso2.carbon.tenant.mgt + + + org.wso2.carbon.extension.identity.verification + org.wso2.carbon.extension.identity.verification.provider + + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.management.organization.user.sharing + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-rs-service-description + provided + + + javax.ws.rs + javax.ws.rs-api + provided + + + org.springframework + spring-web + provided + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + provided + + + io.swagger + swagger-jaxrs + provided + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + javax.ws.rs + jsr311-api + + + com.google.guava + guava + + + + + + + 8 + 8 + UTF-8 + + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java new file mode 100644 index 0000000000..7fa0c37e26 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.common; + +/** + * Holds the constants which the shared user invitation management API component is using. + */ +public class UserSharingMgtConstants { + + public static final String ERROR_PREFIX = "OUI-"; + public static final String ERROR_FAIL_STATUS = "Failed"; + + /** + * Enum for shared user invitation management related errors. + * Error Code - code to identify the error. + * Error Message - What went wrong. + * Error Description - Why it went wrong. + */ + public enum ErrorMessage { + + // Client errors. + ERROR_CODE_USER_NOT_FOUND("60000", + "Invalid user identifier is provided.", + "Invalid user identifier %s is provided."), + ERROR_CODE_INVALID_INVITATION("60001", + "Invalid invitation.", + "Provided invitation with the id %s is invalid."), + ERROR_CODE_INVALID_CONFIRMATION_CODE("60002", + "Invalid confirmation code.", + "Could not validate the confirmation code %s."), + ERROR_CODE_MULTIPLE_INVITATIONS_FOR_USER("60003", + "Unable to create the invitation.", + "Multiple invitations found for users given in the list %s."), + ERROR_CODE_UNSUPPORTED_LIMIT("60004", + "Unsupported param.", + "Limit param is not supported yet."), + ERROR_CODE_UNSUPPORTED_OFFSET("60005", + "Unsupported param.", + "Offset param is not supported yet."), + ERROR_CODE_UNSUPPORTED_SORT_ORDER("60006", + "Unsupported param.", + "Sort order param is not supported yet."), + ERROR_CODE_UNSUPPORTED_SORT_BY("60007", + "Unsupported param.", + "Sort order param is not supported yet."), + ERROR_CODE_ACTIVE_INVITATION_AVAILABLE("60008", + "Invitation already exists.", + "An active invitation already exists for the user %s."), + ERROR_CODE_INVALID_FILTER("60009", + "Invalid filter.", + "Provided filter %s is not valid."), + ERROR_CODE_INVALID_APPLICATION("60009", + "Invalid application provided.", + "One of the provided applications with roles are not valid."), + ERROR_CODE_INVALID_CONFIRMATION_CODE_FOR_ACCEPTANCE("60010", + "Invalid confirmation code.", + "Could not accept the invitation since the confirmation code %s is not valid."), + ERROR_CODE_INVALID_USER("60011", + "Invalid user provided.", + "Invalid user is provided."), + ERROR_CODE_EXISTING_USER("60012", + "Authenticated user exist.", + "The authenticated user is already available in the organization."), + ERROR_CODE_INVALID_ROLE("60013", + "Invalid role list provided.", + "The provided role lists are not valid."), + ERROR_CODE_INVALID_USER_INFORMATION("60014", + "Unable to create an invitation to all the users given in the list.", + "User invitation creation failed for the users: %s"), + ERROR_CODE_INVALID_GROUP("60014", + "Invalid group list provided.", + "The provided group lists are not valid."), + + // Server errors. + ERROR_CODE_CREATE_INVITATION("65001", + "Unable to create the invitation.", + "Could not create the invitation to the user %s."), + ERROR_CODE_GET_INVITATIONS("65002", + "Unable to retrieve the invitations.", + "Could not retrieve the invitations for the organization."), + ERROR_CODE_VALIDATE_INVITATION("65003", + "Unable to validate the invitation.", + "Could not validate the invitation with the confirmation code %s."), + ERROR_CODE_DELETE_INVITATION("65004", + "Unable to delete the invitation.", + "Could not delete the invitation with the id %s."), + ERROR_CODE_ACCEPT_INVITATION("65005", + "Unable to accept the invitation.", + "Could not accept the invitation with the confirmation code %s."), + ERROR_CODE_NOT_IMPLEMENTED("65100", + "Not Implemented.", + "Method is not implemented."); + + + private final String code; + private final String message; + private final String description; + + ErrorMessage(String code, String message, String description) { + + this.code = code; + this.message = message; + this.description = description; + } + + public String getCode() { + + return ERROR_PREFIX + code; + } + + public String getMessage() { + + return message; + } + + public String getDescription() { + + return description; + } + + @Override + public String toString() { + + return code + " | " + message; + } + } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java new file mode 100644 index 0000000000..a76d3deddf --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.common; + +//import org.wso2.carbon.identity.organization.user.invitation.management.InvitationCoreService; + +/** + * Holds the services which the shared user invitation management API component is using. + */ +public class UserSharingMgtServiceHolder { + +// private static InvitationCoreService invitationCoreService; +// +// /** +// * Get Invitation Core osgi service. +// * +// * @return InvitationCoreService. +// */ +// public static InvitationCoreService getInvitationCoreService() { +// +// return invitationCoreService; +// } +// +// /** +// * Set Invitation Core osgi service. +// * +// * @param invitationCoreService InvitationCoreService. +// */ +// public static void setInvitationCoreService(InvitationCoreService invitationCoreService) { +// +// UserInvitationMgtServiceHolder.invitationCoreService = invitationCoreService; +// } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java new file mode 100644 index 0000000000..6543d55fea --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.common.factory; + +//import org.springframework.beans.factory.config.AbstractFactoryBean; +//import org.wso2.carbon.context.PrivilegedCarbonContext; +//import org.wso2.carbon.identity.organization.user.sharing.UserSharingPolicyHandlerService; + +/** + * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to + * instantiate the Invitation Core Service inside the container. + */ +public class UserSharingMgtOSGIServiceFactory { + //extends AbstractFactoryBean { + +// private InvitationCoreService invitationCoreService; +// +// @Override +// public Class getObjectType() { +// +// return Object.class; +// } +// +// @Override +// protected InvitationCoreService createInstance() throws Exception { +// +// if (this.invitationCoreService == null) { +// InvitationCoreService invitationCoreService = (InvitationCoreService) +// PrivilegedCarbonContext.getThreadLocalCarbonContext() +// .getOSGiService(InvitationCoreService.class, null); +// if (invitationCoreService == null) { +// throw new Exception("Unable to retrieve InvitationCoreService."); +// } +// this.invitationCoreService = invitationCoreService; +// } +// return this.invitationCoreService; +// } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml new file mode 100644 index 0000000000..17b01f862c --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -0,0 +1,178 @@ + + + + 4.0.0 + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.user.sharing.management + 1.2.246-SNAPSHOT + ../pom.xml + + + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 + jar + + + + javax.ws.rs + javax.ws.rs-api + provided + + + org.springframework + spring-web + provided + + + org.springframework + spring-beans + provided + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-rs-service-description + provided + + + io.swagger + swagger-jaxrs + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + javax.ws.rs + jsr311-api + + + com.google.guava + guava + + + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.user.sharing.management.common + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.common + provided + + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.management.organization.user.sharing + provided + + + + + + org.openapitools + openapi-generator-maven-plugin + 4.1.2 + + + + generate + + + ${project.basedir}/src/main/resources/organization-user-share.yaml + org.wso2.carbon.codegen.CxfWso2Generator + + src/gen/java + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 + java8 + true + + . + false + + + + + + org.openapitools + cxf-wso2-openapi-generator + 1.0.0 + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 1.8 + 1.8 + + + + + + + 8 + 8 + UTF-8 + + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java new file mode 100644 index 0000000000..fb5b11aebe --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import java.io.InputStream; +import java.util.List; + +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.Error; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; + +import javax.validation.Valid; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; + +@Path("/users") +@Api(description = "The users API") + +public class UsersApi { + + @Autowired + private UsersApiService delegate; + + @Valid + @POST + @Path("/share") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Share a user across specific organizations", notes = "This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. Permission required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiResponses(value = { + @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response processUserSharing(@ApiParam(value = "" ,required=true) @Valid UserShareRequestBody userShareRequestBody) { + + return delegate.processUserSharing(userShareRequestBody ); + } + + @Valid + @POST + @Path("/share-with-all") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Share a user with all organizations", notes = "This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. Permission required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiResponses(value = { + @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response processUserSharingAll(@ApiParam(value = "" ,required=true) @Valid UserShareWithAllRequestBody userShareWithAllRequestBody) { + + return delegate.processUserSharingAll(userShareWithAllRequestBody ); + } + + @Valid + @POST + @Path("/unshare") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Unshare a user from specific organizations", notes = "This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. Permission required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiResponses(value = { + @ApiResponse(code = 202, message = "Unsharing process triggered successfully.", response = ProcessSuccessResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response processUserUnsharing(@ApiParam(value = "" ,required=true) @Valid UserUnshareRequestBody userUnshareRequestBody) { + + return delegate.processUserUnsharing(userUnshareRequestBody ); + } + + @Valid + @POST + @Path("/unshare-with-all") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "Remove a user's shared access", notes = "This API removes all shared access for one or more users, unsharing them from all organizations. Permission required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiResponses(value = { + @ApiResponse(code = 202, message = "Share removal process triggered successfully.", response = ProcessSuccessResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response removeUserSharing(@ApiParam(value = "" ,required=true) @Valid UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { + + return delegate.removeUserSharing(userUnshareWithAllRequestBody ); + } + + @Valid + @GET + @Path("/{userId}/shared-organizations") + + @Produces({ "application/json" }) + @ApiOperation(value = "Get organizations a user has access to", notes = "This API retrieves the list of organizations where the specified user has shared access, with support for pagination and filtering. Permission required: `internal_user_shared_access_view` ", response = UserSharedOrganizationsResponse.class, tags={ "User Accessible Organizations", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful Response with Accessible Organizations", response = UserSharedOrganizationsResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response usersUserIdSharedOrganizationsGet(@ApiParam(value = "The ID of the user whose accessible organizations are being retrieved.",required=true) @PathParam("userId") String userId, @Valid@ApiParam(value = "The cursor pointing to the item after which the next page of results should be returned.") @QueryParam("after") String after, @Valid@ApiParam(value = "The cursor pointing to the item before which the previous page of results should be returned.") @QueryParam("before") String before, @Valid@ApiParam(value = "The maximum number of results to return per page.") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "A filter to apply to the results, such as by organization name or other criteria.") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Whether to retrieve organizations recursively, including child organizations.", defaultValue="false") @DefaultValue("false") @QueryParam("recursive") Boolean recursive) { + + return delegate.usersUserIdSharedOrganizationsGet(userId, after, before, limit, filter, recursive ); + } + + @Valid + @GET + @Path("/{userId}/shared-roles") + + @Produces({ "application/json" }) + @ApiOperation(value = "Get roles assigned to a user in an organization", notes = "This API fetches the roles assigned to the specified user within a particular organization, with support for pagination, filtering, and recursion. Permission required: `internal_user_shared_access_view` ", response = UserSharedRolesResponse.class, tags={ "User Accessible Roles" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful Response with Accessible Roles", response = UserSharedRolesResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response usersUserIdSharedRolesGet(@ApiParam(value = "The ID of the user for whom roles are being retrieved.",required=true) @PathParam("userId") String userId, @Valid @NotNull(message = "Property cannot be null.") @ApiParam(value = "The organization ID for which roles are being fetched.",required=true) @QueryParam("orgId") String orgId, @Valid@ApiParam(value = "The cursor pointing to the item after which the next page of results should be returned.") @QueryParam("after") String after, @Valid@ApiParam(value = "The cursor pointing to the item before which the previous page of results should be returned.") @QueryParam("before") String before, @Valid@ApiParam(value = "The maximum number of results to return per page.") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Filter to apply when retrieving the roles.") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Set to true to retrieve roles recursively.") @QueryParam("recursive") Boolean recursive) { + + return delegate.usersUserIdSharedRolesGet(userId, orgId, after, before, limit, filter, recursive ); + } + +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApiService.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApiService.java new file mode 100644 index 0000000000..23928df159 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApiService.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1; + +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.*; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.*; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import java.io.InputStream; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.Error; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; +import javax.ws.rs.core.Response; + + +public interface UsersApiService { + + public Response processUserSharing(UserShareRequestBody userShareRequestBody); + + public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithAllRequestBody); + + public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBody); + + public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody); + + public Response usersUserIdSharedOrganizationsGet(String userId, String after, String before, Integer limit, String filter, Boolean recursive); + + public Response usersUserIdSharedRolesGet(String userId, String orgId, String after, String before, Integer limit, String filter, Boolean recursive); +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java new file mode 100644 index 0000000000..492f1891d1 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.factories; + +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl.UsersApiServiceImpl; + +public class UsersApiServiceFactory { + + private final static UsersApiService service = new UsersApiServiceImpl(); + + public static UsersApiService getUsersApi() + { + return service; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/Error.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/Error.java new file mode 100644 index 0000000000..a6a7ad0fa6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/Error.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.UUID; +import javax.validation.constraints.*; + +/** + * Details of an error, including code, message, description, and a trace ID to help with debugging. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Details of an error, including code, message, description, and a trace ID to help with debugging. ") +public class Error { + + private String code; + private String message; + private String description; + private UUID traceId; + + /** + * An error code. + **/ + public Error code(String code) { + + this.code = code; + return this; + } + + @ApiModelProperty(example = "OUI-00000", required = true, value = "An error code.") + @JsonProperty("code") + @Valid + @NotNull(message = "Property code cannot be null.") + + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + /** + * An error message. + **/ + public Error message(String message) { + + this.message = message; + return this; + } + + @ApiModelProperty(example = "Some Error Message", required = true, value = "An error message.") + @JsonProperty("message") + @Valid + @NotNull(message = "Property message cannot be null.") + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + /** + * An error description. + **/ + public Error description(String description) { + + this.description = description; + return this; + } + + @ApiModelProperty(example = "Some Error Description", value = "An error description.") + @JsonProperty("description") + @Valid + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + /** + * A trace ID in UUID format to help with debugging. + **/ + public Error traceId(UUID traceId) { + + this.traceId = traceId; + return this; + } + + @ApiModelProperty(example = "e0fbcfeb-7fc2-4b62-8b82-72d3c5fbcdeb", required = true, value = "A trace ID in UUID format to help with debugging.") + @JsonProperty("traceId") + @Valid + @NotNull(message = "Property traceId cannot be null.") + + public UUID getTraceId() { + return traceId; + } + public void setTraceId(UUID traceId) { + this.traceId = traceId; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.traceId, error.traceId); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, traceId); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/ProcessSuccessResponse.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/ProcessSuccessResponse.java new file mode 100644 index 0000000000..966a6bbee8 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/ProcessSuccessResponse.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + +/** + * Indicates that the sharing or unsharing process has started successfully, with the current status and relevant details. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Indicates that the sharing or unsharing process has started successfully, with the current status and relevant details. ") +public class ProcessSuccessResponse { + + private String status; + private String details; + + /** + * Status of the process. + **/ + public ProcessSuccessResponse status(String status) { + + this.status = status; + return this; + } + + @ApiModelProperty(example = "Processing", value = "Status of the process.") + @JsonProperty("status") + @Valid + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + + /** + * Additional information about the process. + **/ + public ProcessSuccessResponse details(String details) { + + this.details = details; + return this; + } + + @ApiModelProperty(example = "User sharing process triggered successfully.", value = "Additional information about the process.") + @JsonProperty("details") + @Valid + public String getDetails() { + return details; + } + public void setDetails(String details) { + this.details = details; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProcessSuccessResponse processSuccessResponse = (ProcessSuccessResponse) o; + return Objects.equals(this.status, processSuccessResponse.status) && + Objects.equals(this.details, processSuccessResponse.details); + } + + @Override + public int hashCode() { + return Objects.hash(status, details); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class ProcessSuccessResponse {\n"); + + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudience.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudience.java new file mode 100644 index 0000000000..3eab1ca56b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudience.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudienceAudience; +import javax.validation.constraints.*; + +/** + * Represents a user role within a specific audience (organization or application), defined by its display name and audience type. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Represents a user role within a specific audience (organization or application), defined by its display name and audience type. ") +public class RoleWithAudience { + + private String displayName; + private RoleWithAudienceAudience audience; + + /** + * Display name of the role + **/ + public RoleWithAudience displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + @ApiModelProperty(example = "role_1", required = true, value = "Display name of the role") + @JsonProperty("displayName") + @Valid + @NotNull(message = "Property displayName cannot be null.") + + public String getDisplayName() { + return displayName; + } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + **/ + public RoleWithAudience audience(RoleWithAudienceAudience audience) { + + this.audience = audience; + return this; + } + + @ApiModelProperty(required = true, value = "") + @JsonProperty("audience") + @Valid + @NotNull(message = "Property audience cannot be null.") + + public RoleWithAudienceAudience getAudience() { + return audience; + } + public void setAudience(RoleWithAudienceAudience audience) { + this.audience = audience; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoleWithAudience roleWithAudience = (RoleWithAudience) o; + return Objects.equals(this.displayName, roleWithAudience.displayName) && + Objects.equals(this.audience, roleWithAudience.audience); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, audience); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class RoleWithAudience {\n"); + + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudienceAudience.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudienceAudience.java new file mode 100644 index 0000000000..6b9a93b431 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/RoleWithAudienceAudience.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class RoleWithAudienceAudience { + + private String display; + private String type; + + /** + * Display name of the audience + **/ + public RoleWithAudienceAudience display(String display) { + + this.display = display; + return this; + } + + @ApiModelProperty(example = "My Org 1", required = true, value = "Display name of the audience") + @JsonProperty("display") + @Valid + @NotNull(message = "Property display cannot be null.") + + public String getDisplay() { + return display; + } + public void setDisplay(String display) { + this.display = display; + } + + /** + * Type of the audience, e.g., 'organization' or 'application' + **/ + public RoleWithAudienceAudience type(String type) { + + this.type = type; + return this; + } + + @ApiModelProperty(example = "organization", required = true, value = "Type of the audience, e.g., 'organization' or 'application'") + @JsonProperty("type") + @Valid + @NotNull(message = "Property type cannot be null.") + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoleWithAudienceAudience roleWithAudienceAudience = (RoleWithAudienceAudience) o; + return Objects.equals(this.display, roleWithAudienceAudience.display) && + Objects.equals(this.type, roleWithAudienceAudience.type); + } + + @Override + public int hashCode() { + return Objects.hash(display, type); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class RoleWithAudienceAudience {\n"); + + sb.append(" display: ").append(toIndentedString(display)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBody.java new file mode 100644 index 0000000000..9ce26d0d9f --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBody.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyOrganizations; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyUserCriteria; +import javax.validation.constraints.*; + +/** + * The request body for sharing users with multiple child organizations. Includes a list of users, organizations, sharing scope as policy, and roles. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "The request body for sharing users with multiple child organizations. Includes a list of users, organizations, sharing scope as policy, and roles. ") +public class UserShareRequestBody { + + private UserShareRequestBodyUserCriteria userCriteria; + private List organizations = null; + + + /** + **/ + public UserShareRequestBody userCriteria(UserShareRequestBodyUserCriteria userCriteria) { + + this.userCriteria = userCriteria; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("userCriteria") + @Valid + public UserShareRequestBodyUserCriteria getUserCriteria() { + return userCriteria; + } + public void setUserCriteria(UserShareRequestBodyUserCriteria userCriteria) { + this.userCriteria = userCriteria; + } + + /** + * List of organizations specifying sharing scope and roles. + **/ + public UserShareRequestBody organizations(List organizations) { + + this.organizations = organizations; + return this; + } + + @ApiModelProperty(value = "List of organizations specifying sharing scope and roles.") + @JsonProperty("organizations") + @Valid + public List getOrganizations() { + return organizations; + } + public void setOrganizations(List organizations) { + this.organizations = organizations; + } + + public UserShareRequestBody addOrganizationsItem(UserShareRequestBodyOrganizations organizationsItem) { + if (this.organizations == null) { + this.organizations = new ArrayList<>(); + } + this.organizations.add(organizationsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserShareRequestBody userShareRequestBody = (UserShareRequestBody) o; + return Objects.equals(this.userCriteria, userShareRequestBody.userCriteria) && + Objects.equals(this.organizations, userShareRequestBody.organizations); + } + + @Override + public int hashCode() { + return Objects.hash(userCriteria, organizations); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserShareRequestBody {\n"); + + sb.append(" userCriteria: ").append(toIndentedString(userCriteria)).append("\n"); + sb.append(" organizations: ").append(toIndentedString(organizations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java new file mode 100644 index 0000000000..4591192e89 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class UserShareRequestBodyOrganizations { + + private String orgId; + +@XmlType(name="PolicyEnum") +@XmlEnum(String.class) +public enum PolicyEnum { + + @XmlEnumValue("THIS ORG ONLY") ONLY(String.valueOf("THIS ORG ONLY")), @XmlEnumValue("THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG") AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG(String.valueOf("THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG")), @XmlEnumValue("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN")); + + + private String value; + + PolicyEnum(String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PolicyEnum fromValue(String value) { + for (PolicyEnum b : PolicyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private PolicyEnum policy; + private List roles = null; + + + /** + * The ID of the organization to share the users with. + **/ + public UserShareRequestBodyOrganizations orgId(String orgId) { + + this.orgId = orgId; + return this; + } + + @ApiModelProperty(value = "The ID of the organization to share the users with.") + @JsonProperty("orgId") + @Valid + public String getOrgId() { + return orgId; + } + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + /** + * The scope of sharing for this organization. + **/ + public UserShareRequestBodyOrganizations policy(PolicyEnum policy) { + + this.policy = policy; + return this; + } + + @ApiModelProperty(value = "The scope of sharing for this organization.") + @JsonProperty("policy") + @Valid + public PolicyEnum getPolicy() { + return policy; + } + public void setPolicy(PolicyEnum policy) { + this.policy = policy; + } + + /** + * A list of roles to be shared with the organization. + **/ + public UserShareRequestBodyOrganizations roles(List roles) { + + this.roles = roles; + return this; + } + + @ApiModelProperty(value = "A list of roles to be shared with the organization.") + @JsonProperty("roles") + @Valid + public List getRoles() { + return roles; + } + public void setRoles(List roles) { + this.roles = roles; + } + + public UserShareRequestBodyOrganizations addRolesItem(RoleWithAudience rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserShareRequestBodyOrganizations userShareRequestBodyOrganizations = (UserShareRequestBodyOrganizations) o; + return Objects.equals(this.orgId, userShareRequestBodyOrganizations.orgId) && + Objects.equals(this.policy, userShareRequestBodyOrganizations.policy) && + Objects.equals(this.roles, userShareRequestBodyOrganizations.roles); + } + + @Override + public int hashCode() { + return Objects.hash(orgId, policy, roles); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserShareRequestBodyOrganizations {\n"); + + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyUserCriteria.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyUserCriteria.java new file mode 100644 index 0000000000..224e8ae412 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyUserCriteria.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; + +/** + * Contains a list of user IDs to be shared. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Contains a list of user IDs to be shared.") +public class UserShareRequestBodyUserCriteria { + + private List userIds = null; + + + /** + * List of user IDs. + **/ + public UserShareRequestBodyUserCriteria userIds(List userIds) { + + this.userIds = userIds; + return this; + } + + @ApiModelProperty(value = "List of user IDs.") + @JsonProperty("userIds") + @Valid + public List getUserIds() { + return userIds; + } + public void setUserIds(List userIds) { + this.userIds = userIds; + } + + public UserShareRequestBodyUserCriteria addUserIdsItem(String userIdsItem) { + if (this.userIds == null) { + this.userIds = new ArrayList<>(); + } + this.userIds.add(userIdsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserShareRequestBodyUserCriteria userShareRequestBodyUserCriteria = (UserShareRequestBodyUserCriteria) o; + return Objects.equals(this.userIds, userShareRequestBodyUserCriteria.userIds); + } + + @Override + public int hashCode() { + return Objects.hash(userIds); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserShareRequestBodyUserCriteria {\n"); + + sb.append(" userIds: ").append(toIndentedString(userIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java new file mode 100644 index 0000000000..4d9614e116 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyUserCriteria; +import javax.validation.constraints.*; + +/** + * Process a request to share users with all organizations. The payload contains the roles applicable across all organizations and a policy that defines the scope of sharing. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Process a request to share users with all organizations. The payload contains the roles applicable across all organizations and a policy that defines the scope of sharing. ") +public class UserShareWithAllRequestBody { + + private UserShareRequestBodyUserCriteria userCriteria; + +@XmlType(name="PolicyEnum") +@XmlEnum(String.class) +public enum PolicyEnum { + + @XmlEnumValue("ALL EXISTING ORGS") ALL_EXISTING_ORGS(String.valueOf("ALL EXISTING ORGS")), @XmlEnumValue("ALL EXISTING ORGS AND FUTURE ORGS") ALL_EXISTING_ORGS_AND_FUTURE_ORGS(String.valueOf("ALL EXISTING ORGS AND FUTURE ORGS")), @XmlEnumValue("ONLY EXISTING IMMEDIATE ORGS") ONLY_EXISTING_IMMEDIATE_ORGS(String.valueOf("ONLY EXISTING IMMEDIATE ORGS")), @XmlEnumValue("ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS") ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS(String.valueOf("ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS")); + + + private String value; + + PolicyEnum(String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PolicyEnum fromValue(String value) { + for (PolicyEnum b : PolicyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private PolicyEnum policy; + private List roles = null; + + + /** + **/ + public UserShareWithAllRequestBody userCriteria(UserShareRequestBodyUserCriteria userCriteria) { + + this.userCriteria = userCriteria; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("userCriteria") + @Valid + public UserShareRequestBodyUserCriteria getUserCriteria() { + return userCriteria; + } + public void setUserCriteria(UserShareRequestBodyUserCriteria userCriteria) { + this.userCriteria = userCriteria; + } + + /** + * A policy to specify the sharing scope. + **/ + public UserShareWithAllRequestBody policy(PolicyEnum policy) { + + this.policy = policy; + return this; + } + + @ApiModelProperty(value = "A policy to specify the sharing scope.") + @JsonProperty("policy") + @Valid + public PolicyEnum getPolicy() { + return policy; + } + public void setPolicy(PolicyEnum policy) { + this.policy = policy; + } + + /** + * A list of roles shared across all organizations. + **/ + public UserShareWithAllRequestBody roles(List roles) { + + this.roles = roles; + return this; + } + + @ApiModelProperty(value = "A list of roles shared across all organizations.") + @JsonProperty("roles") + @Valid + public List getRoles() { + return roles; + } + public void setRoles(List roles) { + this.roles = roles; + } + + public UserShareWithAllRequestBody addRolesItem(RoleWithAudience rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserShareWithAllRequestBody userShareWithAllRequestBody = (UserShareWithAllRequestBody) o; + return Objects.equals(this.userCriteria, userShareWithAllRequestBody.userCriteria) && + Objects.equals(this.policy, userShareWithAllRequestBody.policy) && + Objects.equals(this.roles, userShareWithAllRequestBody.roles); + } + + @Override + public int hashCode() { + return Objects.hash(userCriteria, policy, roles); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserShareWithAllRequestBody {\n"); + + sb.append(" userCriteria: ").append(toIndentedString(userCriteria)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java new file mode 100644 index 0000000000..b1be62eea6 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponseLinks; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponseSharedOrganizations; +import javax.validation.constraints.*; + +/** + * Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. ") +public class UserSharedOrganizationsResponse { + + private Boolean shareWithAllOrgs; + private List links = null; + + private List sharedOrganizations = null; + + + /** + * Flag to indicate if the user is shared with all organizations. + **/ + public UserSharedOrganizationsResponse shareWithAllOrgs(Boolean shareWithAllOrgs) { + + this.shareWithAllOrgs = shareWithAllOrgs; + return this; + } + + @ApiModelProperty(example = "false", value = "Flag to indicate if the user is shared with all organizations.") + @JsonProperty("shareWithAllOrgs") + @Valid + public Boolean getShareWithAllOrgs() { + return shareWithAllOrgs; + } + public void setShareWithAllOrgs(Boolean shareWithAllOrgs) { + this.shareWithAllOrgs = shareWithAllOrgs; + } + + /** + * Pagination links for navigating the result set. + **/ + public UserSharedOrganizationsResponse links(List links) { + + this.links = links; + return this; + } + + @ApiModelProperty(value = "Pagination links for navigating the result set.") + @JsonProperty("links") + @Valid + public List getLinks() { + return links; + } + public void setLinks(List links) { + this.links = links; + } + + public UserSharedOrganizationsResponse addLinksItem(UserSharedOrganizationsResponseLinks linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * A list of shared access details for the user across multiple organizations + **/ + public UserSharedOrganizationsResponse sharedOrganizations(List sharedOrganizations) { + + this.sharedOrganizations = sharedOrganizations; + return this; + } + + @ApiModelProperty(value = "A list of shared access details for the user across multiple organizations") + @JsonProperty("sharedOrganizations") + @Valid + public List getSharedOrganizations() { + return sharedOrganizations; + } + public void setSharedOrganizations(List sharedOrganizations) { + this.sharedOrganizations = sharedOrganizations; + } + + public UserSharedOrganizationsResponse addSharedOrganizationsItem(UserSharedOrganizationsResponseSharedOrganizations sharedOrganizationsItem) { + if (this.sharedOrganizations == null) { + this.sharedOrganizations = new ArrayList<>(); + } + this.sharedOrganizations.add(sharedOrganizationsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSharedOrganizationsResponse userSharedOrganizationsResponse = (UserSharedOrganizationsResponse) o; + return Objects.equals(this.shareWithAllOrgs, userSharedOrganizationsResponse.shareWithAllOrgs) && + Objects.equals(this.links, userSharedOrganizationsResponse.links) && + Objects.equals(this.sharedOrganizations, userSharedOrganizationsResponse.sharedOrganizations); + } + + @Override + public int hashCode() { + return Objects.hash(shareWithAllOrgs, links, sharedOrganizations); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserSharedOrganizationsResponse {\n"); + + sb.append(" shareWithAllOrgs: ").append(toIndentedString(shareWithAllOrgs)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" sharedOrganizations: ").append(toIndentedString(sharedOrganizations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseLinks.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseLinks.java new file mode 100644 index 0000000000..5111d6ceef --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseLinks.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class UserSharedOrganizationsResponseLinks { + + private String href; + private String rel; + + /** + * URL to navigate to the next or previous page. + **/ + public UserSharedOrganizationsResponseLinks href(String href) { + + this.href = href; + return this; + } + + @ApiModelProperty(value = "URL to navigate to the next or previous page.") + @JsonProperty("href") + @Valid + public String getHref() { + return href; + } + public void setHref(String href) { + this.href = href; + } + + /** + * Indicates if the link is for the \"next\" or \"previous\" page. + **/ + public UserSharedOrganizationsResponseLinks rel(String rel) { + + this.rel = rel; + return this; + } + + @ApiModelProperty(value = "Indicates if the link is for the \"next\" or \"previous\" page.") + @JsonProperty("rel") + @Valid + public String getRel() { + return rel; + } + public void setRel(String rel) { + this.rel = rel; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSharedOrganizationsResponseLinks userSharedOrganizationsResponseLinks = (UserSharedOrganizationsResponseLinks) o; + return Objects.equals(this.href, userSharedOrganizationsResponseLinks.href) && + Objects.equals(this.rel, userSharedOrganizationsResponseLinks.rel); + } + + @Override + public int hashCode() { + return Objects.hash(href, rel); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserSharedOrganizationsResponseLinks {\n"); + + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append(" rel: ").append(toIndentedString(rel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java new file mode 100644 index 0000000000..e5bf8fa9da --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; + +public class UserSharedOrganizationsResponseSharedOrganizations { + + private String orgId; + private String orgName; + private String sharedUserId; + +@XmlType(name="PolicyEnum") +@XmlEnum(String.class) +public enum PolicyEnum { + + @XmlEnumValue("THIS ORG ONLY") ONLY(String.valueOf("THIS ORG ONLY")), @XmlEnumValue("THIS ORG AND ALL CHILDREN OF THIS ORG") AND_ALL_CHILDREN_OF_THIS_ORG(String.valueOf("THIS ORG AND ALL CHILDREN OF THIS ORG")), @XmlEnumValue("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN")); + + + private String value; + + PolicyEnum(String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PolicyEnum fromValue(String value) { + for (PolicyEnum b : PolicyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private PolicyEnum policy; + private String rolesRef; + + /** + * ID of the child organization + **/ + public UserSharedOrganizationsResponseSharedOrganizations orgId(String orgId) { + + this.orgId = orgId; + return this; + } + + @ApiModelProperty(example = "b028ca17-8f89-449c-ae27-fa955e66465d", value = "ID of the child organization") + @JsonProperty("orgId") + @Valid + public String getOrgId() { + return orgId; + } + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + /** + * Name of the child organization + **/ + public UserSharedOrganizationsResponseSharedOrganizations orgName(String orgName) { + + this.orgName = orgName; + return this; + } + + @ApiModelProperty(example = "Organization Name", value = "Name of the child organization") + @JsonProperty("orgName") + @Valid + public String getOrgName() { + return orgName; + } + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + /** + * ID of the shared user + **/ + public UserSharedOrganizationsResponseSharedOrganizations sharedUserId(String sharedUserId) { + + this.sharedUserId = sharedUserId; + return this; + } + + @ApiModelProperty(example = "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8", value = "ID of the shared user") + @JsonProperty("sharedUserId") + @Valid + public String getSharedUserId() { + return sharedUserId; + } + public void setSharedUserId(String sharedUserId) { + this.sharedUserId = sharedUserId; + } + + /** + * The scope of sharing for this organization. + **/ + public UserSharedOrganizationsResponseSharedOrganizations policy(PolicyEnum policy) { + + this.policy = policy; + return this; + } + + @ApiModelProperty(value = "The scope of sharing for this organization.") + @JsonProperty("policy") + @Valid + public PolicyEnum getPolicy() { + return policy; + } + public void setPolicy(PolicyEnum policy) { + this.policy = policy; + } + + /** + * URL reference to retrieve paginated roles for the shared user in this organization + **/ + public UserSharedOrganizationsResponseSharedOrganizations rolesRef(String rolesRef) { + + this.rolesRef = rolesRef; + return this; + } + + @ApiModelProperty(example = "/api/server/v1/users/{userId}/shared-roles?orgId=b028ca17-8f89-449c-ae27-fa955e66465d&after=&before=&limit=2&filter=&recursive=false", value = "URL reference to retrieve paginated roles for the shared user in this organization") + @JsonProperty("rolesRef") + @Valid + public String getRolesRef() { + return rolesRef; + } + public void setRolesRef(String rolesRef) { + this.rolesRef = rolesRef; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSharedOrganizationsResponseSharedOrganizations userSharedOrganizationsResponseSharedOrganizations = (UserSharedOrganizationsResponseSharedOrganizations) o; + return Objects.equals(this.orgId, userSharedOrganizationsResponseSharedOrganizations.orgId) && + Objects.equals(this.orgName, userSharedOrganizationsResponseSharedOrganizations.orgName) && + Objects.equals(this.sharedUserId, userSharedOrganizationsResponseSharedOrganizations.sharedUserId) && + Objects.equals(this.policy, userSharedOrganizationsResponseSharedOrganizations.policy) && + Objects.equals(this.rolesRef, userSharedOrganizationsResponseSharedOrganizations.rolesRef); + } + + @Override + public int hashCode() { + return Objects.hash(orgId, orgName, sharedUserId, policy, rolesRef); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserSharedOrganizationsResponseSharedOrganizations {\n"); + + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" sharedUserId: ").append(toIndentedString(sharedUserId)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" rolesRef: ").append(toIndentedString(rolesRef)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedRolesResponse.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedRolesResponse.java new file mode 100644 index 0000000000..1ab1b81abf --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedRolesResponse.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponseLinks; +import javax.validation.constraints.*; + +/** + * Response showing the roles assigned to a user within a specific organization, with pagination support for large role sets. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Response showing the roles assigned to a user within a specific organization, with pagination support for large role sets. ") +public class UserSharedRolesResponse { + + private List links = null; + + private List roles = null; + + + /** + * Pagination links for navigating the result set. + **/ + public UserSharedRolesResponse links(List links) { + + this.links = links; + return this; + } + + @ApiModelProperty(value = "Pagination links for navigating the result set.") + @JsonProperty("links") + @Valid + public List getLinks() { + return links; + } + public void setLinks(List links) { + this.links = links; + } + + public UserSharedRolesResponse addLinksItem(UserSharedOrganizationsResponseLinks linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * A list of roles with audience details + **/ + public UserSharedRolesResponse roles(List roles) { + + this.roles = roles; + return this; + } + + @ApiModelProperty(value = "A list of roles with audience details") + @JsonProperty("roles") + @Valid + public List getRoles() { + return roles; + } + public void setRoles(List roles) { + this.roles = roles; + } + + public UserSharedRolesResponse addRolesItem(RoleWithAudience rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSharedRolesResponse userSharedRolesResponse = (UserSharedRolesResponse) o; + return Objects.equals(this.links, userSharedRolesResponse.links) && + Objects.equals(this.roles, userSharedRolesResponse.roles); + } + + @Override + public int hashCode() { + return Objects.hash(links, roles); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserSharedRolesResponse {\n"); + + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBody.java new file mode 100644 index 0000000000..791c9dcb6b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBody.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBodyUserCriteria; +import javax.validation.constraints.*; + +/** + * The request body for unsharing users from multiple organizations. Includes a list of user IDs and a list of organization IDs. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "The request body for unsharing users from multiple organizations. Includes a list of user IDs and a list of organization IDs. ") +public class UserUnshareRequestBody { + + private UserUnshareRequestBodyUserCriteria userCriteria; + private List organizations = null; + + + /** + **/ + public UserUnshareRequestBody userCriteria(UserUnshareRequestBodyUserCriteria userCriteria) { + + this.userCriteria = userCriteria; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("userCriteria") + @Valid + public UserUnshareRequestBodyUserCriteria getUserCriteria() { + return userCriteria; + } + public void setUserCriteria(UserUnshareRequestBodyUserCriteria userCriteria) { + this.userCriteria = userCriteria; + } + + /** + * List of organization IDs from which the users should be unshared. + **/ + public UserUnshareRequestBody organizations(List organizations) { + + this.organizations = organizations; + return this; + } + + @ApiModelProperty(value = "List of organization IDs from which the users should be unshared.") + @JsonProperty("organizations") + @Valid + public List getOrganizations() { + return organizations; + } + public void setOrganizations(List organizations) { + this.organizations = organizations; + } + + public UserUnshareRequestBody addOrganizationsItem(String organizationsItem) { + if (this.organizations == null) { + this.organizations = new ArrayList<>(); + } + this.organizations.add(organizationsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserUnshareRequestBody userUnshareRequestBody = (UserUnshareRequestBody) o; + return Objects.equals(this.userCriteria, userUnshareRequestBody.userCriteria) && + Objects.equals(this.organizations, userUnshareRequestBody.organizations); + } + + @Override + public int hashCode() { + return Objects.hash(userCriteria, organizations); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserUnshareRequestBody {\n"); + + sb.append(" userCriteria: ").append(toIndentedString(userCriteria)).append("\n"); + sb.append(" organizations: ").append(toIndentedString(organizations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBodyUserCriteria.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBodyUserCriteria.java new file mode 100644 index 0000000000..e506f296e8 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareRequestBodyUserCriteria.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; + +/** + * Contains a list of user IDs to be unshared. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "Contains a list of user IDs to be unshared.") +public class UserUnshareRequestBodyUserCriteria { + + private List userIds = null; + + + /** + * List of user IDs. + **/ + public UserUnshareRequestBodyUserCriteria userIds(List userIds) { + + this.userIds = userIds; + return this; + } + + @ApiModelProperty(value = "List of user IDs.") + @JsonProperty("userIds") + @Valid + public List getUserIds() { + return userIds; + } + public void setUserIds(List userIds) { + this.userIds = userIds; + } + + public UserUnshareRequestBodyUserCriteria addUserIdsItem(String userIdsItem) { + if (this.userIds == null) { + this.userIds = new ArrayList<>(); + } + this.userIds.add(userIdsItem); + return this; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserUnshareRequestBodyUserCriteria userUnshareRequestBodyUserCriteria = (UserUnshareRequestBodyUserCriteria) o; + return Objects.equals(this.userIds, userUnshareRequestBodyUserCriteria.userIds); + } + + @Override + public int hashCode() { + return Objects.hash(userIds); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserUnshareRequestBodyUserCriteria {\n"); + + sb.append(" userIds: ").append(toIndentedString(userIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareWithAllRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareWithAllRequestBody.java new file mode 100644 index 0000000000..a6729d63de --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserUnshareWithAllRequestBody.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBodyUserCriteria; +import javax.validation.constraints.*; + +/** + * The request body for unsharing users from all organizations. Includes a list of user IDs. + **/ + +import io.swagger.annotations.*; +import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.*; +@ApiModel(description = "The request body for unsharing users from all organizations. Includes a list of user IDs. ") +public class UserUnshareWithAllRequestBody { + + private UserUnshareRequestBodyUserCriteria userCriteria; + + /** + **/ + public UserUnshareWithAllRequestBody userCriteria(UserUnshareRequestBodyUserCriteria userCriteria) { + + this.userCriteria = userCriteria; + return this; + } + + @ApiModelProperty(value = "") + @JsonProperty("userCriteria") + @Valid + public UserUnshareRequestBodyUserCriteria getUserCriteria() { + return userCriteria; + } + public void setUserCriteria(UserUnshareRequestBodyUserCriteria userCriteria) { + this.userCriteria = userCriteria; + } + + + + @Override + public boolean equals(java.lang.Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserUnshareWithAllRequestBody userUnshareWithAllRequestBody = (UserUnshareWithAllRequestBody) o; + return Objects.equals(this.userCriteria, userUnshareWithAllRequestBody.userCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(userCriteria); + } + + @Override + public String toString() { + + StringBuilder sb = new StringBuilder(); + sb.append("class UserUnshareWithAllRequestBody {\n"); + + sb.append(" userCriteria: ").append(toIndentedString(userCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n"); + } +} + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java new file mode 100644 index 0000000000..93e2f5c4b1 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -0,0 +1,5 @@ +package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core; + +public class UsersApiServiceCore { + +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java new file mode 100644 index 0000000000..69d0eefb04 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.impl; + +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.*; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.*; +import java.util.List; + +import javax.ws.rs.core.Response; + +public class UsersApiServiceImpl implements UsersApiService { + + @Override + public Response processUserSharing(UserShareRequestBody userShareRequestBody) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } + + @Override + public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } + + @Override + public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBody) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } + + @Override + public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } + + @Override + public Response usersUserIdSharedOrganizationsGet(String userId, String after, String before, Integer limit, String filter, Boolean recursive) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } + + @Override + public Response usersUserIdSharedRolesGet(String userId, String orgId, String after, String before, Integer limit, String filter, Boolean recursive) { + + // do some magic! + return Response.ok().entity("magic!").build(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml new file mode 100644 index 0000000000..81462c3020 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml new file mode 100644 index 0000000000..af23db33d5 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -0,0 +1,626 @@ +openapi: 3.0.0 +info: + version: 1.0.1 + title: 'User Share API Definition' + description: |- + This API provides organization administrators with the ability to manage user access across child organizations. It supports operations to share users with specific or all child organizations, retrieve shared access details, and remove shared access as needed. The API also includes features for paginated retrieval of organizations and roles associated with shared users. + contact: + name: WSO2 + url: 'http://wso2.com/products/identity-server/' + email: iam-dev@wso2.org + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +servers: + - url: 'https://{server-url}/t/{tenant-domain}/api/server/v1' + variables: + tenant-domain: + default: "carbon.super" + server-url: + default: "localhost:9443" + +paths: + /users/share: + post: + tags: + - User Sharing + summary: Share a user across specific organizations + description: | + This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. + + Permission required: `internal_user_shared_access_add` + operationId: processUserSharing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserShareRequestBody' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + organizations: + - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" + policy: "THIS ORG AND ALL CHILDREN OF THIS ORG" + roles: + - displayName: "role_2" + audience: + display: "My Org 1" + type: "organization" + - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" + policy: "THIS ORG ONLY" + roles: [] + required: true + responses: + '202': + description: Sharing process triggered successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessSuccessResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /users/share-with-all: + post: + tags: + - User Sharing + summary: Share a user with all organizations + description: | + This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. + + Permission required: `internal_user_shared_access_add` + operationId: processUserSharingAll + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserShareWithAllRequestBody' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + policy: "ALL EXISTING ORGS AND FUTURE ORGS" + roles: + - displayName: "role_1" + audience: + display: "My Org 1" + type: "organization" + - displayName: "role_2" + audience: + display: "My App 1" + type: "application" + required: true + responses: + '202': + description: Sharing process triggered successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessSuccessResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /users/unshare: + post: + tags: + - User Sharing + summary: Unshare a user from specific organizations + description: | + This API removes shared access for one or more users from specified organizations. + The payload includes the list of user IDs and the organizations from which the users should be unshared. + + Permission required: `internal_user_shared_access_delete` + operationId: processUserUnsharing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserUnshareRequestBody' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + organizations: + - "b028ca17-8f89-449c-ae27-fa955e66465d" + - "a17b28ca-9f89-449c-ae27-fa955e66465f" + required: true + responses: + '202': + description: Unsharing process triggered successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessSuccessResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /users/unshare-with-all: + post: + tags: + - User Sharing + summary: Remove a user's shared access + description: | + This API removes all shared access for one or more users, unsharing them from all organizations. + + Permission required: `internal_user_shared_access_delete` + operationId: removeUserSharing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserUnshareWithAllRequestBody' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + required: true + responses: + '202': + description: Share removal process triggered successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessSuccessResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /users/{userId}/shared-organizations: + get: + tags: + - User Accessible Organizations + summary: Get organizations a user has access to + description: | + This API retrieves the list of organizations where the specified user has shared access, with support for pagination and filtering. + + Permission required: `internal_user_shared_access_view` + parameters: + - in: path + name: userId + required: true + schema: + type: string + description: The ID of the user whose accessible organizations are being retrieved. + - in: query + name: after + schema: + type: string + description: The cursor pointing to the item after which the next page of results should be returned. + - in: query + name: before + schema: + type: string + description: The cursor pointing to the item before which the previous page of results should be returned. + - in: query + name: limit + schema: + type: integer + description: The maximum number of results to return per page. + - in: query + name: filter + schema: + type: string + description: A filter to apply to the results, such as by organization name or other criteria. + - in: query + name: recursive + schema: + type: boolean + default: false + description: Whether to retrieve organizations recursively, including child organizations. + responses: + '200': + description: Successful Response with Accessible Organizations + content: + application/json: + schema: + $ref: '#/components/schemas/UserSharedOrganizationsResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /users/{userId}/shared-roles: + get: + tags: + - User Accessible Roles + summary: Get roles assigned to a user in an organization + description: | + This API fetches the roles assigned to the specified user within a particular organization, with support for pagination, filtering, and recursion. + + Permission required: `internal_user_shared_access_view` + parameters: + - in: path + name: userId + required: true + schema: + type: string + description: The ID of the user for whom roles are being retrieved. + - in: query + name: orgId + required: true + schema: + type: string + description: The organization ID for which roles are being fetched. + - in: query + name: after + schema: + type: string + description: The cursor pointing to the item after which the next page of results should be returned. + - in: query + name: before + schema: + type: string + description: The cursor pointing to the item before which the previous page of results should be returned. + - in: query + name: limit + schema: + type: integer + description: The maximum number of results to return per page. + - in: query + name: filter + schema: + type: string + description: Filter to apply when retrieving the roles. + - in: query + name: recursive + schema: + type: boolean + description: Set to true to retrieve roles recursively. + responses: + '200': + description: Successful Response with Accessible Roles + content: + application/json: + schema: + $ref: '#/components/schemas/UserSharedRolesResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + +components: + schemas: + + UserShareRequestBody: + type: object + description: | + The request body for sharing users with multiple child organizations. + Includes a list of users, organizations, sharing scope as policy, and roles. + properties: + userCriteria: + type: object + description: Contains a list of user IDs to be shared. + properties: + userIds: + type: array + description: List of user IDs. + items: + type: string + description: The ID of a user to be shared. + organizations: + type: array + description: List of organizations specifying sharing scope and roles. + items: + type: object + properties: + orgId: + type: string + description: The ID of the organization to share the users with. + policy: + type: string + description: The scope of sharing for this organization. + enum: ["THIS ORG ONLY", "THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG", "THIS ORG AND ALL EXISTING AND FUTURE CHILDREN"] + roles: + type: array + description: A list of roles to be shared with the organization. + items: + $ref: '#/components/schemas/RoleWithAudience' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + organizations: + - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" + policy: "THIS ORG AND ALL CHILDREN OF THIS ORG" + roles: + - displayName: "role_2" + audience: + display: "My Org 1" + type: "organization" + - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" + policy: "THIS ORG ONLY" + roles: [] + + UserShareWithAllRequestBody: + type: object + description: | + Process a request to share users with all organizations. + The payload contains the roles applicable across all organizations and a policy that defines the scope of sharing. + properties: + userCriteria: + type: object + description: Contains a list of user IDs to be shared. + properties: + userIds: + type: array + description: List of user IDs. + items: + type: string + description: The ID of a user to be shared. + policy: + type: string + description: A policy to specify the sharing scope. + enum: ["ALL EXISTING ORGS", "ALL EXISTING ORGS AND FUTURE ORGS", "ONLY EXISTING IMMEDIATE ORGS", "ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS"] + roles: + type: array + description: A list of roles shared across all organizations. + items: + $ref: '#/components/schemas/RoleWithAudience' + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + policy: "ALL EXISTING ORGS AND FUTURE ORGS" + roles: + - displayName: "role_1" + audience: + display: "My Org 1" + type: "organization" + - displayName: "role_2" + audience: + display: "My App 1" + type: "application" + + UserUnshareRequestBody: + type: object + description: | + The request body for unsharing users from multiple organizations. + Includes a list of user IDs and a list of organization IDs. + properties: + userCriteria: + type: object + description: Contains a list of user IDs to be unshared. + properties: + userIds: + type: array + description: List of user IDs. + items: + type: string + description: The ID of a user to be unshared. + organizations: + type: array + description: List of organization IDs from which the users should be unshared. + items: + type: string + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + organizations: + - "b028ca17-8f89-449c-ae27-fa955e66465d" + - "a17b28ca-9f89-449c-ae27-fa955e66465f" + + UserUnshareWithAllRequestBody: + type: object + description: | + The request body for unsharing users from all organizations. + Includes a list of user IDs. + properties: + userCriteria: + type: object + description: Contains a list of user IDs to be unshared. + properties: + userIds: + type: array + description: List of user IDs. + items: + type: string + description: The ID of a user to be unshared. + example: + userCriteria: + userIds: + - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" + + UserSharedOrganizationsResponse: + type: object + description: | + Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. + properties: + shareWithAllOrgs: + type: boolean + description: Flag to indicate if the user is shared with all organizations. + example: false + links: + type: array + description: Pagination links for navigating the result set. + items: + type: object + properties: + href: + type: string + description: URL to navigate to the next or previous page. + rel: + type: string + description: Indicates if the link is for the "next" or "previous" page. + sharedOrganizations: + type: array + description: A list of shared access details for the user across multiple organizations + items: + type: object + properties: + orgId: + type: string + description: ID of the child organization + example: "b028ca17-8f89-449c-ae27-fa955e66465d" + orgName: + type: string + description: Name of the child organization + example: "Organization Name" + sharedUserId: + type: string + description: ID of the shared user + example: "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" + policy: + type: string + description: The scope of sharing for this organization. + enum: ["THIS ORG ONLY", "THIS ORG AND ALL CHILDREN OF THIS ORG", "THIS ORG AND ALL EXISTING AND FUTURE CHILDREN"] + rolesRef: + type: string + description: URL reference to retrieve paginated roles for the shared user in this organization + example: "/api/server/v1/users/{userId}/shared-roles?orgId=b028ca17-8f89-449c-ae27-fa955e66465d&after=&before=&limit=2&filter=&recursive=false" + + UserSharedRolesResponse: + type: object + description: | + Response showing the roles assigned to a user within a specific organization, with pagination support for large role sets. + properties: + links: + type: array + description: Pagination links for navigating the result set. + items: + type: object + properties: + href: + type: string + description: URL to navigate to the next or previous page. + rel: + type: string + description: Indicates if the link is for the "next" or "previous" page. + roles: + type: array + description: A list of roles with audience details + items: + $ref: '#/components/schemas/RoleWithAudience' + + RoleWithAudience: + type: object + description: | + Represents a user role within a specific audience (organization or application), defined by its display name and audience type. + required: + - displayName + - audience + properties: + displayName: + type: string + description: Display name of the role + example: "role_1" + audience: + type: object + required: + - display + - type + properties: + display: + type: string + description: Display name of the audience + example: "My Org 1" + type: + type: string + description: Type of the audience, e.g., 'organization' or 'application' + example: "organization" + + ProcessSuccessResponse: + type: object + description: | + Indicates that the sharing or unsharing process has started successfully, with the current status and relevant details. + properties: + status: + type: string + description: Status of the process. + example: "Processing" + details: + type: string + description: Additional information about the process. + example: "User sharing process triggered successfully." + + Error: + type: object + description: | + Details of an error, including code, message, description, and a trace ID to help with debugging. + required: + - code + - message + - traceId + properties: + code: + type: string + example: "OUI-00000" + description: An error code. + message: + type: string + example: "Some Error Message" + description: An error message. + description: + type: string + example: "Some Error Description" + description: An error description. + traceId: + type: string + format: uuid + example: "e0fbcfeb-7fc2-4b62-8b82-72d3c5fbcdeb" + description: A trace ID in UUID format to help with debugging. \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml new file mode 100644 index 0000000000..bd78163f06 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -0,0 +1,36 @@ + + + + + org.wso2.carbon.identity.server.api + identity-api-server + 1.2.246-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon.identity.api.server.organization.user.sharing.management + pom + + + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 + org.wso2.carbon.identity.api.server.organization.user.sharing.management.common + + + diff --git a/pom.xml b/pom.xml index 56a54ad225..a9e8a930b0 100644 --- a/pom.xml +++ b/pom.xml @@ -621,6 +621,26 @@ ${org.wso2.carbon.identity.organization.management.version} provided + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.user.sharing.management.common + ${project.version} + provided + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 + ${project.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.server.api org.wso2.carbon.identity.api.server.organization.selfservice.common @@ -839,7 +859,7 @@ - 1.4.52 + 1.4.53-SNAPSHOT @@ -877,6 +897,7 @@ components/org.wso2.carbon.identity.api.idle.account.identification components/org.wso2.carbon.identity.api.expired.password.identification components/org.wso2.carbon.identity.api.server.organization.user.invitation.management + components/org.wso2.carbon.identity.api.server.organization.user.sharing.management components/org.wso2.carbon.identity.api.server.api.resource components/org.wso2.carbon.identity.api.server.organization.configs components/org.wso2.carbon.identity.api.server.organization.selfservice From 81a1e5ecf260bcd09a7d697632ddd53d4c48bc4f Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 11:11:31 +0530 Subject: [PATCH 02/34] Update poms --- .../pom.xml | 2 +- .../common/UserSharingMgtServiceHolder.java | 45 ++++++------ .../UserSharingMgtOSGIServiceFactory.java | 55 ++++++++------- .../pom.xml | 68 +++++++++---------- .../pom.xml | 2 +- 5 files changed, 86 insertions(+), 86 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index 508096dfe3..af800ceccc 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -104,4 +104,4 @@ 8 UTF-8 - + \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index a76d3deddf..c8d073aae1 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -18,32 +18,33 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common; -//import org.wso2.carbon.identity.organization.user.invitation.management.InvitationCoreService; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; + /** * Holds the services which the shared user invitation management API component is using. */ public class UserSharingMgtServiceHolder { -// private static InvitationCoreService invitationCoreService; -// -// /** -// * Get Invitation Core osgi service. -// * -// * @return InvitationCoreService. -// */ -// public static InvitationCoreService getInvitationCoreService() { -// -// return invitationCoreService; -// } -// -// /** -// * Set Invitation Core osgi service. -// * -// * @param invitationCoreService InvitationCoreService. -// */ -// public static void setInvitationCoreService(InvitationCoreService invitationCoreService) { -// -// UserInvitationMgtServiceHolder.invitationCoreService = invitationCoreService; -// } + private static UserSharingPolicyHandlerService userSharingPolicyHandlerService; + + /** + * Get Invitation Core osgi service. + * + * @return InvitationCoreService. + */ + public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService() { + + return userSharingPolicyHandlerService; + } + + /** + * Set Invitation Core osgi service. + * + * @param userSharingPolicyHandlerService InvitationCoreService. + */ + public static void setInvitationCoreService(UserSharingPolicyHandlerService userSharingPolicyHandlerService) { + + UserSharingMgtServiceHolder.userSharingPolicyHandlerService = userSharingPolicyHandlerService; + } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java index 6543d55fea..a78e54541c 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java @@ -18,37 +18,36 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.factory; -//import org.springframework.beans.factory.config.AbstractFactoryBean; -//import org.wso2.carbon.context.PrivilegedCarbonContext; -//import org.wso2.carbon.identity.organization.user.sharing.UserSharingPolicyHandlerService; +import org.springframework.beans.factory.config.AbstractFactoryBean; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; /** * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to * instantiate the Invitation Core Service inside the container. */ -public class UserSharingMgtOSGIServiceFactory { - //extends AbstractFactoryBean { - -// private InvitationCoreService invitationCoreService; -// -// @Override -// public Class getObjectType() { -// -// return Object.class; -// } -// -// @Override -// protected InvitationCoreService createInstance() throws Exception { -// -// if (this.invitationCoreService == null) { -// InvitationCoreService invitationCoreService = (InvitationCoreService) -// PrivilegedCarbonContext.getThreadLocalCarbonContext() -// .getOSGiService(InvitationCoreService.class, null); -// if (invitationCoreService == null) { -// throw new Exception("Unable to retrieve InvitationCoreService."); -// } -// this.invitationCoreService = invitationCoreService; -// } -// return this.invitationCoreService; -// } +public class UserSharingMgtOSGIServiceFactory extends AbstractFactoryBean { + + private UserSharingPolicyHandlerService userSharingPolicyHandlerService; + + @Override + public Class getObjectType() { + + return Object.class; + } + + @Override + protected UserSharingPolicyHandlerService createInstance() throws Exception { + + if (this.userSharingPolicyHandlerService == null) { + UserSharingPolicyHandlerService invitationCoreService = (UserSharingPolicyHandlerService) + PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getOSGiService(UserSharingPolicyHandlerService.class, null); + if (invitationCoreService == null) { + throw new Exception("Unable to retrieve InvitationCoreService."); + } + this.userSharingPolicyHandlerService = invitationCoreService; + } + return this.userSharingPolicyHandlerService; + } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index 17b01f862c..7270022d93 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -106,39 +106,39 @@ - - org.openapitools - openapi-generator-maven-plugin - 4.1.2 - - - - generate - - - ${project.basedir}/src/main/resources/organization-user-share.yaml - org.wso2.carbon.codegen.CxfWso2Generator - - src/gen/java - org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 - org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model - org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1 - java8 - true - - . - false - - - - - - org.openapitools - cxf-wso2-openapi-generator - 1.0.0 - - - + org.codehaus.mojo build-helper-maven-plugin @@ -175,4 +175,4 @@ 8 UTF-8 - + \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml index bd78163f06..fdb7a37e30 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -33,4 +33,4 @@ org.wso2.carbon.identity.api.server.organization.user.sharing.management.common - + \ No newline at end of file From f11cd9d92684806d5b9eefd7193aa9725a645356 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 11:17:19 +0530 Subject: [PATCH 03/34] Initiate UsersApiServiceCore Implementation --- .../v1/core/UsersApiServiceCore.java | 174 +++++++++++++++++- .../v1/impl/UsersApiServiceImpl.java | 53 ++++-- 2 files changed, 208 insertions(+), 19 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 93e2f5c4b1..aa73a130de 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -1,5 +1,177 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.core; +import org.apache.commons.lang.StringUtils; +import org.wso2.carbon.identity.api.server.common.error.APIError; +import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; + +import javax.ws.rs.core.Response; + +import static javax.ws.rs.core.Response.Status.BAD_REQUEST; + +/** + * Core service class for handling user sharing management APIs. + */ public class UsersApiServiceCore { -} + /** + * Handles sharing a user across specific organizations. + * + * @param userShareRequestBody Contains details for user sharing. + */ + public void shareUser(UserShareRequestBody userShareRequestBody) { + + UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + + } + + /** + * Handles sharing a user across all organizations. + * + * @param userShareWithAllRequestBody Contains details for sharing users with all organizations. + */ + public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { + + UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + + } + + /** + * Handles unsharing a user from specific organizations. + * + * @param userUnshareRequestBody Contains details for user unsharing. + */ + public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { + + UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + + } + + /** + * Handles removing a user's shared access from all organizations. + * + * @param userUnshareWithAllRequestBody Contains details for removing shared access. + */ + public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { + + UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + + } + + /** + * Retrieves the organizations that a user has access to. + * + * @param userId The ID of the user. + * @param after The cursor for the next page. + * @param before The cursor for the previous page. + * @param limit The maximum number of results per page. + * @param filter The filter criteria. + * @param recursive Whether to include child organizations. + * @return UserSharedOrganizationsResponse containing accessible organizations. + */ + public UserSharedOrganizationsResponse getSharedOrganizations(String userId, String after, String before, + Integer limit, String filter, Boolean recursive) { + // Core logic to retrieve shared organizations + UserSharedOrganizationsResponse response = new UserSharedOrganizationsResponse(); + // Populate the response with shared organizations + return response; + } + + /** + * Retrieves the roles assigned to a user within a specified organization. + * + * @param userId The ID of the user. + * @param orgId The ID of the organization. + * @param after The cursor for the next page. + * @param before The cursor for the previous page. + * @param limit The maximum number of results per page. + * @param filter The filter criteria. + * @param recursive Whether to include child roles. + * @return UserSharedRolesResponse containing shared roles. + */ + public UserSharedRolesResponse getSharedRoles(String userId, String orgId, String after, String before, + Integer limit, String filter, Boolean recursive) { + // Core logic to retrieve shared roles for the user in the specified organization + UserSharedRolesResponse response = new UserSharedRolesResponse(); + // Populate the response with shared roles + return response; + } + + + private boolean isUnsupportedParamAvailable(Integer limit, Integer offset, String sortOrder, String sortBy) { + + if (limit != null) { + throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage + .ERROR_CODE_UNSUPPORTED_LIMIT, String.valueOf(limit)); + } + if (offset != null) { + throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage + .ERROR_CODE_UNSUPPORTED_OFFSET, String.valueOf(offset)); + } + if (StringUtils.isNotBlank(sortOrder)) { + throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage + .ERROR_CODE_UNSUPPORTED_SORT_ORDER, sortOrder); + } + if (StringUtils.isNotBlank(sortBy)) { + throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage + .ERROR_CODE_UNSUPPORTED_SORT_BY, sortBy); + } + return false; + } + + /** + * Helper method to handle exceptions. + * + * @param status HTTP status of the error. + * @param error Error message to be returned. + * @param data Additional error data. + * @return APIError object for error response. + */ + private APIError handleException(Response.Status status, UserSharingMgtConstants.ErrorMessage error, + String data) { + + return new APIError(status, getErrorBuilder(error, data).build()); + } + + private ErrorResponse.Builder getErrorBuilder(UserSharingMgtConstants.ErrorMessage errorMsg, String data) { + + return new ErrorResponse.Builder() + .withCode(errorMsg.getCode()) + .withMessage(errorMsg.getMessage()) + .withDescription(includeData(errorMsg, data)); + } + + private String includeData(UserSharingMgtConstants.ErrorMessage error, String data) { + + if (StringUtils.isNotBlank(data)) { + return String.format(error.getDescription(), data); + } + return error.getDescription(); + } + +} \ No newline at end of file diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index 69d0eefb04..511ea12d05 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -18,53 +18,70 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl; -import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.*; -import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.*; -import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core.UsersApiServiceCore; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import javax.ws.rs.core.Response; +/** + * Implementation of the user sharing management APIs. + */ public class UsersApiServiceImpl implements UsersApiService { + @Autowired + private UsersApiServiceCore usersApiServiceCore; + @Override public Response processUserSharing(UserShareRequestBody userShareRequestBody) { - // do some magic! - return Response.ok().entity("magic!").build(); + usersApiServiceCore.shareUser(userShareRequestBody); + return Response.noContent().build(); } @Override public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { - // do some magic! - return Response.ok().entity("magic!").build(); + usersApiServiceCore.shareUserWithAll(userShareWithAllRequestBody); + return Response.noContent().build(); } @Override public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBody) { - // do some magic! - return Response.ok().entity("magic!").build(); + usersApiServiceCore.unshareUser(userUnshareRequestBody); + return Response.noContent().build(); } @Override public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { - // do some magic! - return Response.ok().entity("magic!").build(); + usersApiServiceCore.unshareUserWithAll(userUnshareWithAllRequestBody); + return Response.noContent().build(); } @Override - public Response usersUserIdSharedOrganizationsGet(String userId, String after, String before, Integer limit, String filter, Boolean recursive) { + public Response usersUserIdSharedOrganizationsGet(String userId, String after, String before, Integer limit, + String filter, Boolean recursive) { - // do some magic! - return Response.ok().entity("magic!").build(); + UserSharedOrganizationsResponse response = usersApiServiceCore.getSharedOrganizations( + userId, after, before, limit, filter, recursive); + return Response.ok().entity(response).build(); } @Override - public Response usersUserIdSharedRolesGet(String userId, String orgId, String after, String before, Integer limit, String filter, Boolean recursive) { + public Response usersUserIdSharedRolesGet(String userId, String orgId, String after, String before, Integer limit, + String filter, Boolean recursive) { - // do some magic! - return Response.ok().entity("magic!").build(); + UserSharedRolesResponse response = usersApiServiceCore.getSharedRoles( + userId, orgId, after, before, limit, filter, recursive); + return Response.ok().entity(response).build(); } -} +} \ No newline at end of file From 816635411098a6f6024c08a1394d07f4a10a7505 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 11:32:18 +0530 Subject: [PATCH 04/34] Implement UsersApiServiceCore for selective share --- .../v1/core/UsersApiServiceCore.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index aa73a130de..1d756b0377 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -23,12 +23,19 @@ import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyOrganizations; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveDO; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.ws.rs.core.Response; @@ -48,6 +55,42 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + // Populate UserShareSelectiveDO object from the request body. + UserShareSelectiveDO userShareSelectiveDO = new UserShareSelectiveDO(); + + // Set user criteria. + Map> userCriteria = new HashMap<>(); + userCriteria.put("userIds", userShareRequestBody.getUserCriteria().getUserIds()); + userShareSelectiveDO.setUserCriteria(userCriteria); + + // Set organizations. + List> organizationsList = new ArrayList<>(); + for (UserShareRequestBodyOrganizations org : userShareRequestBody.getOrganizations()) { + Map orgDetails = new HashMap<>(); + orgDetails.put("orgId", org.getOrgId()); + orgDetails.put("policy", org.getPolicy().value()); + + List> rolesList = new ArrayList<>(); + if (org.getRoles() != null) { + org.getRoles().forEach(role -> { + Map roleDetails = new HashMap<>(); + roleDetails.put("displayName", role.getDisplayName()); + roleDetails.put("audienceDisplay", role.getAudience().getDisplay()); + roleDetails.put("audienceType", role.getAudience().getType()); + rolesList.add(roleDetails); + }); + } + orgDetails.put("roles", rolesList); + + organizationsList.add(orgDetails); + } + userShareSelectiveDO.setOrganizations(organizationsList); + + try { + userSharingPolicyHandlerService.propagateSelectiveShare(userShareSelectiveDO); + } catch (Exception e) { + // TODO: Handle exceptions in selective share API + } } /** From d8ce2b7715acbfc331af534cb8bffafe1a5bc97a Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 12:17:34 +0530 Subject: [PATCH 05/34] Implement UsersApiServiceCore for all types of shares and unshares --- .../v1/core/UsersApiServiceCore.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 1d756b0377..5494bee05b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -22,6 +22,7 @@ import org.wso2.carbon.identity.api.server.common.error.APIError; import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyOrganizations; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; @@ -30,7 +31,10 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareGeneralDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareGeneralDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareSelectiveDO; import java.util.ArrayList; import java.util.HashMap; @@ -102,6 +106,35 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + // Populate UserShareGeneralDO object from the request body. + UserShareGeneralDO userShareGeneralDO = new UserShareGeneralDO(); + + // Set user criteria. + Map> userCriteria = new HashMap<>(); + userCriteria.put("userIds", userShareWithAllRequestBody.getUserCriteria().getUserIds()); + userShareGeneralDO.setUserCriteria(userCriteria); + + // Set policy. + userShareGeneralDO.setPolicy(userShareWithAllRequestBody.getPolicy().value()); + + // Set roles. + List> rolesList = new ArrayList<>(); + if (userShareWithAllRequestBody.getRoles() != null) { + for (RoleWithAudience role : userShareWithAllRequestBody.getRoles()) { + Map roleDetails = new HashMap<>(); + roleDetails.put("displayName", role.getDisplayName()); + roleDetails.put("audienceDisplay", role.getAudience().getDisplay()); + roleDetails.put("audienceType", role.getAudience().getType()); + rolesList.add(roleDetails); + } + } + userShareGeneralDO.setRoles(rolesList); + + try { + userSharingPolicyHandlerService.propagateGeneralShare(userShareGeneralDO); + } catch (Exception e) { + // TODO: Handle exceptions in shareUserWithAll API + } } /** @@ -113,6 +146,22 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + // Populate UserUnshareSelectiveDO object from the request body. + UserUnshareSelectiveDO userUnshareSelectiveDO = new UserUnshareSelectiveDO(); + + // Set user criteria. + Map> userCriteria = new HashMap<>(); + userCriteria.put("userIds", userUnshareRequestBody.getUserCriteria().getUserIds()); + userUnshareSelectiveDO.setUserCriteria(userCriteria); + + // Set organizations. + userUnshareSelectiveDO.setOrganizations(userUnshareRequestBody.getOrganizations()); + + try { + userSharingPolicyHandlerService.propagateSelectiveUnshare(userUnshareSelectiveDO); + } catch (Exception e) { + // TODO: Handle exceptions in unshareUser API + } } /** @@ -124,6 +173,19 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); + // Populate UserUnshareGeneralDO object from the request body. + UserUnshareGeneralDO userUnshareGeneralDO = new UserUnshareGeneralDO(); + + // Set user criteria. + Map> userCriteria = new HashMap<>(); + userCriteria.put("userIds", userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); + userUnshareGeneralDO.setUserCriteria(userCriteria); + + try { + userSharingPolicyHandlerService.propagateGeneralUnshare(userUnshareGeneralDO); + } catch (Exception e) { + // TODO: Handle exceptions in unshareUserWithAll API + } } /** From e699962e0ac516ac48856c7f4a53e7f2ccaf7bf7 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 19:58:44 +0530 Subject: [PATCH 06/34] Set version of org-mgt to the latest release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a9e8a930b0..aefc90a7b0 100644 --- a/pom.xml +++ b/pom.xml @@ -859,7 +859,7 @@ - 1.4.53-SNAPSHOT + 1.4.52 From 96da282be678f9ba0c429bff5e4b79d05a1dc3ea Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 20:28:53 +0530 Subject: [PATCH 07/34] Set unique identifiers to the beans in user-sharing cxf.xml --- .../common/factory/UserSharingMgtOSGIServiceFactory.java | 2 +- .../META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java index a78e54541c..51c1196ce9 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java @@ -24,7 +24,7 @@ /** * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to - * instantiate the Invitation Core Service inside the container. + * instantiate the User Sharing Policy Handler Service inside the container. */ public class UserSharingMgtOSGIServiceFactory extends AbstractFactoryBean { diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml index 81462c3020..cd331e2ab7 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml @@ -24,10 +24,10 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> - - - + From a0bf83f8a19f36fae3e9766bf1d1a3114b5a9c65 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 29 Oct 2024 22:38:49 +0530 Subject: [PATCH 08/34] Change setters and getters of the UserSharingMgtOSGIServiceFactory and Holder --- .../management/common/UserSharingMgtServiceHolder.java | 3 ++- .../common/factory/UserSharingMgtOSGIServiceFactory.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index c8d073aae1..163f750bc6 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -43,7 +43,8 @@ public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService * * @param userSharingPolicyHandlerService InvitationCoreService. */ - public static void setInvitationCoreService(UserSharingPolicyHandlerService userSharingPolicyHandlerService) { + public static void setUserSharingPolicyHandlerService( + UserSharingPolicyHandlerService userSharingPolicyHandlerService) { UserSharingMgtServiceHolder.userSharingPolicyHandlerService = userSharingPolicyHandlerService; } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java index 51c1196ce9..021505396c 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java @@ -40,13 +40,13 @@ public Class getObjectType() { protected UserSharingPolicyHandlerService createInstance() throws Exception { if (this.userSharingPolicyHandlerService == null) { - UserSharingPolicyHandlerService invitationCoreService = (UserSharingPolicyHandlerService) + UserSharingPolicyHandlerService userSharingPolicyHandlerService = (UserSharingPolicyHandlerService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(UserSharingPolicyHandlerService.class, null); - if (invitationCoreService == null) { + if (userSharingPolicyHandlerService == null) { throw new Exception("Unable to retrieve InvitationCoreService."); } - this.userSharingPolicyHandlerService = invitationCoreService; + this.userSharingPolicyHandlerService = userSharingPolicyHandlerService; } return this.userSharingPolicyHandlerService; } From f74b716dd25e091d5d1800d21acdd23054568387 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Wed, 30 Oct 2024 12:51:51 +0530 Subject: [PATCH 09/34] Change policy enums with _ --- .../UserShareRequestBodyOrganizations.java | 2 +- .../v1/model/UserShareWithAllRequestBody.java | 2 +- ...anizationsResponseSharedOrganizations.java | 2 +- .../resources/organization-user-share.yaml | 23 +++++++++++-------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java index 4591192e89..2630178c67 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java @@ -41,7 +41,7 @@ public class UserShareRequestBodyOrganizations { @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("THIS ORG ONLY") ONLY(String.valueOf("THIS ORG ONLY")), @XmlEnumValue("THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG") AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG(String.valueOf("THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG")), @XmlEnumValue("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN")); + @XmlEnumValue("THIS_ORG_ONLY") ONLY(String.valueOf("THIS_ORG_ONLY")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG") AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG(String.valueOf("THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN")); private String value; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java index 4d9614e116..e57e205727 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java @@ -45,7 +45,7 @@ public class UserShareWithAllRequestBody { @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("ALL EXISTING ORGS") ALL_EXISTING_ORGS(String.valueOf("ALL EXISTING ORGS")), @XmlEnumValue("ALL EXISTING ORGS AND FUTURE ORGS") ALL_EXISTING_ORGS_AND_FUTURE_ORGS(String.valueOf("ALL EXISTING ORGS AND FUTURE ORGS")), @XmlEnumValue("ONLY EXISTING IMMEDIATE ORGS") ONLY_EXISTING_IMMEDIATE_ORGS(String.valueOf("ONLY EXISTING IMMEDIATE ORGS")), @XmlEnumValue("ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS") ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS(String.valueOf("ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS")); + @XmlEnumValue("ALL_EXISTING_ORGS") ALL_EXISTING_ORGS(String.valueOf("ALL_EXISTING_ORGS")), @XmlEnumValue("ALL_EXISTING_ORGS_AND_FUTURE_ORGS") ALL_EXISTING_ORGS_AND_FUTURE_ORGS(String.valueOf("ALL_EXISTING_ORGS_AND_FUTURE_ORGS")), @XmlEnumValue("ONLY_EXISTING_IMMEDIATE_ORGS") ONLY_EXISTING_IMMEDIATE_ORGS(String.valueOf("ONLY_EXISTING_IMMEDIATE_ORGS")), @XmlEnumValue("ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS") ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS(String.valueOf("ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS")); private String value; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java index e5bf8fa9da..05c6260ebd 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java @@ -40,7 +40,7 @@ public class UserSharedOrganizationsResponseSharedOrganizations { @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("THIS ORG ONLY") ONLY(String.valueOf("THIS ORG ONLY")), @XmlEnumValue("THIS ORG AND ALL CHILDREN OF THIS ORG") AND_ALL_CHILDREN_OF_THIS_ORG(String.valueOf("THIS ORG AND ALL CHILDREN OF THIS ORG")), @XmlEnumValue("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS ORG AND ALL EXISTING AND FUTURE CHILDREN")); + @XmlEnumValue("THIS_ORG_ONLY") ONLY(String.valueOf("THIS_ORG_ONLY")), @XmlEnumValue("THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG") AND_ALL_CHILDREN_OF_THIS_ORG(String.valueOf("THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN")); private String value; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml index af23db33d5..85682abc27 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -12,6 +12,9 @@ info: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' servers: + # Added by API Auto Mocking Plugin + - description: SwaggerHub API Auto Mocking + url: https://virtserver.swaggerhub.com/DinukaBimsaraBodaragama/user-sahred-access-API-4/1.0.1 - url: 'https://{server-url}/t/{tenant-domain}/api/server/v1' variables: tenant-domain: @@ -42,14 +45,14 @@ paths: - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" organizations: - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" - policy: "THIS ORG AND ALL CHILDREN OF THIS ORG" + policy: "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG" roles: - displayName: "role_2" audience: display: "My Org 1" type: "organization" - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" - policy: "THIS ORG ONLY" + policy: "THIS_ORG_ONLY" roles: [] required: true responses: @@ -92,7 +95,7 @@ paths: userIds: - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" - policy: "ALL EXISTING ORGS AND FUTURE ORGS" + policy: "ALL_EXISTING_ORGS_AND_FUTURE_ORGS" roles: - displayName: "role_1" audience: @@ -370,7 +373,7 @@ components: policy: type: string description: The scope of sharing for this organization. - enum: ["THIS ORG ONLY", "THIS ORG AND ALL EXISTING CHILDREN OF THIS ORG", "THIS ORG AND ALL EXISTING AND FUTURE CHILDREN"] + enum: ["THIS_ORG_ONLY", "THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG", "THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN"] roles: type: array description: A list of roles to be shared with the organization. @@ -383,14 +386,14 @@ components: - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" organizations: - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" - policy: "THIS ORG AND ALL CHILDREN OF THIS ORG" + policy: "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG" roles: - displayName: "role_2" audience: display: "My Org 1" type: "organization" - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" - policy: "THIS ORG ONLY" + policy: "THIS_ORG_ONLY" roles: [] UserShareWithAllRequestBody: @@ -412,7 +415,7 @@ components: policy: type: string description: A policy to specify the sharing scope. - enum: ["ALL EXISTING ORGS", "ALL EXISTING ORGS AND FUTURE ORGS", "ONLY EXISTING IMMEDIATE ORGS", "ONLY EXISTING IMMEDIATE ORGS AND FUTURE IMMEDIATE ORGS"] + enum: ["ALL_EXISTING_ORGS", "ALL_EXISTING_ORGS_AND_FUTURE_ORGS", "ONLY_EXISTING_IMMEDIATE_ORGS", "ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS"] roles: type: array description: A list of roles shared across all organizations. @@ -423,7 +426,7 @@ components: userIds: - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" - policy: "ALL EXISTING ORGS AND FUTURE ORGS" + policy: "ALL_EXISTING_ORGS_AND_FUTURE_ORGS" roles: - displayName: "role_1" audience: @@ -528,7 +531,7 @@ components: policy: type: string description: The scope of sharing for this organization. - enum: ["THIS ORG ONLY", "THIS ORG AND ALL CHILDREN OF THIS ORG", "THIS ORG AND ALL EXISTING AND FUTURE CHILDREN"] + enum: ["THIS_ORG_ONLY", "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG", "THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN"] rolesRef: type: string description: URL reference to retrieve paginated roles for the shared user in this organization @@ -623,4 +626,4 @@ components: type: string format: uuid example: "e0fbcfeb-7fc2-4b62-8b82-72d3c5fbcdeb" - description: A trace ID in UUID format to help with debugging. \ No newline at end of file + description: A trace ID in UUID format to help with debugging. From 7d715714c6db828d00006c168589f4da1c1045a7 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Fri, 1 Nov 2024 01:40:28 +0530 Subject: [PATCH 10/34] Add new policies --- .../UserShareRequestBodyOrganizations.java | 2 +- .../v1/model/UserShareWithAllRequestBody.java | 2 +- .../UserSharedOrganizationsResponse.java | 30 ++------------ ...anizationsResponseSharedOrganizations.java | 26 ++++++++++++- .../resources/organization-user-share.yaml | 39 +++++++++++-------- 5 files changed, 52 insertions(+), 47 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java index 2630178c67..6b9e7d6f4b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareRequestBodyOrganizations.java @@ -41,7 +41,7 @@ public class UserShareRequestBodyOrganizations { @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("THIS_ORG_ONLY") ONLY(String.valueOf("THIS_ORG_ONLY")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG") AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG(String.valueOf("THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN")); + @XmlEnumValue("SELECTED_ORG_ONLY") SELECTED_ORG_ONLY(String.valueOf("SELECTED_ORG_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY") SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN")), @XmlEnumValue("NO_ORG") NO_ORG(String.valueOf("NO_ORG")); private String value; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java index e57e205727..2d11c0c353 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserShareWithAllRequestBody.java @@ -45,7 +45,7 @@ public class UserShareWithAllRequestBody { @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("ALL_EXISTING_ORGS") ALL_EXISTING_ORGS(String.valueOf("ALL_EXISTING_ORGS")), @XmlEnumValue("ALL_EXISTING_ORGS_AND_FUTURE_ORGS") ALL_EXISTING_ORGS_AND_FUTURE_ORGS(String.valueOf("ALL_EXISTING_ORGS_AND_FUTURE_ORGS")), @XmlEnumValue("ONLY_EXISTING_IMMEDIATE_ORGS") ONLY_EXISTING_IMMEDIATE_ORGS(String.valueOf("ONLY_EXISTING_IMMEDIATE_ORGS")), @XmlEnumValue("ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS") ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS(String.valueOf("ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS")); + @XmlEnumValue("ALL_EXISTING_ORGS_ONLY") ALL_EXISTING_ORGS_ONLY(String.valueOf("ALL_EXISTING_ORGS_ONLY")), @XmlEnumValue("ALL_EXISTING_AND_FUTURE_ORGS") ALL_EXISTING_AND_FUTURE_ORGS(String.valueOf("ALL_EXISTING_AND_FUTURE_ORGS")), @XmlEnumValue("IMMEDIATE_EXISTING_ORGS_ONLY") IMMEDIATE_EXISTING_ORGS_ONLY(String.valueOf("IMMEDIATE_EXISTING_ORGS_ONLY")), @XmlEnumValue("IMMEDIATE_EXISTING_AND_FUTURE_ORGS") IMMEDIATE_EXISTING_AND_FUTURE_ORGS(String.valueOf("IMMEDIATE_EXISTING_AND_FUTURE_ORGS")); private String value; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java index b1be62eea6..7e62f8314b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponse.java @@ -29,41 +29,21 @@ import javax.validation.constraints.*; /** - * Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. + * Response listing organizations where a user has shared access, including sharing policies, shared type and pagination links for navigating results. **/ import io.swagger.annotations.*; import java.util.Objects; import javax.validation.Valid; import javax.xml.bind.annotation.*; -@ApiModel(description = "Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. ") +@ApiModel(description = "Response listing organizations where a user has shared access, including sharing policies, shared type and pagination links for navigating results. ") public class UserSharedOrganizationsResponse { - private Boolean shareWithAllOrgs; private List links = null; private List sharedOrganizations = null; - /** - * Flag to indicate if the user is shared with all organizations. - **/ - public UserSharedOrganizationsResponse shareWithAllOrgs(Boolean shareWithAllOrgs) { - - this.shareWithAllOrgs = shareWithAllOrgs; - return this; - } - - @ApiModelProperty(example = "false", value = "Flag to indicate if the user is shared with all organizations.") - @JsonProperty("shareWithAllOrgs") - @Valid - public Boolean getShareWithAllOrgs() { - return shareWithAllOrgs; - } - public void setShareWithAllOrgs(Boolean shareWithAllOrgs) { - this.shareWithAllOrgs = shareWithAllOrgs; - } - /** * Pagination links for navigating the result set. **/ @@ -130,14 +110,13 @@ public boolean equals(java.lang.Object o) { return false; } UserSharedOrganizationsResponse userSharedOrganizationsResponse = (UserSharedOrganizationsResponse) o; - return Objects.equals(this.shareWithAllOrgs, userSharedOrganizationsResponse.shareWithAllOrgs) && - Objects.equals(this.links, userSharedOrganizationsResponse.links) && + return Objects.equals(this.links, userSharedOrganizationsResponse.links) && Objects.equals(this.sharedOrganizations, userSharedOrganizationsResponse.sharedOrganizations); } @Override public int hashCode() { - return Objects.hash(shareWithAllOrgs, links, sharedOrganizations); + return Objects.hash(links, sharedOrganizations); } @Override @@ -146,7 +125,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UserSharedOrganizationsResponse {\n"); - sb.append(" shareWithAllOrgs: ").append(toIndentedString(shareWithAllOrgs)).append("\n"); sb.append(" links: ").append(toIndentedString(links)).append("\n"); sb.append(" sharedOrganizations: ").append(toIndentedString(sharedOrganizations)).append("\n"); sb.append("}"); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java index 05c6260ebd..db532ddddc 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java @@ -34,13 +34,14 @@ public class UserSharedOrganizationsResponseSharedOrganizations { private String orgId; private String orgName; + private String sharedType; private String sharedUserId; @XmlType(name="PolicyEnum") @XmlEnum(String.class) public enum PolicyEnum { - @XmlEnumValue("THIS_ORG_ONLY") ONLY(String.valueOf("THIS_ORG_ONLY")), @XmlEnumValue("THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG") AND_ALL_CHILDREN_OF_THIS_ORG(String.valueOf("THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG")), @XmlEnumValue("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN") AND_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN")); + @XmlEnumValue("SELECTED_ORG_ONLY") SELECTED_ORG_ONLY(String.valueOf("SELECTED_ORG_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY") SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN")), @XmlEnumValue("NO_ORG") NO_ORG(String.valueOf("NO_ORG")); private String value; @@ -109,6 +110,25 @@ public void setOrgName(String orgName) { this.orgName = orgName; } + /** + * Shared type of the user (pulled/pushed) + **/ + public UserSharedOrganizationsResponseSharedOrganizations sharedType(String sharedType) { + + this.sharedType = sharedType; + return this; + } + + @ApiModelProperty(example = "Pushed", value = "Shared type of the user (pulled/pushed)") + @JsonProperty("sharedType") + @Valid + public String getSharedType() { + return sharedType; + } + public void setSharedType(String sharedType) { + this.sharedType = sharedType; + } + /** * ID of the shared user **/ @@ -180,6 +200,7 @@ public boolean equals(java.lang.Object o) { UserSharedOrganizationsResponseSharedOrganizations userSharedOrganizationsResponseSharedOrganizations = (UserSharedOrganizationsResponseSharedOrganizations) o; return Objects.equals(this.orgId, userSharedOrganizationsResponseSharedOrganizations.orgId) && Objects.equals(this.orgName, userSharedOrganizationsResponseSharedOrganizations.orgName) && + Objects.equals(this.sharedType, userSharedOrganizationsResponseSharedOrganizations.sharedType) && Objects.equals(this.sharedUserId, userSharedOrganizationsResponseSharedOrganizations.sharedUserId) && Objects.equals(this.policy, userSharedOrganizationsResponseSharedOrganizations.policy) && Objects.equals(this.rolesRef, userSharedOrganizationsResponseSharedOrganizations.rolesRef); @@ -187,7 +208,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(orgId, orgName, sharedUserId, policy, rolesRef); + return Objects.hash(orgId, orgName, sharedType, sharedUserId, policy, rolesRef); } @Override @@ -198,6 +219,7 @@ public String toString() { sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" sharedType: ").append(toIndentedString(sharedType)).append("\n"); sb.append(" sharedUserId: ").append(toIndentedString(sharedUserId)).append("\n"); sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); sb.append(" rolesRef: ").append(toIndentedString(rolesRef)).append("\n"); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml index 85682abc27..618a259fb5 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -1,6 +1,6 @@ openapi: 3.0.0 info: - version: 1.0.1 + version: 1.0.2 title: 'User Share API Definition' description: |- This API provides organization administrators with the ability to manage user access across child organizations. It supports operations to share users with specific or all child organizations, retrieve shared access details, and remove shared access as needed. The API also includes features for paginated retrieval of organizations and roles associated with shared users. @@ -14,7 +14,7 @@ info: servers: # Added by API Auto Mocking Plugin - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/DinukaBimsaraBodaragama/user-sahred-access-API-4/1.0.1 + url: https://virtserver.swaggerhub.com/DinukaBimsaraBodaragama/user-sahred-access-API-4/1.0.2 - url: 'https://{server-url}/t/{tenant-domain}/api/server/v1' variables: tenant-domain: @@ -45,14 +45,14 @@ paths: - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" organizations: - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" - policy: "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG" + policy: "SELECTED_ORG_ONLY" roles: - displayName: "role_2" audience: display: "My Org 1" type: "organization" - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" - policy: "THIS_ORG_ONLY" + policy: "SELECTED_ORG_ONLY" roles: [] required: true responses: @@ -95,7 +95,7 @@ paths: userIds: - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" - policy: "ALL_EXISTING_ORGS_AND_FUTURE_ORGS" + policy: "ALL_EXISTING_ORGS_ONLY" roles: - displayName: "role_1" audience: @@ -373,7 +373,10 @@ components: policy: type: string description: The scope of sharing for this organization. - enum: ["THIS_ORG_ONLY", "THIS_ORG_AND_ALL_EXISTING_CHILDREN_OF_THIS_ORG", "THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN"] + enum: ["SELECTED_ORG_ONLY", "SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY", + "SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN", + "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY", + "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN", "NO_ORG"] roles: type: array description: A list of roles to be shared with the organization. @@ -386,14 +389,14 @@ components: - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" organizations: - orgId: "b028ca17-8f89-449c-ae27-fa955e66465d" - policy: "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG" + policy: "SELECTED_ORG_ONLY" roles: - displayName: "role_2" audience: display: "My Org 1" type: "organization" - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f" - policy: "THIS_ORG_ONLY" + policy: "SELECTED_ORG_ONLY" roles: [] UserShareWithAllRequestBody: @@ -415,7 +418,7 @@ components: policy: type: string description: A policy to specify the sharing scope. - enum: ["ALL_EXISTING_ORGS", "ALL_EXISTING_ORGS_AND_FUTURE_ORGS", "ONLY_EXISTING_IMMEDIATE_ORGS", "ONLY_EXISTING_IMMEDIATE_ORGS_AND_FUTURE_IMMEDIATE_ORGS"] + enum: ["ALL_EXISTING_ORGS_ONLY", "ALL_EXISTING_AND_FUTURE_ORGS", "IMMEDIATE_EXISTING_ORGS_ONLY", "IMMEDIATE_EXISTING_AND_FUTURE_ORGS"] roles: type: array description: A list of roles shared across all organizations. @@ -426,7 +429,7 @@ components: userIds: - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16" - policy: "ALL_EXISTING_ORGS_AND_FUTURE_ORGS" + policy: "ALL_EXISTING_ORGS_ONLY" roles: - displayName: "role_1" audience: @@ -492,12 +495,8 @@ components: UserSharedOrganizationsResponse: type: object description: | - Response listing organizations where a user has shared access, including sharing policies and pagination links for navigating results. + Response listing organizations where a user has shared access, including sharing policies, shared type and pagination links for navigating results. properties: - shareWithAllOrgs: - type: boolean - description: Flag to indicate if the user is shared with all organizations. - example: false links: type: array description: Pagination links for navigating the result set. @@ -524,6 +523,10 @@ components: type: string description: Name of the child organization example: "Organization Name" + sharedType: + type: string + description: Shared type of the user (pulled/pushed) + example: "Pushed" sharedUserId: type: string description: ID of the shared user @@ -531,7 +534,9 @@ components: policy: type: string description: The scope of sharing for this organization. - enum: ["THIS_ORG_ONLY", "THIS_ORG_AND_ALL_CHILDREN_OF_THIS_ORG", "THIS_ORG_AND_ALL_EXISTING_AND_FUTURE_CHILDREN"] + enum: ["SELECTED_ORG_ONLY", "SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY", + "SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN", + "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY", "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN", "NO_ORG"] rolesRef: type: string description: URL reference to retrieve paginated roles for the shared user in this organization @@ -626,4 +631,4 @@ components: type: string format: uuid example: "e0fbcfeb-7fc2-4b62-8b82-72d3c5fbcdeb" - description: A trace ID in UUID format to help with debugging. + description: A trace ID in UUID format to help with debugging. \ No newline at end of file From 6dda458b75dc901b4bd050110a727e5bc7c3cb55 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 2 Nov 2024 23:47:35 +0530 Subject: [PATCH 11/34] Refine UsersApiServiceCore to support new DOs in identity-org-mgt --- .../v1/core/UsersApiServiceCore.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 5494bee05b..f52c6ae208 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,8 +31,10 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareGeneralDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveOrgDetailsDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareGeneralDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareSelectiveDO; @@ -68,30 +70,30 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { userShareSelectiveDO.setUserCriteria(userCriteria); // Set organizations. - List> organizationsList = new ArrayList<>(); + List organizationsList = new ArrayList<>(); for (UserShareRequestBodyOrganizations org : userShareRequestBody.getOrganizations()) { - Map orgDetails = new HashMap<>(); - orgDetails.put("orgId", org.getOrgId()); - orgDetails.put("policy", org.getPolicy().value()); - - List> rolesList = new ArrayList<>(); - if (org.getRoles() != null) { - org.getRoles().forEach(role -> { - Map roleDetails = new HashMap<>(); - roleDetails.put("displayName", role.getDisplayName()); - roleDetails.put("audienceDisplay", role.getAudience().getDisplay()); - roleDetails.put("audienceType", role.getAudience().getType()); - rolesList.add(roleDetails); - }); + UserShareSelectiveOrgDetailsDO userShareSelectiveOrgDetailsDO = new UserShareSelectiveOrgDetailsDO(); + userShareSelectiveOrgDetailsDO.setOrganizationId(org.getOrgId()); + userShareSelectiveOrgDetailsDO.setPolicy(org.getPolicy().value()); + + List roleWithAudiences = new ArrayList<>(); + + for(RoleWithAudience role : org.getRoles()) { + RoleWithAudienceDO roleWithAudienceDO = new RoleWithAudienceDO(); + roleWithAudienceDO.setRoleName(role.getDisplayName()); + roleWithAudienceDO.setAudienceName(role.getAudience().getDisplay()); + roleWithAudienceDO.setAudienceType(role.getAudience().getType()); + roleWithAudiences.add(roleWithAudienceDO); } - orgDetails.put("roles", rolesList); - organizationsList.add(orgDetails); + userShareSelectiveOrgDetailsDO.setRoles(roleWithAudiences); + + organizationsList.add(userShareSelectiveOrgDetailsDO); } userShareSelectiveDO.setOrganizations(organizationsList); try { - userSharingPolicyHandlerService.propagateSelectiveShare(userShareSelectiveDO); + userSharingPolicyHandlerService.propagateUserSelectiveShare(userShareSelectiveDO); } catch (Exception e) { // TODO: Handle exceptions in selective share API } @@ -118,20 +120,20 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest userShareGeneralDO.setPolicy(userShareWithAllRequestBody.getPolicy().value()); // Set roles. - List> rolesList = new ArrayList<>(); + List rolesList = new ArrayList<>(); if (userShareWithAllRequestBody.getRoles() != null) { for (RoleWithAudience role : userShareWithAllRequestBody.getRoles()) { - Map roleDetails = new HashMap<>(); - roleDetails.put("displayName", role.getDisplayName()); - roleDetails.put("audienceDisplay", role.getAudience().getDisplay()); - roleDetails.put("audienceType", role.getAudience().getType()); + RoleWithAudienceDO roleDetails = new RoleWithAudienceDO(); + roleDetails.setRoleName(role.getDisplayName()); + roleDetails.setAudienceName(role.getAudience().getDisplay()); + roleDetails.setAudienceType(role.getAudience().getType()); rolesList.add(roleDetails); } } userShareGeneralDO.setRoles(rolesList); try { - userSharingPolicyHandlerService.propagateGeneralShare(userShareGeneralDO); + userSharingPolicyHandlerService.propagateUserGeneralShare(userShareGeneralDO); } catch (Exception e) { // TODO: Handle exceptions in shareUserWithAll API } @@ -158,7 +160,7 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { userUnshareSelectiveDO.setOrganizations(userUnshareRequestBody.getOrganizations()); try { - userSharingPolicyHandlerService.propagateSelectiveUnshare(userUnshareSelectiveDO); + userSharingPolicyHandlerService.propagateUserSelectiveUnshare(userUnshareSelectiveDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUser API } @@ -182,7 +184,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR userUnshareGeneralDO.setUserCriteria(userCriteria); try { - userSharingPolicyHandlerService.propagateGeneralUnshare(userUnshareGeneralDO); + userSharingPolicyHandlerService.propagateUserGeneralUnshare(userUnshareGeneralDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUserWithAll API } From 96887a1b21e740c070a8f539e3ed629729d4aa21 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Wed, 13 Nov 2024 00:22:30 +0530 Subject: [PATCH 12/34] API Support for Generic user criteria --- .../management/v1/core/UsersApiServiceCore.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index f52c6ae208..332cead906 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -37,6 +37,8 @@ import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveOrgDetailsDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareGeneralDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareSelectiveDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserCriteriaType; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserIds; import java.util.ArrayList; import java.util.HashMap; @@ -65,8 +67,9 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { UserShareSelectiveDO userShareSelectiveDO = new UserShareSelectiveDO(); // Set user criteria. - Map> userCriteria = new HashMap<>(); - userCriteria.put("userIds", userShareRequestBody.getUserCriteria().getUserIds()); + Map userCriteria = new HashMap<>(); + UserCriteriaType userIds = new UserIds(userShareRequestBody.getUserCriteria().getUserIds()); + userCriteria.put("userIds", userIds); userShareSelectiveDO.setUserCriteria(userCriteria); // Set organizations. @@ -112,8 +115,9 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest UserShareGeneralDO userShareGeneralDO = new UserShareGeneralDO(); // Set user criteria. - Map> userCriteria = new HashMap<>(); - userCriteria.put("userIds", userShareWithAllRequestBody.getUserCriteria().getUserIds()); + Map userCriteria = new HashMap<>(); + UserCriteriaType userIds = new UserIds(userShareWithAllRequestBody.getUserCriteria().getUserIds()); + userCriteria.put("userIds", userIds); userShareGeneralDO.setUserCriteria(userCriteria); // Set policy. From 0573ed2ac88144ff91d5c00c3afcbae7b1966c66 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Wed, 13 Nov 2024 11:15:51 +0530 Subject: [PATCH 13/34] Directly assign policy to PolicyEnum form API --- .../user/sharing/management/v1/core/UsersApiServiceCore.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 332cead906..83f5ef57c3 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,6 +31,7 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.constant.PolicyEnum; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareGeneralDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveDO; @@ -77,7 +78,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { for (UserShareRequestBodyOrganizations org : userShareRequestBody.getOrganizations()) { UserShareSelectiveOrgDetailsDO userShareSelectiveOrgDetailsDO = new UserShareSelectiveOrgDetailsDO(); userShareSelectiveOrgDetailsDO.setOrganizationId(org.getOrgId()); - userShareSelectiveOrgDetailsDO.setPolicy(org.getPolicy().value()); + userShareSelectiveOrgDetailsDO.setPolicy(PolicyEnum.getPolicyByValue(org.getPolicy().value())); List roleWithAudiences = new ArrayList<>(); @@ -121,7 +122,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest userShareGeneralDO.setUserCriteria(userCriteria); // Set policy. - userShareGeneralDO.setPolicy(userShareWithAllRequestBody.getPolicy().value()); + userShareGeneralDO.setPolicy(PolicyEnum.getPolicyByValue(userShareWithAllRequestBody.getPolicy().value())); // Set roles. List rolesList = new ArrayList<>(); From b1db7e9ca62b00bfb005d8203a3062287c354f64 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Fri, 15 Nov 2024 16:08:25 +0530 Subject: [PATCH 14/34] Rename the methods --- .../sharing/management/v1/core/UsersApiServiceCore.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 83f5ef57c3..5091501f78 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -97,7 +97,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { userShareSelectiveDO.setOrganizations(organizationsList); try { - userSharingPolicyHandlerService.propagateUserSelectiveShare(userShareSelectiveDO); + userSharingPolicyHandlerService.populateSelectiveUserShare(userShareSelectiveDO); } catch (Exception e) { // TODO: Handle exceptions in selective share API } @@ -138,7 +138,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest userShareGeneralDO.setRoles(rolesList); try { - userSharingPolicyHandlerService.propagateUserGeneralShare(userShareGeneralDO); + userSharingPolicyHandlerService.populateGeneralUserShare(userShareGeneralDO); } catch (Exception e) { // TODO: Handle exceptions in shareUserWithAll API } @@ -165,7 +165,7 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { userUnshareSelectiveDO.setOrganizations(userUnshareRequestBody.getOrganizations()); try { - userSharingPolicyHandlerService.propagateUserSelectiveUnshare(userUnshareSelectiveDO); + userSharingPolicyHandlerService.populateSelectiveUserUnshare(userUnshareSelectiveDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUser API } @@ -189,7 +189,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR userUnshareGeneralDO.setUserCriteria(userCriteria); try { - userSharingPolicyHandlerService.propagateUserGeneralUnshare(userUnshareGeneralDO); + userSharingPolicyHandlerService.populateGeneralUserUnshare(userUnshareGeneralDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUserWithAll API } From 5c35cafecfa77a0ad9502c65da555a4b861cd3b9 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Fri, 15 Nov 2024 17:09:28 +0530 Subject: [PATCH 15/34] Rename the modules --- .../v1/core/UsersApiServiceCore.java | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 5091501f78..b96415a279 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -33,11 +33,11 @@ import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; import org.wso2.carbon.identity.organization.management.organization.user.sharing.constant.PolicyEnum; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.RoleWithAudienceDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareGeneralDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserShareSelectiveOrgDetailsDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareGeneralDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.UserUnshareSelectiveDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserShareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareOrgDetailsDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserUnshareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserCriteriaType; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserIds; @@ -64,21 +64,21 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate UserShareSelectiveDO object from the request body. - UserShareSelectiveDO userShareSelectiveDO = new UserShareSelectiveDO(); + // Populate selectiveUserShareDO object from the request body. + SelectiveUserShareDO selectiveUserShareDO = new SelectiveUserShareDO(); // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIds(userShareRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); - userShareSelectiveDO.setUserCriteria(userCriteria); + selectiveUserShareDO.setUserCriteria(userCriteria); // Set organizations. - List organizationsList = new ArrayList<>(); + List organizationsList = new ArrayList<>(); for (UserShareRequestBodyOrganizations org : userShareRequestBody.getOrganizations()) { - UserShareSelectiveOrgDetailsDO userShareSelectiveOrgDetailsDO = new UserShareSelectiveOrgDetailsDO(); - userShareSelectiveOrgDetailsDO.setOrganizationId(org.getOrgId()); - userShareSelectiveOrgDetailsDO.setPolicy(PolicyEnum.getPolicyByValue(org.getPolicy().value())); + SelectiveUserShareOrgDetailsDO selectiveUserShareOrgDetailsDO = new SelectiveUserShareOrgDetailsDO(); + selectiveUserShareOrgDetailsDO.setOrganizationId(org.getOrgId()); + selectiveUserShareOrgDetailsDO.setPolicy(PolicyEnum.getPolicyByValue(org.getPolicy().value())); List roleWithAudiences = new ArrayList<>(); @@ -90,14 +90,14 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { roleWithAudiences.add(roleWithAudienceDO); } - userShareSelectiveOrgDetailsDO.setRoles(roleWithAudiences); + selectiveUserShareOrgDetailsDO.setRoles(roleWithAudiences); - organizationsList.add(userShareSelectiveOrgDetailsDO); + organizationsList.add(selectiveUserShareOrgDetailsDO); } - userShareSelectiveDO.setOrganizations(organizationsList); + selectiveUserShareDO.setOrganizations(organizationsList); try { - userSharingPolicyHandlerService.populateSelectiveUserShare(userShareSelectiveDO); + userSharingPolicyHandlerService.populateSelectiveUserShare(selectiveUserShareDO); } catch (Exception e) { // TODO: Handle exceptions in selective share API } @@ -112,17 +112,17 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate UserShareGeneralDO object from the request body. - UserShareGeneralDO userShareGeneralDO = new UserShareGeneralDO(); + // Populate GeneralUserShareDO object from the request body. + GeneralUserShareDO generalUserShareDO = new GeneralUserShareDO(); // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIds(userShareWithAllRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); - userShareGeneralDO.setUserCriteria(userCriteria); + generalUserShareDO.setUserCriteria(userCriteria); // Set policy. - userShareGeneralDO.setPolicy(PolicyEnum.getPolicyByValue(userShareWithAllRequestBody.getPolicy().value())); + generalUserShareDO.setPolicy(PolicyEnum.getPolicyByValue(userShareWithAllRequestBody.getPolicy().value())); // Set roles. List rolesList = new ArrayList<>(); @@ -135,10 +135,10 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest rolesList.add(roleDetails); } } - userShareGeneralDO.setRoles(rolesList); + generalUserShareDO.setRoles(rolesList); try { - userSharingPolicyHandlerService.populateGeneralUserShare(userShareGeneralDO); + userSharingPolicyHandlerService.populateGeneralUserShare(generalUserShareDO); } catch (Exception e) { // TODO: Handle exceptions in shareUserWithAll API } @@ -153,19 +153,19 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate UserUnshareSelectiveDO object from the request body. - UserUnshareSelectiveDO userUnshareSelectiveDO = new UserUnshareSelectiveDO(); + // Populate SelectiveUserUnshareDO object from the request body. + SelectiveUserUnshareDO selectiveUserUnshareDO = new SelectiveUserUnshareDO(); // Set user criteria. Map> userCriteria = new HashMap<>(); userCriteria.put("userIds", userUnshareRequestBody.getUserCriteria().getUserIds()); - userUnshareSelectiveDO.setUserCriteria(userCriteria); + selectiveUserUnshareDO.setUserCriteria(userCriteria); // Set organizations. - userUnshareSelectiveDO.setOrganizations(userUnshareRequestBody.getOrganizations()); + selectiveUserUnshareDO.setOrganizations(userUnshareRequestBody.getOrganizations()); try { - userSharingPolicyHandlerService.populateSelectiveUserUnshare(userUnshareSelectiveDO); + userSharingPolicyHandlerService.populateSelectiveUserUnshare(selectiveUserUnshareDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUser API } @@ -180,16 +180,16 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate UserUnshareGeneralDO object from the request body. - UserUnshareGeneralDO userUnshareGeneralDO = new UserUnshareGeneralDO(); + // Populate GeneralUserUnshareDO object from the request body. + GeneralUserUnshareDO generalUserUnshareDO = new GeneralUserUnshareDO(); // Set user criteria. Map> userCriteria = new HashMap<>(); userCriteria.put("userIds", userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); - userUnshareGeneralDO.setUserCriteria(userCriteria); + generalUserUnshareDO.setUserCriteria(userCriteria); try { - userSharingPolicyHandlerService.populateGeneralUserUnshare(userUnshareGeneralDO); + userSharingPolicyHandlerService.populateGeneralUserUnshare(generalUserUnshareDO); } catch (Exception e) { // TODO: Handle exceptions in unshareUserWithAll API } From 3a44a442094346be01bd2e02b5ea08a0decb406f Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Wed, 20 Nov 2024 11:18:44 +0530 Subject: [PATCH 16/34] Move PolicyEnum from user.sharing to resource.sharing --- .../pom.xml | 5 +++++ .../pom.xml | 5 +++++ .../sharing/management/v1/core/UsersApiServiceCore.java | 2 +- pom.xml | 8 +++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index af800ceccc..885fe8dd5e 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -41,6 +41,11 @@ org.wso2.carbon.identity.organization.management org.wso2.carbon.identity.organization.management.organization.user.sharing + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.resource.sharing.policy.management + provided + org.apache.cxf cxf-rt-frontend-jaxrs diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index 7270022d93..dcbd8b646c 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -103,6 +103,11 @@ org.wso2.carbon.identity.organization.management.organization.user.sharing provided + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.resource.sharing.policy.management + provided + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index b96415a279..f2fe4c6b09 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,7 +31,6 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.constant.PolicyEnum; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareDO; @@ -40,6 +39,7 @@ import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserCriteriaType; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserIds; +import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.PolicyEnum; import java.util.ArrayList; import java.util.HashMap; diff --git a/pom.xml b/pom.xml index aefc90a7b0..18da46cb7a 100644 --- a/pom.xml +++ b/pom.xml @@ -640,6 +640,12 @@ ${org.wso2.carbon.identity.organization.management.version} provided + + org.wso2.carbon.identity.organization.management + org.wso2.carbon.identity.organization.resource.sharing.policy.management + ${org.wso2.carbon.identity.organization.management.version} + provided + org.wso2.carbon.identity.server.api @@ -859,7 +865,7 @@ - 1.4.52 + 1.4.54 From b6f226b0f175496e045c45e443f35f6f6302763b Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Wed, 20 Nov 2024 11:41:47 +0530 Subject: [PATCH 17/34] Adapt to renaming of userCriteria to usercriteria --- .../user/sharing/management/v1/core/UsersApiServiceCore.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index f2fe4c6b09..9463d201fa 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -37,8 +37,8 @@ import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareOrgDetailsDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserUnshareDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserCriteriaType; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.userCriteria.UserIds; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserCriteriaType; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserIds; import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.PolicyEnum; import java.util.ArrayList; From 76098e004e57bce87db8385eb5eea7859053c518 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Tue, 14 Jan 2025 19:30:10 +0530 Subject: [PATCH 18/34] Add usercriteria to unshare --- .../v1/core/UsersApiServiceCore.java | 22 ++++++++++--------- pom.xml | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 9463d201fa..cdde51a088 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,12 +31,12 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.RoleWithAudienceDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserShareDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserShareOrgDetailsDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.GeneralUserUnshareDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.SelectiveUserUnshareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareOrgDetailsDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserCriteriaType; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserIds; import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.PolicyEnum; @@ -157,8 +157,9 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { SelectiveUserUnshareDO selectiveUserUnshareDO = new SelectiveUserUnshareDO(); // Set user criteria. - Map> userCriteria = new HashMap<>(); - userCriteria.put("userIds", userUnshareRequestBody.getUserCriteria().getUserIds()); + Map userCriteria = new HashMap<>(); + UserCriteriaType userIds = new UserIds(userUnshareRequestBody.getUserCriteria().getUserIds()); + userCriteria.put("userIds", userIds); selectiveUserUnshareDO.setUserCriteria(userCriteria); // Set organizations. @@ -184,8 +185,9 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR GeneralUserUnshareDO generalUserUnshareDO = new GeneralUserUnshareDO(); // Set user criteria. - Map> userCriteria = new HashMap<>(); - userCriteria.put("userIds", userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); + Map userCriteria = new HashMap<>(); + UserCriteriaType userIds = new UserIds(userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); + userCriteria.put("userIds", userIds); generalUserUnshareDO.setUserCriteria(userCriteria); try { diff --git a/pom.xml b/pom.xml index 18da46cb7a..51587a1dac 100644 --- a/pom.xml +++ b/pom.xml @@ -865,7 +865,7 @@ - 1.4.54 + 1.4.66 From 824b0c6180f05cee037f61bf76c99d21d90909b5 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 25 Jan 2025 17:03:58 +0530 Subject: [PATCH 19/34] rename userIds to userIdList. --- .../management/v1/core/UsersApiServiceCore.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index cdde51a088..a2e4a4ad43 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -38,7 +38,7 @@ import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserCriteriaType; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserIds; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserIdList; import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.PolicyEnum; import java.util.ArrayList; @@ -69,7 +69,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { // Set user criteria. Map userCriteria = new HashMap<>(); - UserCriteriaType userIds = new UserIds(userShareRequestBody.getUserCriteria().getUserIds()); + UserCriteriaType userIds = new UserIdList(userShareRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); selectiveUserShareDO.setUserCriteria(userCriteria); @@ -117,7 +117,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest // Set user criteria. Map userCriteria = new HashMap<>(); - UserCriteriaType userIds = new UserIds(userShareWithAllRequestBody.getUserCriteria().getUserIds()); + UserCriteriaType userIds = new UserIdList(userShareWithAllRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); generalUserShareDO.setUserCriteria(userCriteria); @@ -158,7 +158,7 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { // Set user criteria. Map userCriteria = new HashMap<>(); - UserCriteriaType userIds = new UserIds(userUnshareRequestBody.getUserCriteria().getUserIds()); + UserCriteriaType userIds = new UserIdList(userUnshareRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); selectiveUserUnshareDO.setUserCriteria(userCriteria); @@ -186,7 +186,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR // Set user criteria. Map userCriteria = new HashMap<>(); - UserCriteriaType userIds = new UserIds(userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); + UserCriteriaType userIds = new UserIdList(userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); userCriteria.put("userIds", userIds); generalUserUnshareDO.setUserCriteria(userCriteria); From 51f83fa3f67d4e5acc9b19934826e12f43732732 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 25 Jan 2025 17:10:33 +0530 Subject: [PATCH 20/34] update licence and pom versions. --- .../pom.xml | 4 ++-- .../sharing/management/common/UserSharingMgtConstants.java | 2 +- .../management/common/UserSharingMgtServiceHolder.java | 2 +- .../common/factory/UserSharingMgtOSGIServiceFactory.java | 2 +- .../pom.xml | 4 ++-- .../organization/user/sharing/management/v1/UsersApi.java | 2 +- .../user/sharing/management/v1/UsersApiService.java | 2 +- .../management/v1/factories/UsersApiServiceFactory.java | 2 +- .../organization/user/sharing/management/v1/model/Error.java | 2 +- .../sharing/management/v1/model/ProcessSuccessResponse.java | 2 +- .../user/sharing/management/v1/model/RoleWithAudience.java | 2 +- .../sharing/management/v1/model/RoleWithAudienceAudience.java | 2 +- .../sharing/management/v1/model/UserShareRequestBody.java | 2 +- .../v1/model/UserShareRequestBodyOrganizations.java | 2 +- .../management/v1/model/UserShareRequestBodyUserCriteria.java | 2 +- .../management/v1/model/UserShareWithAllRequestBody.java | 2 +- .../management/v1/model/UserSharedOrganizationsResponse.java | 2 +- .../v1/model/UserSharedOrganizationsResponseLinks.java | 2 +- .../UserSharedOrganizationsResponseSharedOrganizations.java | 2 +- .../sharing/management/v1/model/UserSharedRolesResponse.java | 2 +- .../sharing/management/v1/model/UserUnshareRequestBody.java | 2 +- .../v1/model/UserUnshareRequestBodyUserCriteria.java | 2 +- .../management/v1/model/UserUnshareWithAllRequestBody.java | 2 +- .../user/sharing/management/v1/core/UsersApiServiceCore.java | 2 +- .../user/sharing/management/v1/impl/UsersApiServiceImpl.java | 2 +- .../META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml | 2 +- .../pom.xml | 4 ++-- pom.xml | 4 ++-- 28 files changed, 32 insertions(+), 32 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index 885fe8dd5e..4b5c4319d7 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -1,6 +1,6 @@ - 1.1.12 + 1.1.20 [1.0.0, 2.0.0) - 1.4.66 + 1.4.71-SNAPSHOT From cabd548d446c83c21e70c8e955aabd33265c32a0 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 25 Jan 2025 17:28:20 +0530 Subject: [PATCH 21/34] address comments. --- .../pom.xml | 10 +--------- .../common/UserSharingMgtConstants.java | 6 ++++-- .../common/UserSharingMgtServiceHolder.java | 8 ++++---- .../pom.xml | 2 +- .../management/v1/core/UsersApiServiceCore.java | 13 +++++++------ .../management/v1/impl/UsersApiServiceImpl.java | 2 +- .../main/resources/organization-user-share.yaml | 16 ++++++---------- .../pom.xml | 2 +- 8 files changed, 25 insertions(+), 34 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index 4b5c4319d7..8ca83fe324 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -29,14 +29,6 @@ jar - - org.wso2.carbon.multitenancy - org.wso2.carbon.tenant.mgt - - - org.wso2.carbon.extension.identity.verification - org.wso2.carbon.extension.identity.verification.provider - org.wso2.carbon.identity.organization.management org.wso2.carbon.identity.organization.management.organization.user.sharing @@ -109,4 +101,4 @@ 8 UTF-8 - \ No newline at end of file + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java index 1e6bff557c..d509718e06 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java @@ -23,9 +23,11 @@ */ public class UserSharingMgtConstants { - public static final String ERROR_PREFIX = "OUI-"; + public static final String ERROR_PREFIX = "USM-"; public static final String ERROR_FAIL_STATUS = "Failed"; + public static final String USER_IDS = "userIds"; + /** * Enum for shared user invitation management related errors. * Error Code - code to identify the error. @@ -83,7 +85,7 @@ public enum ErrorMessage { ERROR_CODE_INVALID_USER_INFORMATION("60014", "Unable to create an invitation to all the users given in the list.", "User invitation creation failed for the users: %s"), - ERROR_CODE_INVALID_GROUP("60014", + ERROR_CODE_INVALID_GROUP("60015", "Invalid group list provided.", "The provided group lists are not valid."), diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index 2bfca9e97e..f3ea6fff3a 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -29,9 +29,9 @@ public class UserSharingMgtServiceHolder { private static UserSharingPolicyHandlerService userSharingPolicyHandlerService; /** - * Get Invitation Core osgi service. + * Get User Sharing Policy Handler Service. * - * @return InvitationCoreService. + * @return UserSharingPolicyHandlerService. */ public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService() { @@ -39,9 +39,9 @@ public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService } /** - * Set Invitation Core osgi service. + * Set User Sharing Policy Handler Service. * - * @param userSharingPolicyHandlerService InvitationCoreService. + * @param userSharingPolicyHandlerService UserSharingPolicyHandlerService. */ public static void setUserSharingPolicyHandlerService( UserSharingPolicyHandlerService userSharingPolicyHandlerService) { diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index 9a0e50130f..d4dabbe83e 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -180,4 +180,4 @@ 8 UTF-8 - \ No newline at end of file + diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index b1f3b2ac1b..cf45ef461b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -48,6 +48,8 @@ import javax.ws.rs.core.Response; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.USER_IDS; + import static javax.ws.rs.core.Response.Status.BAD_REQUEST; /** @@ -70,7 +72,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIdList(userShareRequestBody.getUserCriteria().getUserIds()); - userCriteria.put("userIds", userIds); + userCriteria.put(USER_IDS, userIds); selectiveUserShareDO.setUserCriteria(userCriteria); // Set organizations. @@ -118,7 +120,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIdList(userShareWithAllRequestBody.getUserCriteria().getUserIds()); - userCriteria.put("userIds", userIds); + userCriteria.put(USER_IDS, userIds); generalUserShareDO.setUserCriteria(userCriteria); // Set policy. @@ -159,7 +161,7 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIdList(userUnshareRequestBody.getUserCriteria().getUserIds()); - userCriteria.put("userIds", userIds); + userCriteria.put(USER_IDS, userIds); selectiveUserUnshareDO.setUserCriteria(userCriteria); // Set organizations. @@ -187,7 +189,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR // Set user criteria. Map userCriteria = new HashMap<>(); UserCriteriaType userIds = new UserIdList(userUnshareWithAllRequestBody.getUserCriteria().getUserIds()); - userCriteria.put("userIds", userIds); + userCriteria.put(USER_IDS, userIds); generalUserUnshareDO.setUserCriteria(userCriteria); try { @@ -287,5 +289,4 @@ private String includeData(UserSharingMgtConstants.ErrorMessage error, String da } return error.getDescription(); } - -} \ No newline at end of file +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index 8116fbf0bf..25ef923ddc 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -84,4 +84,4 @@ public Response usersUserIdSharedRolesGet(String userId, String orgId, String af userId, orgId, after, before, limit, filter, recursive); return Response.ok().entity(response).build(); } -} \ No newline at end of file +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml index 618a259fb5..f64ad2eda5 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -12,16 +12,12 @@ info: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' servers: - # Added by API Auto Mocking Plugin - - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/DinukaBimsaraBodaragama/user-sahred-access-API-4/1.0.2 - url: 'https://{server-url}/t/{tenant-domain}/api/server/v1' variables: tenant-domain: default: "carbon.super" server-url: default: "localhost:9443" - paths: /users/share: post: @@ -31,7 +27,7 @@ paths: description: | This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. - Permission required: `internal_user_shared_access_add` + Scope(Permission) required: `internal_user_shared_access_add` operationId: processUserSharing requestBody: content: @@ -83,7 +79,7 @@ paths: description: | This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. - Permission required: `internal_user_shared_access_add` + Scope(Permission) required: `internal_user_shared_access_add` operationId: processUserSharingAll requestBody: content: @@ -135,7 +131,7 @@ paths: This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. - Permission required: `internal_user_shared_access_delete` + Scope(Permission) required: `internal_user_shared_access_delete` operationId: processUserUnsharing requestBody: content: @@ -179,7 +175,7 @@ paths: description: | This API removes all shared access for one or more users, unsharing them from all organizations. - Permission required: `internal_user_shared_access_delete` + Scope(Permission) required: `internal_user_shared_access_delete` operationId: removeUserSharing requestBody: content: @@ -220,7 +216,7 @@ paths: description: | This API retrieves the list of organizations where the specified user has shared access, with support for pagination and filtering. - Permission required: `internal_user_shared_access_view` + Scope(Permission) required: `internal_user_shared_access_view` parameters: - in: path name: userId @@ -282,7 +278,7 @@ paths: description: | This API fetches the roles assigned to the specified user within a particular organization, with support for pagination, filtering, and recursion. - Permission required: `internal_user_shared_access_view` + Scope(Permission) required: `internal_user_shared_access_view` parameters: - in: path name: userId diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml index 8cf23d15f8..94b8175799 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -33,4 +33,4 @@ org.wso2.carbon.identity.api.server.organization.user.sharing.management.common - \ No newline at end of file + From 1d9eb5014cde0ae48c458b5ac19c8bead0346c16 Mon Sep 17 00:00:00 2001 From: sahandilshan Date: Sat, 25 Jan 2025 18:30:50 +0530 Subject: [PATCH 22/34] Remove Spring --- .../common/UserSharingMgtServiceHolder.java | 27 +++++----- .../UserSharingMgtOSGIServiceFactory.java | 53 ------------------- .../pom.xml | 10 ---- .../user/sharing/management/v1/UsersApi.java | 10 ++-- .../v1/factories/UsersApiServiceFactory.java | 16 ++++-- .../v1/core/UsersApiServiceCore.java | 16 +++--- .../factories/UsersApiServiceCoreFactory.java | 50 +++++++++++++++++ .../v1/impl/UsersApiServiceImpl.java | 14 +++-- .../organization-user-sharing-mgt-v1-cxf.xml | 33 ------------ 9 files changed, 101 insertions(+), 128 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java delete mode 100644 components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index f3ea6fff3a..7217bd47f4 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -18,6 +18,7 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; @@ -26,26 +27,24 @@ */ public class UserSharingMgtServiceHolder { - private static UserSharingPolicyHandlerService userSharingPolicyHandlerService; + private UserSharingMgtServiceHolder() { - /** - * Get User Sharing Policy Handler Service. - * - * @return UserSharingPolicyHandlerService. - */ - public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService() { - - return userSharingPolicyHandlerService; } + private static class UserSharingPolicyHandlerServiceHolder { + + private static final UserSharingPolicyHandlerService SERVICE = (UserSharingPolicyHandlerService) + PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getOSGiService(UserSharingPolicyHandlerService.class, null); + } + /** - * Set User Sharing Policy Handler Service. + * Get UserSharingPolicyHandlerService OSGi service. * - * @param userSharingPolicyHandlerService UserSharingPolicyHandlerService. + * @return UserSharingPolicyHandlerService. */ - public static void setUserSharingPolicyHandlerService( - UserSharingPolicyHandlerService userSharingPolicyHandlerService) { + public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService() { - UserSharingMgtServiceHolder.userSharingPolicyHandlerService = userSharingPolicyHandlerService; + return UserSharingMgtServiceHolder.UserSharingPolicyHandlerServiceHolder.SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java deleted file mode 100644 index 14abb806e4..0000000000 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/factory/UserSharingMgtOSGIServiceFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you 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.organization.user.sharing.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.UserSharingPolicyHandlerService; - -/** - * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to - * instantiate the User Sharing Policy Handler Service inside the container. - */ -public class UserSharingMgtOSGIServiceFactory extends AbstractFactoryBean { - - private UserSharingPolicyHandlerService userSharingPolicyHandlerService; - - @Override - public Class getObjectType() { - - return Object.class; - } - - @Override - protected UserSharingPolicyHandlerService createInstance() throws Exception { - - if (this.userSharingPolicyHandlerService == null) { - UserSharingPolicyHandlerService userSharingPolicyHandlerService = (UserSharingPolicyHandlerService) - PrivilegedCarbonContext.getThreadLocalCarbonContext() - .getOSGiService(UserSharingPolicyHandlerService.class, null); - if (userSharingPolicyHandlerService == null) { - throw new Exception("Unable to retrieve InvitationCoreService."); - } - this.userSharingPolicyHandlerService = userSharingPolicyHandlerService; - } - return this.userSharingPolicyHandlerService; - } -} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index d4dabbe83e..7d9327ee63 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -34,16 +34,6 @@ javax.ws.rs-api provided - - org.springframework - spring-web - provided - - - org.springframework - spring-beans - provided - com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java index f36d5df0c3..d2801a60c5 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java @@ -18,12 +18,12 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1; -import org.springframework.beans.factory.annotation.Autowired; import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Multipart; import java.io.InputStream; import java.util.List; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.factories.UsersApiServiceFactory; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.Error; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; @@ -46,8 +46,12 @@ public class UsersApi { - @Autowired - private UsersApiService delegate; + private final UsersApiService delegate; + + public UsersApi() { + + this.delegate = UsersApiServiceFactory.getUsersApi(); + } @Valid @POST diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java index 588e0a4914..2060fb16ed 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java @@ -21,12 +21,20 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl.UsersApiServiceImpl; +/** + * Factory class for UsersApiService. + */ public class UsersApiServiceFactory { - private final static UsersApiService service = new UsersApiServiceImpl(); + private final static UsersApiService SERVICE = new UsersApiServiceImpl(); + + /** + * Get UsersApiService. + * + * @return UsersApiService. + */ + public static UsersApiService getUsersApi() { - public static UsersApiService getUsersApi() - { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index cf45ef461b..934b715da5 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -30,6 +30,7 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; @@ -57,6 +58,13 @@ */ public class UsersApiServiceCore { + private final UserSharingPolicyHandlerService userSharingPolicyHandlerService; + + public UsersApiServiceCore(UserSharingPolicyHandlerService userSharingPolicyHandlerService) { + + this.userSharingPolicyHandlerService = userSharingPolicyHandlerService; + } + /** * Handles sharing a user across specific organizations. * @@ -64,8 +72,6 @@ public class UsersApiServiceCore { */ public void shareUser(UserShareRequestBody userShareRequestBody) { - UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate selectiveUserShareDO object from the request body. SelectiveUserShareDO selectiveUserShareDO = new SelectiveUserShareDO(); @@ -112,8 +118,6 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { */ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { - UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate GeneralUserShareDO object from the request body. GeneralUserShareDO generalUserShareDO = new GeneralUserShareDO(); @@ -153,8 +157,6 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest */ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { - UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate SelectiveUserUnshareDO object from the request body. SelectiveUserUnshareDO selectiveUserUnshareDO = new SelectiveUserUnshareDO(); @@ -181,8 +183,6 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { */ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { - UserSharingPolicyHandlerServiceImpl userSharingPolicyHandlerService = new UserSharingPolicyHandlerServiceImpl(); - // Populate GeneralUserUnshareDO object from the request body. GeneralUserUnshareDO generalUserUnshareDO = new GeneralUserUnshareDO(); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java new file mode 100644 index 0000000000..5d852d66a4 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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.organization.user.sharing.management.v1.factories; + +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtServiceHolder; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core.UsersApiServiceCore; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; + +/** + * Factory class for UsersApiService. + */ +public class UsersApiServiceCoreFactory { + + private final static UsersApiServiceCore SERVICE; + + static { + UserSharingPolicyHandlerService userSharingPolicyHandlerService = UserSharingMgtServiceHolder + .getUserSharingPolicyHandlerService(); + if (userSharingPolicyHandlerService == null) { + throw new IllegalStateException("UserSharingPolicyHandlerService is not available from the OSGi context."); + } + SERVICE = new UsersApiServiceCore(userSharingPolicyHandlerService); + } + + /** + * Get UsersApiServiceCore. + * + * @return UsersApiServiceCore. + */ + public static UsersApiServiceCore getUsersApiServiceCore() { + + return SERVICE; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index 25ef923ddc..0c8ca25f96 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -19,9 +19,9 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl; -import org.springframework.beans.factory.annotation.Autowired; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core.UsersApiServiceCore; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.factories.UsersApiServiceCoreFactory; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; @@ -36,8 +36,16 @@ */ public class UsersApiServiceImpl implements UsersApiService { - @Autowired - private UsersApiServiceCore usersApiServiceCore; + private final UsersApiServiceCore usersApiServiceCore; + + public UsersApiServiceImpl() { + + try { + this.usersApiServiceCore = UsersApiServiceCoreFactory.getUsersApiServiceCore(); + } catch (IllegalStateException e) { + throw new RuntimeException("Error occurred while initiating ServerUserStoreService.", e); + } + } @Override public Response processUserSharing(UserShareRequestBody userShareRequestBody) { diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml deleted file mode 100644 index 349dccb12d..0000000000 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/META-INF/cxf/organization-user-sharing-mgt-v1-cxf.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - From e7646da879ff7541c8c3be6a01be154a126fe966 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 25 Jan 2025 18:58:17 +0530 Subject: [PATCH 23/34] format. --- .../management/common/UserSharingMgtConstants.java | 14 +++++++------- .../common/UserSharingMgtServiceHolder.java | 4 ++-- .../management/v1/core/UsersApiServiceCore.java | 1 - 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java index d509718e06..b84af71e3b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java @@ -19,17 +19,17 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common; /** - * Holds the constants which the shared user invitation management API component is using. + * Holds the constants which the user sharing management API component is using. */ public class UserSharingMgtConstants { public static final String ERROR_PREFIX = "USM-"; - public static final String ERROR_FAIL_STATUS = "Failed"; + public static final String ERROR_UNSUPPORTED_PARAM = "Unsupported param."; public static final String USER_IDS = "userIds"; /** - * Enum for shared user invitation management related errors. + * Enum for user sharing management related errors. * Error Code - code to identify the error. * Error Message - What went wrong. * Error Description - Why it went wrong. @@ -50,16 +50,16 @@ public enum ErrorMessage { "Unable to create the invitation.", "Multiple invitations found for users given in the list %s."), ERROR_CODE_UNSUPPORTED_LIMIT("60004", - "Unsupported param.", + ERROR_UNSUPPORTED_PARAM, "Limit param is not supported yet."), ERROR_CODE_UNSUPPORTED_OFFSET("60005", - "Unsupported param.", + ERROR_UNSUPPORTED_PARAM, "Offset param is not supported yet."), ERROR_CODE_UNSUPPORTED_SORT_ORDER("60006", - "Unsupported param.", + ERROR_UNSUPPORTED_PARAM, "Sort order param is not supported yet."), ERROR_CODE_UNSUPPORTED_SORT_BY("60007", - "Unsupported param.", + ERROR_UNSUPPORTED_PARAM, "Sort order param is not supported yet."), ERROR_CODE_ACTIVE_INVITATION_AVAILABLE("60008", "Invitation already exists.", diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index 7217bd47f4..89f93a0403 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -23,7 +23,7 @@ /** - * Holds the services which the shared user invitation management API component is using. + * Holds the services which the shared user sharing management API component is using. */ public class UserSharingMgtServiceHolder { @@ -39,7 +39,7 @@ private static class UserSharingPolicyHandlerServiceHolder { } /** - * Get UserSharingPolicyHandlerService OSGi service. + * Get UserSharingPolicyHandlerService service. * * @return UserSharingPolicyHandlerService. */ diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 934b715da5..8dad545f66 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,7 +31,6 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerServiceImpl; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareDO; From f8720c13b0954e80de7eba3961eb44b36e2c7c73 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sat, 25 Jan 2025 22:06:40 +0530 Subject: [PATCH 24/34] return response. --- .../common/UserSharingMgtConstants.java | 3 + .../v1/core/UsersApiServiceCore.java | 47 +++++------ .../v1/impl/UsersApiServiceImpl.java | 80 +++++++++++++++---- 3 files changed, 89 insertions(+), 41 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java index b84af71e3b..04b800e410 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java @@ -28,6 +28,9 @@ public class UserSharingMgtConstants { public static final String USER_IDS = "userIds"; + public static final String RESPONSE_STATUS_PROCESSING = "Processing"; + public static final String RESPONSE_DETAIL_USER_SHARE = "User sharing process triggered successfully."; + /** * Enum for user sharing management related errors. * Error Code - code to identify the error. diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 8dad545f66..b780c3dd95 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -22,6 +22,7 @@ import org.wso2.carbon.identity.api.server.common.error.APIError; import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyOrganizations; @@ -31,6 +32,7 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareDO; @@ -69,7 +71,7 @@ public UsersApiServiceCore(UserSharingPolicyHandlerService userSharingPolicyHand * * @param userShareRequestBody Contains details for user sharing. */ - public void shareUser(UserShareRequestBody userShareRequestBody) { + public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShareMgtException { // Populate selectiveUserShareDO object from the request body. SelectiveUserShareDO selectiveUserShareDO = new SelectiveUserShareDO(); @@ -103,11 +105,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { } selectiveUserShareDO.setOrganizations(organizationsList); - try { - userSharingPolicyHandlerService.populateSelectiveUserShare(selectiveUserShareDO); - } catch (Exception e) { - // TODO: Handle exceptions in selective share API - } + userSharingPolicyHandlerService.populateSelectiveUserShare(selectiveUserShareDO); } /** @@ -115,7 +113,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) { * * @param userShareWithAllRequestBody Contains details for sharing users with all organizations. */ - public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { + public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) throws UserShareMgtException { // Populate GeneralUserShareDO object from the request body. GeneralUserShareDO generalUserShareDO = new GeneralUserShareDO(); @@ -142,11 +140,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest } generalUserShareDO.setRoles(rolesList); - try { - userSharingPolicyHandlerService.populateGeneralUserShare(generalUserShareDO); - } catch (Exception e) { - // TODO: Handle exceptions in shareUserWithAll API - } + userSharingPolicyHandlerService.populateGeneralUserShare(generalUserShareDO); } /** @@ -154,7 +148,7 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest * * @param userUnshareRequestBody Contains details for user unsharing. */ - public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { + public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws UserShareMgtException { // Populate SelectiveUserUnshareDO object from the request body. SelectiveUserUnshareDO selectiveUserUnshareDO = new SelectiveUserUnshareDO(); @@ -168,11 +162,7 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { // Set organizations. selectiveUserUnshareDO.setOrganizations(userUnshareRequestBody.getOrganizations()); - try { - userSharingPolicyHandlerService.populateSelectiveUserUnshare(selectiveUserUnshareDO); - } catch (Exception e) { - // TODO: Handle exceptions in unshareUser API - } + userSharingPolicyHandlerService.populateSelectiveUserUnshare(selectiveUserUnshareDO); } /** @@ -180,7 +170,8 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) { * * @param userUnshareWithAllRequestBody Contains details for removing shared access. */ - public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { + public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) + throws UserShareMgtException { // Populate GeneralUserUnshareDO object from the request body. GeneralUserUnshareDO generalUserUnshareDO = new GeneralUserUnshareDO(); @@ -191,11 +182,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR userCriteria.put(USER_IDS, userIds); generalUserUnshareDO.setUserCriteria(userCriteria); - try { - userSharingPolicyHandlerService.populateGeneralUserUnshare(generalUserUnshareDO); - } catch (Exception e) { - // TODO: Handle exceptions in unshareUserWithAll API - } + userSharingPolicyHandlerService.populateGeneralUserUnshare(generalUserUnshareDO); } /** @@ -210,7 +197,7 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR * @return UserSharedOrganizationsResponse containing accessible organizations. */ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, String after, String before, - Integer limit, String filter, Boolean recursive) { + Integer limit, String filter, Boolean recursive) throws UserShareMgtException { // Core logic to retrieve shared organizations UserSharedOrganizationsResponse response = new UserSharedOrganizationsResponse(); // Populate the response with shared organizations @@ -230,7 +217,7 @@ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, Str * @return UserSharedRolesResponse containing shared roles. */ public UserSharedRolesResponse getSharedRoles(String userId, String orgId, String after, String before, - Integer limit, String filter, Boolean recursive) { + Integer limit, String filter, Boolean recursive) throws UserShareMgtException { // Core logic to retrieve shared roles for the user in the specified organization UserSharedRolesResponse response = new UserSharedRolesResponse(); // Populate the response with shared roles @@ -288,4 +275,12 @@ private String includeData(UserSharingMgtConstants.ErrorMessage error, String da } return error.getDescription(); } + + public ProcessSuccessResponse getProcessSuccessResponse(String status, String details) { + + ProcessSuccessResponse processSuccessResponse = new ProcessSuccessResponse(); + processSuccessResponse.status(status); + processSuccessResponse.setDetails(details); + return processSuccessResponse; + } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index 0c8ca25f96..b4626ba384 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -18,19 +18,25 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl; - import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core.UsersApiServiceCore; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.factories.UsersApiServiceCoreFactory; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtClientException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtServerException; import javax.ws.rs.core.Response; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.RESPONSE_DETAIL_USER_SHARE; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.RESPONSE_STATUS_PROCESSING; + /** * Implementation of the user sharing management APIs. */ @@ -50,46 +56,90 @@ public UsersApiServiceImpl() { @Override public Response processUserSharing(UserShareRequestBody userShareRequestBody) { - usersApiServiceCore.shareUser(userShareRequestBody); - return Response.noContent().build(); + try { + usersApiServiceCore.shareUser(userShareRequestBody); + return Response.status(Response.Status.ACCEPTED) + .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, + RESPONSE_DETAIL_USER_SHARE)).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } @Override public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithAllRequestBody) { - usersApiServiceCore.shareUserWithAll(userShareWithAllRequestBody); - return Response.noContent().build(); + try { + usersApiServiceCore.shareUserWithAll(userShareWithAllRequestBody); + return Response.status(Response.Status.ACCEPTED) + .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, + RESPONSE_DETAIL_USER_SHARE)).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } @Override public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBody) { - usersApiServiceCore.unshareUser(userUnshareRequestBody); - return Response.noContent().build(); + try { + usersApiServiceCore.unshareUser(userUnshareRequestBody); + return Response.status(Response.Status.ACCEPTED) + .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, + RESPONSE_DETAIL_USER_SHARE)).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } @Override public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) { - usersApiServiceCore.unshareUserWithAll(userUnshareWithAllRequestBody); - return Response.noContent().build(); + try { + usersApiServiceCore.unshareUserWithAll(userUnshareWithAllRequestBody); + return Response.status(Response.Status.ACCEPTED) + .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, + RESPONSE_DETAIL_USER_SHARE)).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } @Override public Response usersUserIdSharedOrganizationsGet(String userId, String after, String before, Integer limit, String filter, Boolean recursive) { - UserSharedOrganizationsResponse response = usersApiServiceCore.getSharedOrganizations( - userId, after, before, limit, filter, recursive); - return Response.ok().entity(response).build(); + try { + UserSharedOrganizationsResponse response = usersApiServiceCore.getSharedOrganizations( + userId, after, before, limit, filter, recursive); + return Response.ok().entity(response).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } @Override public Response usersUserIdSharedRolesGet(String userId, String orgId, String after, String before, Integer limit, String filter, Boolean recursive) { - UserSharedRolesResponse response = usersApiServiceCore.getSharedRoles( - userId, orgId, after, before, limit, filter, recursive); - return Response.ok().entity(response).build(); + try { + UserSharedRolesResponse response = usersApiServiceCore.getSharedRoles( + userId, orgId, after, before, limit, filter, recursive); + return Response.ok().entity(response).build(); + } catch (UserShareMgtClientException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (UserShareMgtException e) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); + } } } From aa86e6b0caeac05c61dd463c65035cece43758f4 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 13:33:03 +0530 Subject: [PATCH 25/34] Introduce GETs --- .../UserSharingMgtConstants.java | 3 +- .../v1/core/UsersApiServiceCore.java | 126 +++++++++--------- .../v1/impl/UsersApiServiceImpl.java | 11 +- .../resources/organization-user-share.yaml | 12 +- 4 files changed, 73 insertions(+), 79 deletions(-) rename components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/{ => constants}/UserSharingMgtConstants.java (97%) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java similarity index 97% rename from components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java rename to components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java index 04b800e410..e75055d03a 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common; +package org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants; /** * Holds the constants which the user sharing management API component is using. @@ -30,6 +30,7 @@ public class UserSharingMgtConstants { public static final String RESPONSE_STATUS_PROCESSING = "Processing"; public static final String RESPONSE_DETAIL_USER_SHARE = "User sharing process triggered successfully."; + public static final String RESPONSE_DETAIL_USER_UNSHARE = "User unsharing process triggered successfully."; /** * Enum for user sharing management related errors. diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index b780c3dd95..17a0d2913b 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -18,21 +18,24 @@ package org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core; -import org.apache.commons.lang.StringUtils; -import org.wso2.carbon.identity.api.server.common.error.APIError; -import org.wso2.carbon.identity.api.server.common.error.ErrorResponse; -import org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudience; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.RoleWithAudienceAudience; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBodyOrganizations; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponseLinks; +import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponseSharedOrganizations; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseLinkDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseOrgDetailsDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedOrgsDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedRolesDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareDO; @@ -48,11 +51,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; - -import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.USER_IDS; - -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.USER_IDS; /** * Core service class for handling user sharing management APIs. @@ -198,10 +197,32 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR */ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, String after, String before, Integer limit, String filter, Boolean recursive) throws UserShareMgtException { - // Core logic to retrieve shared organizations - UserSharedOrganizationsResponse response = new UserSharedOrganizationsResponse(); - // Populate the response with shared organizations - return response; + + ResponseSharedOrgsDO result = + userSharingPolicyHandlerService.getSharedOrganizationsOfUser(userId, after, before, limit, filter, + recursive); + + List responseLinks = new ArrayList<>(); + List resultLinks = result.getResponseLinks(); + for (ResponseLinkDO resultLink : resultLinks) { + UserSharedOrganizationsResponseLinks links = new UserSharedOrganizationsResponseLinks(); + links.href(resultLink.getHref()); + links.rel(resultLink.getRel()); + responseLinks.add(links); + } + + List reponseOrgs = new ArrayList<>(); + List resultOrgDetails = result.getSharedOrgs(); + for (ResponseOrgDetailsDO resultOrgDetail : resultOrgDetails) { + UserSharedOrganizationsResponseSharedOrganizations org = + new UserSharedOrganizationsResponseSharedOrganizations().orgId(resultOrgDetail.getOrganizationId()) + .orgName(resultOrgDetail.getOrganizationName()) + .sharedUserId(resultOrgDetail.getSharedUserId()).sharedType(resultOrgDetail.getSharedType()) + .rolesRef(resultOrgDetail.getRolesRef()); + reponseOrgs.add(org); + } + + return new UserSharedOrganizationsResponse().links(responseLinks).sharedOrganizations(reponseOrgs); } /** @@ -217,65 +238,44 @@ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, Str * @return UserSharedRolesResponse containing shared roles. */ public UserSharedRolesResponse getSharedRoles(String userId, String orgId, String after, String before, - Integer limit, String filter, Boolean recursive) throws UserShareMgtException { - // Core logic to retrieve shared roles for the user in the specified organization - UserSharedRolesResponse response = new UserSharedRolesResponse(); - // Populate the response with shared roles - return response; - } + Integer limit, String filter, Boolean recursive) + throws UserShareMgtException { + ResponseSharedRolesDO result = + userSharingPolicyHandlerService.getRolesSharedWithUserInOrganization(userId, orgId, after, before, + limit, filter, recursive); + + List responseLinks = new ArrayList<>(); + List resultLinks = result.getResponseLinks(); + for (ResponseLinkDO resultLink : resultLinks) { + UserSharedOrganizationsResponseLinks links = new UserSharedOrganizationsResponseLinks(); + links.href(resultLink.getHref()); + links.rel(resultLink.getRel()); + responseLinks.add(links); + } - private boolean isUnsupportedParamAvailable(Integer limit, Integer offset, String sortOrder, String sortBy) { + List responseRoles = new ArrayList<>(); + List resultRoleDetails = result.getSharedRoles(); - if (limit != null) { - throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage - .ERROR_CODE_UNSUPPORTED_LIMIT, String.valueOf(limit)); - } - if (offset != null) { - throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage - .ERROR_CODE_UNSUPPORTED_OFFSET, String.valueOf(offset)); - } - if (StringUtils.isNotBlank(sortOrder)) { - throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage - .ERROR_CODE_UNSUPPORTED_SORT_ORDER, sortOrder); + for (RoleWithAudienceDO resultRoleDetail : resultRoleDetails) { + RoleWithAudience roleWithAudience = new RoleWithAudience(); + roleWithAudience.setDisplayName(resultRoleDetail.getRoleName()); + roleWithAudience.setAudience(new RoleWithAudienceAudience() + .display(resultRoleDetail.getAudienceName()) + .type(resultRoleDetail.getAudienceType())); + responseRoles.add(roleWithAudience); } - if (StringUtils.isNotBlank(sortBy)) { - throw handleException(BAD_REQUEST, UserSharingMgtConstants.ErrorMessage - .ERROR_CODE_UNSUPPORTED_SORT_BY, sortBy); - } - return false; + + return new UserSharedRolesResponse().links(responseLinks).roles(responseRoles); } /** - * Helper method to handle exceptions. + * Constructs a success response object for a completed process. * - * @param status HTTP status of the error. - * @param error Error message to be returned. - * @param data Additional error data. - * @return APIError object for error response. + * @param status The status of the process (e.g., "Processing"). + * @param details Additional details or description about the process. + * @return A {@link ProcessSuccessResponse} object containing the status and details of the process. */ - private APIError handleException(Response.Status status, UserSharingMgtConstants.ErrorMessage error, - String data) { - - return new APIError(status, getErrorBuilder(error, data).build()); - } - - private ErrorResponse.Builder getErrorBuilder(UserSharingMgtConstants.ErrorMessage errorMsg, String data) { - - return new ErrorResponse.Builder() - .withCode(errorMsg.getCode()) - .withMessage(errorMsg.getMessage()) - .withDescription(includeData(errorMsg, data)); - } - - private String includeData(UserSharingMgtConstants.ErrorMessage error, String data) { - - if (StringUtils.isNotBlank(data)) { - return String.format(error.getDescription(), data); - } - return error.getDescription(); - } - public ProcessSuccessResponse getProcessSuccessResponse(String status, String details) { ProcessSuccessResponse processSuccessResponse = new ProcessSuccessResponse(); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index b4626ba384..a538a64ff9 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -21,7 +21,6 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.core.UsersApiServiceCore; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.factories.UsersApiServiceCoreFactory; -import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.ProcessSuccessResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserShareWithAllRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedOrganizationsResponse; @@ -30,12 +29,12 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtClientException; import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtServerException; import javax.ws.rs.core.Response; -import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.RESPONSE_DETAIL_USER_SHARE; -import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.UserSharingMgtConstants.RESPONSE_STATUS_PROCESSING; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.RESPONSE_DETAIL_USER_SHARE; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.RESPONSE_DETAIL_USER_UNSHARE; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.RESPONSE_STATUS_PROCESSING; /** * Implementation of the user sharing management APIs. @@ -90,7 +89,7 @@ public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBo usersApiServiceCore.unshareUser(userUnshareRequestBody); return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, - RESPONSE_DETAIL_USER_SHARE)).build(); + RESPONSE_DETAIL_USER_UNSHARE)).build(); } catch (UserShareMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (UserShareMgtException e) { @@ -105,7 +104,7 @@ public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithA usersApiServiceCore.unshareUserWithAll(userUnshareWithAllRequestBody); return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, - RESPONSE_DETAIL_USER_SHARE)).build(); + RESPONSE_DETAIL_USER_UNSHARE)).build(); } catch (UserShareMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (UserShareMgtException e) { diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml index f64ad2eda5..8a5d4bb3cc 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -519,20 +519,14 @@ components: type: string description: Name of the child organization example: "Organization Name" - sharedType: - type: string - description: Shared type of the user (pulled/pushed) - example: "Pushed" sharedUserId: type: string description: ID of the shared user example: "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8" - policy: + sharedType: type: string - description: The scope of sharing for this organization. - enum: ["SELECTED_ORG_ONLY", "SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY", - "SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN", - "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY", "SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN", "NO_ORG"] + description: Shared type of the user (SHARED/INVITED) + example: "SHARED" rolesRef: type: string description: URL reference to retrieve paginated roles for the shared user in this organization From 524294ca6c8df520589f4d94df81e77acbf34d7d Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 14:02:24 +0530 Subject: [PATCH 26/34] format. --- .../management/v1/core/UsersApiServiceCore.java | 11 ++++++----- .../v1/factories/UsersApiServiceCoreFactory.java | 2 +- pom.xml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 17a0d2913b..40f0829a3e 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -32,15 +32,15 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseLinkDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseOrgDetailsDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedOrgsDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedRolesDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.RoleWithAudienceDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareOrgDetailsDO; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserCriteriaType; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserIdList; @@ -90,7 +90,7 @@ public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShar List roleWithAudiences = new ArrayList<>(); - for(RoleWithAudience role : org.getRoles()) { + for (RoleWithAudience role : org.getRoles()) { RoleWithAudienceDO roleWithAudienceDO = new RoleWithAudienceDO(); roleWithAudienceDO.setRoleName(role.getDisplayName()); roleWithAudienceDO.setAudienceName(role.getAudience().getDisplay()); @@ -196,7 +196,8 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR * @return UserSharedOrganizationsResponse containing accessible organizations. */ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, String after, String before, - Integer limit, String filter, Boolean recursive) throws UserShareMgtException { + Integer limit, String filter, Boolean recursive) + throws UserShareMgtException { ResponseSharedOrgsDO result = userSharingPolicyHandlerService.getSharedOrganizationsOfUser(userId, after, before, limit, filter, @@ -272,7 +273,7 @@ public UserSharedRolesResponse getSharedRoles(String userId, String orgId, Strin /** * Constructs a success response object for a completed process. * - * @param status The status of the process (e.g., "Processing"). + * @param status The status of the process (e.g., "Processing"). * @param details Additional details or description about the process. * @return A {@link ProcessSuccessResponse} object containing the status and details of the process. */ diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java index 5d852d66a4..9812374312 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceCoreFactory.java @@ -27,7 +27,7 @@ */ public class UsersApiServiceCoreFactory { - private final static UsersApiServiceCore SERVICE; + private static final UsersApiServiceCore SERVICE; static { UserSharingPolicyHandlerService userSharingPolicyHandlerService = UserSharingMgtServiceHolder diff --git a/pom.xml b/pom.xml index 9131df6120..214571f065 100644 --- a/pom.xml +++ b/pom.xml @@ -883,7 +883,7 @@ - 1.4.71-SNAPSHOT + 1.4.75-SNAPSHOT From d3f84fd498bd586d3c25e61e7246ddbf9b5448f3 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 14:15:45 +0530 Subject: [PATCH 27/34] api def change. --- .../user/sharing/management/v1/UsersApi.java | 12 +-- .../v1/factories/UsersApiServiceFactory.java | 5 +- ...anizationsResponseSharedOrganizations.java | 81 +++---------------- 3 files changed, 20 insertions(+), 78 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java index d2801a60c5..b946c34c90 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java @@ -58,7 +58,7 @@ public UsersApi() { @Path("/share") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Share a user across specific organizations", notes = "This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. Permission required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Share a user across specific organizations", notes = "This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. Scope(Permission) required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -74,7 +74,7 @@ public Response processUserSharing(@ApiParam(value = "" ,required=true) @Valid U @Path("/share-with-all") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Share a user with all organizations", notes = "This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. Permission required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Share a user with all organizations", notes = "This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. Scope(Permission) required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -90,7 +90,7 @@ public Response processUserSharingAll(@ApiParam(value = "" ,required=true) @Vali @Path("/unshare") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Unshare a user from specific organizations", notes = "This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. Permission required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Unshare a user from specific organizations", notes = "This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. Scope(Permission) required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Unsharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -106,7 +106,7 @@ public Response processUserUnsharing(@ApiParam(value = "" ,required=true) @Valid @Path("/unshare-with-all") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Remove a user's shared access", notes = "This API removes all shared access for one or more users, unsharing them from all organizations. Permission required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Remove a user's shared access", notes = "This API removes all shared access for one or more users, unsharing them from all organizations. Scope(Permission) required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Share removal process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -122,7 +122,7 @@ public Response removeUserSharing(@ApiParam(value = "" ,required=true) @Valid Us @Path("/{userId}/shared-organizations") @Produces({ "application/json" }) - @ApiOperation(value = "Get organizations a user has access to", notes = "This API retrieves the list of organizations where the specified user has shared access, with support for pagination and filtering. Permission required: `internal_user_shared_access_view` ", response = UserSharedOrganizationsResponse.class, tags={ "User Accessible Organizations", }) + @ApiOperation(value = "Get organizations a user has access to", notes = "This API retrieves the list of organizations where the specified user has shared access, with support for pagination and filtering. Scope(Permission) required: `internal_user_shared_access_view` ", response = UserSharedOrganizationsResponse.class, tags={ "User Accessible Organizations", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful Response with Accessible Organizations", response = UserSharedOrganizationsResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -138,7 +138,7 @@ public Response usersUserIdSharedOrganizationsGet(@ApiParam(value = "The ID of t @Path("/{userId}/shared-roles") @Produces({ "application/json" }) - @ApiOperation(value = "Get roles assigned to a user in an organization", notes = "This API fetches the roles assigned to the specified user within a particular organization, with support for pagination, filtering, and recursion. Permission required: `internal_user_shared_access_view` ", response = UserSharedRolesResponse.class, tags={ "User Accessible Roles" }) + @ApiOperation(value = "Get roles assigned to a user in an organization", notes = "This API fetches the roles assigned to the specified user within a particular organization, with support for pagination, filtering, and recursion. Scope(Permission) required: `internal_user_shared_access_view` ", response = UserSharedRolesResponse.class, tags={ "User Accessible Roles" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful Response with Accessible Roles", response = UserSharedRolesResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java index 2060fb16ed..7ece79ae5a 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/factories/UsersApiServiceFactory.java @@ -21,12 +21,9 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.UsersApiService; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl.UsersApiServiceImpl; -/** - * Factory class for UsersApiService. - */ public class UsersApiServiceFactory { - private final static UsersApiService SERVICE = new UsersApiServiceImpl(); + private static final UsersApiService SERVICE = new UsersApiServiceImpl(); /** * Get UsersApiService. diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java index baa39d5e1b..c28d0edee6 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/model/UserSharedOrganizationsResponseSharedOrganizations.java @@ -34,42 +34,8 @@ public class UserSharedOrganizationsResponseSharedOrganizations { private String orgId; private String orgName; - private String sharedType; private String sharedUserId; - -@XmlType(name="PolicyEnum") -@XmlEnum(String.class) -public enum PolicyEnum { - - @XmlEnumValue("SELECTED_ORG_ONLY") SELECTED_ORG_ONLY(String.valueOf("SELECTED_ORG_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY") SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_CHILDREN_ONLY")), @XmlEnumValue("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN") SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN(String.valueOf("SELECTED_ORG_WITH_EXISTING_IMMEDIATE_AND_FUTURE_CHILDREN")), @XmlEnumValue("NO_ORG") NO_ORG(String.valueOf("NO_ORG")); - - - private String value; - - PolicyEnum(String v) { - value = v; - } - - public String value() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static PolicyEnum fromValue(String value) { - for (PolicyEnum b : PolicyEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} - - private PolicyEnum policy; + private String sharedType; private String rolesRef; /** @@ -110,25 +76,6 @@ public void setOrgName(String orgName) { this.orgName = orgName; } - /** - * Shared type of the user (pulled/pushed) - **/ - public UserSharedOrganizationsResponseSharedOrganizations sharedType(String sharedType) { - - this.sharedType = sharedType; - return this; - } - - @ApiModelProperty(example = "Pushed", value = "Shared type of the user (pulled/pushed)") - @JsonProperty("sharedType") - @Valid - public String getSharedType() { - return sharedType; - } - public void setSharedType(String sharedType) { - this.sharedType = sharedType; - } - /** * ID of the shared user **/ @@ -149,22 +96,22 @@ public void setSharedUserId(String sharedUserId) { } /** - * The scope of sharing for this organization. + * Shared type of the user (SHARED/INVITED) **/ - public UserSharedOrganizationsResponseSharedOrganizations policy(PolicyEnum policy) { + public UserSharedOrganizationsResponseSharedOrganizations sharedType(String sharedType) { - this.policy = policy; + this.sharedType = sharedType; return this; } - @ApiModelProperty(value = "The scope of sharing for this organization.") - @JsonProperty("policy") + @ApiModelProperty(example = "SHARED", value = "Shared type of the user (SHARED/INVITED)") + @JsonProperty("sharedType") @Valid - public PolicyEnum getPolicy() { - return policy; + public String getSharedType() { + return sharedType; } - public void setPolicy(PolicyEnum policy) { - this.policy = policy; + public void setSharedType(String sharedType) { + this.sharedType = sharedType; } /** @@ -200,15 +147,14 @@ public boolean equals(java.lang.Object o) { UserSharedOrganizationsResponseSharedOrganizations userSharedOrganizationsResponseSharedOrganizations = (UserSharedOrganizationsResponseSharedOrganizations) o; return Objects.equals(this.orgId, userSharedOrganizationsResponseSharedOrganizations.orgId) && Objects.equals(this.orgName, userSharedOrganizationsResponseSharedOrganizations.orgName) && - Objects.equals(this.sharedType, userSharedOrganizationsResponseSharedOrganizations.sharedType) && Objects.equals(this.sharedUserId, userSharedOrganizationsResponseSharedOrganizations.sharedUserId) && - Objects.equals(this.policy, userSharedOrganizationsResponseSharedOrganizations.policy) && + Objects.equals(this.sharedType, userSharedOrganizationsResponseSharedOrganizations.sharedType) && Objects.equals(this.rolesRef, userSharedOrganizationsResponseSharedOrganizations.rolesRef); } @Override public int hashCode() { - return Objects.hash(orgId, orgName, sharedType, sharedUserId, policy, rolesRef); + return Objects.hash(orgId, orgName, sharedUserId, sharedType, rolesRef); } @Override @@ -219,9 +165,8 @@ public String toString() { sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); - sb.append(" sharedType: ").append(toIndentedString(sharedType)).append("\n"); sb.append(" sharedUserId: ").append(toIndentedString(sharedUserId)).append("\n"); - sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" sharedType: ").append(toIndentedString(sharedType)).append("\n"); sb.append(" rolesRef: ").append(toIndentedString(rolesRef)).append("\n"); sb.append("}"); return sb.toString(); From 8dc1bd596d0aadbc0d93294e3cb17ede5342c0ae Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 16:38:53 +0530 Subject: [PATCH 28/34] Remove unnecessary errors and spring dependency. --- .../pom.xml | 5 - .../constants/UserSharingMgtConstants.java | 91 ++++--------------- .../v1/core/UsersApiServiceCore.java | 42 +++++++++ .../v1/impl/UsersApiServiceImpl.java | 2 +- 4 files changed, 63 insertions(+), 77 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index 8ca83fe324..72caab02b0 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -53,11 +53,6 @@ javax.ws.rs-api provided - - org.springframework - spring-web - provided - com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java index e75055d03a..d251c1b1fb 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java @@ -41,77 +41,26 @@ public class UserSharingMgtConstants { public enum ErrorMessage { // Client errors. - ERROR_CODE_USER_NOT_FOUND("60000", - "Invalid user identifier is provided.", - "Invalid user identifier %s is provided."), - ERROR_CODE_INVALID_INVITATION("60001", - "Invalid invitation.", - "Provided invitation with the id %s is invalid."), - ERROR_CODE_INVALID_CONFIRMATION_CODE("60002", - "Invalid confirmation code.", - "Could not validate the confirmation code %s."), - ERROR_CODE_MULTIPLE_INVITATIONS_FOR_USER("60003", - "Unable to create the invitation.", - "Multiple invitations found for users given in the list %s."), - ERROR_CODE_UNSUPPORTED_LIMIT("60004", - ERROR_UNSUPPORTED_PARAM, - "Limit param is not supported yet."), - ERROR_CODE_UNSUPPORTED_OFFSET("60005", - ERROR_UNSUPPORTED_PARAM, - "Offset param is not supported yet."), - ERROR_CODE_UNSUPPORTED_SORT_ORDER("60006", - ERROR_UNSUPPORTED_PARAM, - "Sort order param is not supported yet."), - ERROR_CODE_UNSUPPORTED_SORT_BY("60007", - ERROR_UNSUPPORTED_PARAM, - "Sort order param is not supported yet."), - ERROR_CODE_ACTIVE_INVITATION_AVAILABLE("60008", - "Invitation already exists.", - "An active invitation already exists for the user %s."), - ERROR_CODE_INVALID_FILTER("60009", - "Invalid filter.", - "Provided filter %s is not valid."), - ERROR_CODE_INVALID_APPLICATION("60009", - "Invalid application provided.", - "One of the provided applications with roles are not valid."), - ERROR_CODE_INVALID_CONFIRMATION_CODE_FOR_ACCEPTANCE("60010", - "Invalid confirmation code.", - "Could not accept the invitation since the confirmation code %s is not valid."), - ERROR_CODE_INVALID_USER("60011", - "Invalid user provided.", - "Invalid user is provided."), - ERROR_CODE_EXISTING_USER("60012", - "Authenticated user exist.", - "The authenticated user is already available in the organization."), - ERROR_CODE_INVALID_ROLE("60013", - "Invalid role list provided.", - "The provided role lists are not valid."), - ERROR_CODE_INVALID_USER_INFORMATION("60014", - "Unable to create an invitation to all the users given in the list.", - "User invitation creation failed for the users: %s"), - ERROR_CODE_INVALID_GROUP("60015", - "Invalid group list provided.", - "The provided group lists are not valid."), - - // Server errors. - ERROR_CODE_CREATE_INVITATION("65001", - "Unable to create the invitation.", - "Could not create the invitation to the user %s."), - ERROR_CODE_GET_INVITATIONS("65002", - "Unable to retrieve the invitations.", - "Could not retrieve the invitations for the organization."), - ERROR_CODE_VALIDATE_INVITATION("65003", - "Unable to validate the invitation.", - "Could not validate the invitation with the confirmation code %s."), - ERROR_CODE_DELETE_INVITATION("65004", - "Unable to delete the invitation.", - "Could not delete the invitation with the id %s."), - ERROR_CODE_ACCEPT_INVITATION("65005", - "Unable to accept the invitation.", - "Could not accept the invitation with the confirmation code %s."), - ERROR_CODE_NOT_IMPLEMENTED("65100", - "Not Implemented.", - "Method is not implemented."); + INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY("60000", + "Invalid selective user share request body.", + "The user criteria provided for selective sharing is either null or empty. " + + "Please provide valid criteria."), + INVALID_GENERAL_USER_SHARE_REQUEST_BODY("60001", + "Invalid general user share request body.", + "The user criteria provided for general sharing is either null or empty. " + + "Please provide valid criteria."), + INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY("60002", + "Invalid selective user unshare request body.", + "The user criteria provided for selective unsharing is either null or empty. " + + "Please provide valid criteria."), + INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY("60003", + "Invalid general user unshare request body.", + "The user criteria provided for general unsharing is either null or empty. " + + "Please provide valid criteria."), + INVALID_UUID_FORMAT("60004", + "Invalid UUID format.", + "The UUID provided in the request is not in a valid format. " + + "Please provide a valid UUID."); private final String code; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 40f0829a3e..895ece1f83 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,6 +31,7 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtClientException; import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; @@ -51,6 +52,11 @@ import java.util.List; import java.util.Map; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.ErrorMessage.INVALID_GENERAL_USER_SHARE_REQUEST_BODY; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.ErrorMessage.INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.ErrorMessage.INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.ErrorMessage.INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY; +import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.ErrorMessage.INVALID_UUID_FORMAT; import static org.wso2.carbon.identity.api.server.organization.user.sharing.management.common.constants.UserSharingMgtConstants.USER_IDS; /** @@ -72,6 +78,12 @@ public UsersApiServiceCore(UserSharingPolicyHandlerService userSharingPolicyHand */ public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShareMgtException { + if (userShareRequestBody == null) { + throw new UserShareMgtClientException(INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getCode(), + INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getMessage(), + INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getDescription()); + } + // Populate selectiveUserShareDO object from the request body. SelectiveUserShareDO selectiveUserShareDO = new SelectiveUserShareDO(); @@ -114,6 +126,12 @@ public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShar */ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) throws UserShareMgtException { + if (userShareWithAllRequestBody == null) { + throw new UserShareMgtClientException(INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getCode(), + INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getMessage(), + INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getDescription()); + } + // Populate GeneralUserShareDO object from the request body. GeneralUserShareDO generalUserShareDO = new GeneralUserShareDO(); @@ -149,6 +167,12 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest */ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws UserShareMgtException { + if (userUnshareRequestBody == null) { + throw new UserShareMgtClientException(INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getCode(), + INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getMessage(), + INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getDescription()); + } + // Populate SelectiveUserUnshareDO object from the request body. SelectiveUserUnshareDO selectiveUserUnshareDO = new SelectiveUserUnshareDO(); @@ -172,6 +196,12 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws Us public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) throws UserShareMgtException { + if (userUnshareWithAllRequestBody == null) { + throw new UserShareMgtClientException(INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getCode(), + INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getMessage(), + INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getDescription()); + } + // Populate GeneralUserUnshareDO object from the request body. GeneralUserUnshareDO generalUserUnshareDO = new GeneralUserUnshareDO(); @@ -199,6 +229,12 @@ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, Str Integer limit, String filter, Boolean recursive) throws UserShareMgtException { + if (userId == null) { + throw new UserShareMgtClientException(INVALID_UUID_FORMAT.getCode(), + INVALID_UUID_FORMAT.getMessage(), + INVALID_UUID_FORMAT.getDescription()); + } + ResponseSharedOrgsDO result = userSharingPolicyHandlerService.getSharedOrganizationsOfUser(userId, after, before, limit, filter, recursive); @@ -242,6 +278,12 @@ public UserSharedRolesResponse getSharedRoles(String userId, String orgId, Strin Integer limit, String filter, Boolean recursive) throws UserShareMgtException { + if (userId == null || orgId == null) { + throw new UserShareMgtClientException(INVALID_UUID_FORMAT.getCode(), + INVALID_UUID_FORMAT.getMessage(), + INVALID_UUID_FORMAT.getDescription()); + } + ResponseSharedRolesDO result = userSharingPolicyHandlerService.getRolesSharedWithUserInOrganization(userId, orgId, after, before, limit, filter, recursive); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index a538a64ff9..e9ad4e202f 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -48,7 +48,7 @@ public UsersApiServiceImpl() { try { this.usersApiServiceCore = UsersApiServiceCoreFactory.getUsersApiServiceCore(); } catch (IllegalStateException e) { - throw new RuntimeException("Error occurred while initiating ServerUserStoreService.", e); + throw new RuntimeException("Error occurred while initiating UsersApiService.", e); } } From 869393b61b03be9b2510820dafa94fafcc0bf676 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 19:11:41 +0530 Subject: [PATCH 29/34] renaming of the exception classes. --- .../v1/core/UsersApiServiceCore.java | 29 ++++++++++--------- .../v1/impl/UsersApiServiceImpl.java | 28 +++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java index 895ece1f83..90d5354e92 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/core/UsersApiServiceCore.java @@ -31,8 +31,8 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtClientException; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserSharingMgtClientException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserSharingMgtException; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserUnshareDO; import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseLinkDO; @@ -76,10 +76,10 @@ public UsersApiServiceCore(UserSharingPolicyHandlerService userSharingPolicyHand * * @param userShareRequestBody Contains details for user sharing. */ - public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShareMgtException { + public void shareUser(UserShareRequestBody userShareRequestBody) throws UserSharingMgtException { if (userShareRequestBody == null) { - throw new UserShareMgtClientException(INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getCode(), + throw new UserSharingMgtClientException(INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getCode(), INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getMessage(), INVALID_SELECTIVE_USER_SHARE_REQUEST_BODY.getDescription()); } @@ -124,10 +124,11 @@ public void shareUser(UserShareRequestBody userShareRequestBody) throws UserShar * * @param userShareWithAllRequestBody Contains details for sharing users with all organizations. */ - public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) throws UserShareMgtException { + public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody) + throws UserSharingMgtException { if (userShareWithAllRequestBody == null) { - throw new UserShareMgtClientException(INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getCode(), + throw new UserSharingMgtClientException(INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getCode(), INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getMessage(), INVALID_GENERAL_USER_SHARE_REQUEST_BODY.getDescription()); } @@ -165,10 +166,10 @@ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequest * * @param userUnshareRequestBody Contains details for user unsharing. */ - public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws UserShareMgtException { + public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws UserSharingMgtException { if (userUnshareRequestBody == null) { - throw new UserShareMgtClientException(INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getCode(), + throw new UserSharingMgtClientException(INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getCode(), INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getMessage(), INVALID_SELECTIVE_USER_UNSHARE_REQUEST_BODY.getDescription()); } @@ -194,10 +195,10 @@ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws Us * @param userUnshareWithAllRequestBody Contains details for removing shared access. */ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) - throws UserShareMgtException { + throws UserSharingMgtException { if (userUnshareWithAllRequestBody == null) { - throw new UserShareMgtClientException(INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getCode(), + throw new UserSharingMgtClientException(INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getCode(), INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getMessage(), INVALID_GENERAL_USER_UNSHARE_REQUEST_BODY.getDescription()); } @@ -227,10 +228,10 @@ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllR */ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, String after, String before, Integer limit, String filter, Boolean recursive) - throws UserShareMgtException { + throws UserSharingMgtException { if (userId == null) { - throw new UserShareMgtClientException(INVALID_UUID_FORMAT.getCode(), + throw new UserSharingMgtClientException(INVALID_UUID_FORMAT.getCode(), INVALID_UUID_FORMAT.getMessage(), INVALID_UUID_FORMAT.getDescription()); } @@ -276,10 +277,10 @@ public UserSharedOrganizationsResponse getSharedOrganizations(String userId, Str */ public UserSharedRolesResponse getSharedRoles(String userId, String orgId, String after, String before, Integer limit, String filter, Boolean recursive) - throws UserShareMgtException { + throws UserSharingMgtException { if (userId == null || orgId == null) { - throw new UserShareMgtClientException(INVALID_UUID_FORMAT.getCode(), + throw new UserSharingMgtClientException(INVALID_UUID_FORMAT.getCode(), INVALID_UUID_FORMAT.getMessage(), INVALID_UUID_FORMAT.getDescription()); } diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java index e9ad4e202f..70b810464f 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/impl/UsersApiServiceImpl.java @@ -27,8 +27,8 @@ import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserSharedRolesResponse; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareRequestBody; import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.model.UserUnshareWithAllRequestBody; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtClientException; -import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserShareMgtException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserSharingMgtClientException; +import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserSharingMgtException; import javax.ws.rs.core.Response; @@ -60,9 +60,9 @@ public Response processUserSharing(UserShareRequestBody userShareRequestBody) { return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, RESPONSE_DETAIL_USER_SHARE)).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } @@ -75,9 +75,9 @@ public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithA return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, RESPONSE_DETAIL_USER_SHARE)).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } @@ -90,9 +90,9 @@ public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBo return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, RESPONSE_DETAIL_USER_UNSHARE)).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } @@ -105,9 +105,9 @@ public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithA return Response.status(Response.Status.ACCEPTED) .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING, RESPONSE_DETAIL_USER_UNSHARE)).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } @@ -120,9 +120,9 @@ public Response usersUserIdSharedOrganizationsGet(String userId, String after, S UserSharedOrganizationsResponse response = usersApiServiceCore.getSharedOrganizations( userId, after, before, limit, filter, recursive); return Response.ok().entity(response).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } @@ -135,9 +135,9 @@ public Response usersUserIdSharedRolesGet(String userId, String orgId, String af UserSharedRolesResponse response = usersApiServiceCore.getSharedRoles( userId, orgId, after, before, limit, filter, recursive); return Response.ok().entity(response).build(); - } catch (UserShareMgtClientException e) { + } catch (UserSharingMgtClientException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); - } catch (UserShareMgtException e) { + } catch (UserSharingMgtException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } From 075ad4fcf2b3772aaa5fde03436fe21bd1a3b365 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 20:11:44 +0530 Subject: [PATCH 30/34] update pom. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 214571f065..2e349ab3ce 100644 --- a/pom.xml +++ b/pom.xml @@ -883,7 +883,7 @@ - 1.4.75-SNAPSHOT + 1.4.79-SNAPSHOT From 870d844ad9786cff1156c62ed3d2f5e6d51c9e6f Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 21:02:39 +0530 Subject: [PATCH 31/34] update pom to 1.3.56-SNAPSHOT. --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index 72caab02b0..e7a29baf45 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.30-SNAPSHOT + 1.3.56-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index 7d9327ee63..173a8b7c83 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.30-SNAPSHOT + 1.3.56-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml index 94b8175799..85e782aede 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.server.api identity-api-server - 1.3.30-SNAPSHOT + 1.3.56-SNAPSHOT ../../pom.xml From ab89f0d05fd16d0e889bf5f698483b862d2b4d22 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Sun, 26 Jan 2025 21:21:56 +0530 Subject: [PATCH 32/34] Update scopes in yaml. --- .../user/sharing/management/v1/UsersApi.java | 8 ++++---- .../src/main/resources/organization-user-share.yaml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java index b946c34c90..93cda104d8 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/v1/UsersApi.java @@ -58,7 +58,7 @@ public UsersApi() { @Path("/share") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Share a user across specific organizations", notes = "This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. Scope(Permission) required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Share a user across specific organizations", notes = "This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. Scope(Permission) required: `internal_user_share` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -74,7 +74,7 @@ public Response processUserSharing(@ApiParam(value = "" ,required=true) @Valid U @Path("/share-with-all") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Share a user with all organizations", notes = "This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. Scope(Permission) required: `internal_user_shared_access_add` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Share a user with all organizations", notes = "This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. Scope(Permission) required: `internal_user_share` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Sharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -90,7 +90,7 @@ public Response processUserSharingAll(@ApiParam(value = "" ,required=true) @Vali @Path("/unshare") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Unshare a user from specific organizations", notes = "This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. Scope(Permission) required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Unshare a user from specific organizations", notes = "This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. Scope(Permission) required: `internal_user_unshare` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Unsharing process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), @@ -106,7 +106,7 @@ public Response processUserUnsharing(@ApiParam(value = "" ,required=true) @Valid @Path("/unshare-with-all") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Remove a user's shared access", notes = "This API removes all shared access for one or more users, unsharing them from all organizations. Scope(Permission) required: `internal_user_shared_access_delete` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) + @ApiOperation(value = "Remove a user's shared access", notes = "This API removes all shared access for one or more users, unsharing them from all organizations. Scope(Permission) required: `internal_user_unshare` ", response = ProcessSuccessResponse.class, tags={ "User Sharing", }) @ApiResponses(value = { @ApiResponse(code = 202, message = "Share removal process triggered successfully.", response = ProcessSuccessResponse.class), @ApiResponse(code = 400, message = "Bad Request", response = Error.class), diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml index 8a5d4bb3cc..d2494cd92e 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/src/main/resources/organization-user-share.yaml @@ -27,7 +27,7 @@ paths: description: | This API shares one or more users across specified organizations, assigning roles based on the provided policy. The policy defines the sharing scope for each organization, including whether access extends to child organizations. - Scope(Permission) required: `internal_user_shared_access_add` + Scope(Permission) required: `internal_user_share` operationId: processUserSharing requestBody: content: @@ -79,7 +79,7 @@ paths: description: | This API shares users across all organizations, applying the provided roles to each organization. The policy determines the scope of sharing, including whether it applies to all current organizations or future organizations as well. - Scope(Permission) required: `internal_user_shared_access_add` + Scope(Permission) required: `internal_user_share` operationId: processUserSharingAll requestBody: content: @@ -131,7 +131,7 @@ paths: This API removes shared access for one or more users from specified organizations. The payload includes the list of user IDs and the organizations from which the users should be unshared. - Scope(Permission) required: `internal_user_shared_access_delete` + Scope(Permission) required: `internal_user_unshare` operationId: processUserUnsharing requestBody: content: @@ -175,7 +175,7 @@ paths: description: | This API removes all shared access for one or more users, unsharing them from all organizations. - Scope(Permission) required: `internal_user_shared_access_delete` + Scope(Permission) required: `internal_user_unshare` operationId: removeUserSharing requestBody: content: @@ -621,4 +621,4 @@ components: type: string format: uuid example: "e0fbcfeb-7fc2-4b62-8b82-72d3c5fbcdeb" - description: A trace ID in UUID format to help with debugging. \ No newline at end of file + description: A trace ID in UUID format to help with debugging. From bfbac18d465a95020de8f8b72964a760f855f4d9 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Mon, 27 Jan 2025 02:06:54 +0530 Subject: [PATCH 33/34] update poms for next version. --- .../pom.xml | 2 +- .../sharing/management/common/UserSharingMgtServiceHolder.java | 1 - .../management/common/constants/UserSharingMgtConstants.java | 1 - .../pom.xml | 2 +- .../pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index e7a29baf45..a870c6fa78 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.56-SNAPSHOT + 1.3.57-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java index 89f93a0403..a794fb3bac 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/UserSharingMgtServiceHolder.java @@ -21,7 +21,6 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService; - /** * Holds the services which the shared user sharing management API component is using. */ diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java index d251c1b1fb..15681654af 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/user/sharing/management/common/constants/UserSharingMgtConstants.java @@ -62,7 +62,6 @@ public enum ErrorMessage { "The UUID provided in the request is not in a valid format. " + "Please provide a valid UUID."); - private final String code; private final String message; private final String description; diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index 173a8b7c83..e07d52ecf9 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.56-SNAPSHOT + 1.3.57-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml index 85e782aede..b1105642df 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.server.api identity-api-server - 1.3.56-SNAPSHOT + 1.3.57-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index a311ff4409..093bada693 100644 --- a/pom.xml +++ b/pom.xml @@ -878,7 +878,7 @@ - 1.4.79-SNAPSHOT + 1.4.80 From a6e7b8bf904e2343b912776785f2b88cb7071fb7 Mon Sep 17 00:00:00 2001 From: BimsaraBodaragama Date: Mon, 27 Jan 2025 07:43:05 +0530 Subject: [PATCH 34/34] update poms after org-mgt release. --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml index a870c6fa78..c6d3d01faf 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.common/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.57-SNAPSHOT + 1.3.59-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml index e07d52ecf9..c7bd963ec5 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.user.sharing.management - 1.3.57-SNAPSHOT + 1.3.59-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml index b1105642df..6e199a7bec 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.organization.user.sharing.management/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.server.api identity-api-server - 1.3.57-SNAPSHOT + 1.3.59-SNAPSHOT ../../pom.xml