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..c6d3d01faf
--- /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,99 @@
+
+
+
+ 4.0.0
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.api.server.organization.user.sharing.management
+ 1.3.59-SNAPSHOT
+ ../pom.xml
+
+
+ org.wso2.carbon.identity.api.server.organization.user.sharing.management.common
+ jar
+
+
+
+ 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
+ provided
+
+
+ org.apache.cxf
+ cxf-rt-rs-service-description
+ provided
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+ 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/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..a794fb3bac
--- /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) 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;
+
+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.
+ */
+public class UserSharingMgtServiceHolder {
+
+ private UserSharingMgtServiceHolder() {
+
+ }
+
+ private static class UserSharingPolicyHandlerServiceHolder {
+
+ private static final UserSharingPolicyHandlerService SERVICE = (UserSharingPolicyHandlerService)
+ PrivilegedCarbonContext.getThreadLocalCarbonContext()
+ .getOSGiService(UserSharingPolicyHandlerService.class, null);
+ }
+
+ /**
+ * Get UserSharingPolicyHandlerService service.
+ *
+ * @return UserSharingPolicyHandlerService.
+ */
+ public static UserSharingPolicyHandlerService getUserSharingPolicyHandlerService() {
+
+ 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/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
new file mode 100644
index 0000000000..15681654af
--- /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/constants/UserSharingMgtConstants.java
@@ -0,0 +1,97 @@
+/*
+ * 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.constants;
+
+/**
+ * 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_UNSUPPORTED_PARAM = "Unsupported param.";
+
+ 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.";
+ public static final String RESPONSE_DETAIL_USER_UNSHARE = "User unsharing process triggered successfully.";
+
+ /**
+ * 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.
+ */
+ public enum ErrorMessage {
+
+ // Client errors.
+ 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;
+ 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.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..c7bd963ec5
--- /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,173 @@
+
+
+
+ 4.0.0
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.api.server.organization.user.sharing.management
+ 1.3.59-SNAPSHOT
+ ../pom.xml
+
+
+ org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1
+ jar
+
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+ 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.wso2.carbon.identity.organization.management
+ org.wso2.carbon.identity.organization.resource.sharing.policy.management
+ provided
+
+
+
+
+
+
+ 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..93cda104d8
--- /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,152 @@
+/*
+ * 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;
+
+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;
+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 {
+
+ private final UsersApiService delegate;
+
+ public UsersApi() {
+
+ this.delegate = UsersApiServiceFactory.getUsersApi();
+ }
+
+ @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. 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),
+ @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. 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),
+ @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. 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),
+ @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. 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),
+ @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. 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),
+ @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. 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),
+ @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..a7ee65a4db
--- /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) 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;
+
+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..7ece79ae5a
--- /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,37 @@
+/*
+ * 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.v1.UsersApiService;
+import org.wso2.carbon.identity.api.server.organization.user.sharing.management.v1.impl.UsersApiServiceImpl;
+
+public class UsersApiServiceFactory {
+
+ private static final UsersApiService SERVICE = new UsersApiServiceImpl();
+
+ /**
+ * Get UsersApiService.
+ *
+ * @return UsersApiService.
+ */
+ 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..942211e98a
--- /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) 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.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..8093277a66
--- /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) 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.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..2eb45858f6
--- /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) 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.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..973a3aa1de
--- /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) 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.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..54db34d0e4
--- /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) 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.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..e7befac153
--- /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) 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.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("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 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..82ee22daf2
--- /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) 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.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..b74689f099
--- /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) 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.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_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;
+
+ 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..aa1465198b
--- /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,146 @@
+/*
+ * 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.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, 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, shared type and pagination links for navigating results. ")
+public class UserSharedOrganizationsResponse {
+
+ private List links = null;
+
+ private List sharedOrganizations = null;
+
+
+ /**
+ * 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.links, userSharedOrganizationsResponse.links) &&
+ Objects.equals(this.sharedOrganizations, userSharedOrganizationsResponse.sharedOrganizations);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(links, sharedOrganizations);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class UserSharedOrganizationsResponse {\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..1443682875
--- /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) 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.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..c28d0edee6
--- /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,187 @@
+/*
+ * 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.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;
+ private String sharedType;
+ 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;
+ }
+
+ /**
+ * Shared type of the user (SHARED/INVITED)
+ **/
+ public UserSharedOrganizationsResponseSharedOrganizations sharedType(String sharedType) {
+
+ this.sharedType = sharedType;
+ return this;
+ }
+
+ @ApiModelProperty(example = "SHARED", value = "Shared type of the user (SHARED/INVITED)")
+ @JsonProperty("sharedType")
+ @Valid
+ public String getSharedType() {
+ return sharedType;
+ }
+ public void setSharedType(String sharedType) {
+ this.sharedType = sharedType;
+ }
+
+ /**
+ * 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.sharedType, userSharedOrganizationsResponseSharedOrganizations.sharedType) &&
+ Objects.equals(this.rolesRef, userSharedOrganizationsResponseSharedOrganizations.rolesRef);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(orgId, orgName, sharedUserId, sharedType, 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(" sharedType: ").append(toIndentedString(sharedType)).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..f263a88c39
--- /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) 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.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..d1ac4afccc
--- /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) 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.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..73c18d01ba
--- /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) 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.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..35e51e8aed
--- /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) 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.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..90d5354e92
--- /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,330 @@
+/*
+ * 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.core;
+
+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.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;
+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.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.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;
+import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.PolicyEnum;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+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;
+
+/**
+ * Core service class for handling user sharing management APIs.
+ */
+public class UsersApiServiceCore {
+
+ private final UserSharingPolicyHandlerService userSharingPolicyHandlerService;
+
+ public UsersApiServiceCore(UserSharingPolicyHandlerService userSharingPolicyHandlerService) {
+
+ this.userSharingPolicyHandlerService = userSharingPolicyHandlerService;
+ }
+
+ /**
+ * Handles sharing a user across specific organizations.
+ *
+ * @param userShareRequestBody Contains details for user sharing.
+ */
+ public void shareUser(UserShareRequestBody userShareRequestBody) throws UserSharingMgtException {
+
+ if (userShareRequestBody == null) {
+ throw new UserSharingMgtClientException(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();
+
+ // Set user criteria.
+ Map userCriteria = new HashMap<>();
+ UserCriteriaType userIds = new UserIdList(userShareRequestBody.getUserCriteria().getUserIds());
+ userCriteria.put(USER_IDS, userIds);
+ selectiveUserShareDO.setUserCriteria(userCriteria);
+
+ // Set organizations.
+ List organizationsList = new ArrayList<>();
+ for (UserShareRequestBodyOrganizations org : userShareRequestBody.getOrganizations()) {
+ SelectiveUserShareOrgDetailsDO selectiveUserShareOrgDetailsDO = new SelectiveUserShareOrgDetailsDO();
+ selectiveUserShareOrgDetailsDO.setOrganizationId(org.getOrgId());
+ selectiveUserShareOrgDetailsDO.setPolicy(PolicyEnum.getPolicyByValue(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);
+ }
+
+ selectiveUserShareOrgDetailsDO.setRoles(roleWithAudiences);
+
+ organizationsList.add(selectiveUserShareOrgDetailsDO);
+ }
+ selectiveUserShareDO.setOrganizations(organizationsList);
+
+ userSharingPolicyHandlerService.populateSelectiveUserShare(selectiveUserShareDO);
+ }
+
+ /**
+ * Handles sharing a user across all organizations.
+ *
+ * @param userShareWithAllRequestBody Contains details for sharing users with all organizations.
+ */
+ public void shareUserWithAll(UserShareWithAllRequestBody userShareWithAllRequestBody)
+ throws UserSharingMgtException {
+
+ if (userShareWithAllRequestBody == null) {
+ throw new UserSharingMgtClientException(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();
+
+ // Set user criteria.
+ Map userCriteria = new HashMap<>();
+ UserCriteriaType userIds = new UserIdList(userShareWithAllRequestBody.getUserCriteria().getUserIds());
+ userCriteria.put(USER_IDS, userIds);
+ generalUserShareDO.setUserCriteria(userCriteria);
+
+ // Set policy.
+ generalUserShareDO.setPolicy(PolicyEnum.getPolicyByValue(userShareWithAllRequestBody.getPolicy().value()));
+
+ // Set roles.
+ List rolesList = new ArrayList<>();
+ if (userShareWithAllRequestBody.getRoles() != null) {
+ for (RoleWithAudience role : userShareWithAllRequestBody.getRoles()) {
+ RoleWithAudienceDO roleDetails = new RoleWithAudienceDO();
+ roleDetails.setRoleName(role.getDisplayName());
+ roleDetails.setAudienceName(role.getAudience().getDisplay());
+ roleDetails.setAudienceType(role.getAudience().getType());
+ rolesList.add(roleDetails);
+ }
+ }
+ generalUserShareDO.setRoles(rolesList);
+
+ userSharingPolicyHandlerService.populateGeneralUserShare(generalUserShareDO);
+ }
+
+ /**
+ * Handles unsharing a user from specific organizations.
+ *
+ * @param userUnshareRequestBody Contains details for user unsharing.
+ */
+ public void unshareUser(UserUnshareRequestBody userUnshareRequestBody) throws UserSharingMgtException {
+
+ if (userUnshareRequestBody == null) {
+ throw new UserSharingMgtClientException(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();
+
+ // Set user criteria.
+ Map userCriteria = new HashMap<>();
+ UserCriteriaType userIds = new UserIdList(userUnshareRequestBody.getUserCriteria().getUserIds());
+ userCriteria.put(USER_IDS, userIds);
+ selectiveUserUnshareDO.setUserCriteria(userCriteria);
+
+ // Set organizations.
+ selectiveUserUnshareDO.setOrganizations(userUnshareRequestBody.getOrganizations());
+
+ userSharingPolicyHandlerService.populateSelectiveUserUnshare(selectiveUserUnshareDO);
+ }
+
+ /**
+ * Handles removing a user's shared access from all organizations.
+ *
+ * @param userUnshareWithAllRequestBody Contains details for removing shared access.
+ */
+ public void unshareUserWithAll(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody)
+ throws UserSharingMgtException {
+
+ if (userUnshareWithAllRequestBody == null) {
+ throw new UserSharingMgtClientException(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();
+
+ // Set user criteria.
+ Map userCriteria = new HashMap<>();
+ UserCriteriaType userIds = new UserIdList(userUnshareWithAllRequestBody.getUserCriteria().getUserIds());
+ userCriteria.put(USER_IDS, userIds);
+ generalUserUnshareDO.setUserCriteria(userCriteria);
+
+ userSharingPolicyHandlerService.populateGeneralUserUnshare(generalUserUnshareDO);
+ }
+
+ /**
+ * 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)
+ throws UserSharingMgtException {
+
+ if (userId == null) {
+ throw new UserSharingMgtClientException(INVALID_UUID_FORMAT.getCode(),
+ INVALID_UUID_FORMAT.getMessage(),
+ INVALID_UUID_FORMAT.getDescription());
+ }
+
+ 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);
+ }
+
+ /**
+ * 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)
+ throws UserSharingMgtException {
+
+ if (userId == null || orgId == null) {
+ throw new UserSharingMgtClientException(INVALID_UUID_FORMAT.getCode(),
+ INVALID_UUID_FORMAT.getMessage(),
+ INVALID_UUID_FORMAT.getDescription());
+ }
+
+ 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);
+ }
+
+ List responseRoles = new ArrayList<>();
+ List resultRoleDetails = result.getSharedRoles();
+
+ 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);
+ }
+
+ return new UserSharedRolesResponse().links(responseLinks).roles(responseRoles);
+ }
+
+ /**
+ * Constructs a success response object for a completed process.
+ *
+ * @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.
+ */
+ 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/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..9812374312
--- /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 static final 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
new file mode 100644
index 0000000000..70b810464f
--- /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,144 @@
+/*
+ * 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.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.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.UserSharingMgtClientException;
+import org.wso2.carbon.identity.organization.management.organization.user.sharing.exception.UserSharingMgtException;
+
+import javax.ws.rs.core.Response;
+
+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.
+ */
+public class UsersApiServiceImpl implements UsersApiService {
+
+ private final UsersApiServiceCore usersApiServiceCore;
+
+ public UsersApiServiceImpl() {
+
+ try {
+ this.usersApiServiceCore = UsersApiServiceCoreFactory.getUsersApiServiceCore();
+ } catch (IllegalStateException e) {
+ throw new RuntimeException("Error occurred while initiating UsersApiService.", e);
+ }
+ }
+
+ @Override
+ public Response processUserSharing(UserShareRequestBody userShareRequestBody) {
+
+ try {
+ usersApiServiceCore.shareUser(userShareRequestBody);
+ return Response.status(Response.Status.ACCEPTED)
+ .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING,
+ RESPONSE_DETAIL_USER_SHARE)).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException e) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
+ }
+ }
+
+ @Override
+ public Response processUserSharingAll(UserShareWithAllRequestBody userShareWithAllRequestBody) {
+
+ try {
+ usersApiServiceCore.shareUserWithAll(userShareWithAllRequestBody);
+ return Response.status(Response.Status.ACCEPTED)
+ .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING,
+ RESPONSE_DETAIL_USER_SHARE)).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException e) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
+ }
+ }
+
+ @Override
+ public Response processUserUnsharing(UserUnshareRequestBody userUnshareRequestBody) {
+
+ try {
+ usersApiServiceCore.unshareUser(userUnshareRequestBody);
+ return Response.status(Response.Status.ACCEPTED)
+ .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING,
+ RESPONSE_DETAIL_USER_UNSHARE)).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException e) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
+ }
+ }
+
+ @Override
+ public Response removeUserSharing(UserUnshareWithAllRequestBody userUnshareWithAllRequestBody) {
+
+ try {
+ usersApiServiceCore.unshareUserWithAll(userUnshareWithAllRequestBody);
+ return Response.status(Response.Status.ACCEPTED)
+ .entity(usersApiServiceCore.getProcessSuccessResponse(RESPONSE_STATUS_PROCESSING,
+ RESPONSE_DETAIL_USER_UNSHARE)).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException 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) {
+
+ try {
+ UserSharedOrganizationsResponse response = usersApiServiceCore.getSharedOrganizations(
+ userId, after, before, limit, filter, recursive);
+ return Response.ok().entity(response).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException 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) {
+
+ try {
+ UserSharedRolesResponse response = usersApiServiceCore.getSharedRoles(
+ userId, orgId, after, before, limit, filter, recursive);
+ return Response.ok().entity(response).build();
+ } catch (UserSharingMgtClientException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ } catch (UserSharingMgtException e) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).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/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..d2494cd92e
--- /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,624 @@
+openapi: 3.0.0
+info:
+ 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.
+ 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.
+
+ Scope(Permission) required: `internal_user_share`
+ 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: "SELECTED_ORG_ONLY"
+ roles:
+ - displayName: "role_2"
+ audience:
+ display: "My Org 1"
+ type: "organization"
+ - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f"
+ policy: "SELECTED_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.
+
+ Scope(Permission) required: `internal_user_share`
+ 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_ONLY"
+ 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.
+
+ Scope(Permission) required: `internal_user_unshare`
+ 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.
+
+ Scope(Permission) required: `internal_user_unshare`
+ 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.
+
+ Scope(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.
+
+ Scope(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: ["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.
+ 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: "SELECTED_ORG_ONLY"
+ roles:
+ - displayName: "role_2"
+ audience:
+ display: "My Org 1"
+ type: "organization"
+ - orgId: "a17b28ca-9f89-449c-ae27-fa955e66465f"
+ policy: "SELECTED_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_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.
+ items:
+ $ref: '#/components/schemas/RoleWithAudience'
+ example:
+ userCriteria:
+ userIds:
+ - "7a1b7d63-8cfc-4dc9-9332-3f84641b72d8"
+ - "5d2a1c84-9f7a-43cd-b12e-6e52d7f87e16"
+ policy: "ALL_EXISTING_ORGS_ONLY"
+ 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, shared type and pagination links for navigating results.
+ 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.
+ 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"
+ sharedType:
+ type: string
+ 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
+ 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.
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..6e199a7bec
--- /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.3.59-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 0ec8a92106..093bada693 100644
--- a/pom.xml
+++ b/pom.xml
@@ -629,6 +629,32 @@
${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.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
org.wso2.carbon.identity.api.server.organization.selfservice.common
@@ -846,13 +872,13 @@
1.0.15
- 1.1.12
+ 1.1.20
[1.0.0, 2.0.0)
- 1.4.56
+ 1.4.80
@@ -890,6 +916,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