Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareV2DO;
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.GetUserSharedOrgsDO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.PatchUserShareDO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedOrgsV2DO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareV2DO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserUnshareDO;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.UserSharePatchDO;

/**
* Implementation of the user sharing policy handler service v2.
Expand Down Expand Up @@ -60,14 +59,14 @@ public void populateGeneralUserUnshareV2(GeneralUserUnshareDO generalUserUnshare
}

@Override
public void updateRoleAssignmentV2(PatchUserShareDO patchUserShareDO) throws OrganizationManagementException {
public void updateRoleAssignmentV2(UserSharePatchDO userSharePatchDO) throws UserSharingMgtException {

// todo: Implement the logic to update role assignments for shared users in v2.
}

@Override
public ResponseSharedOrgsV2DO getUserSharedOrganizationsV2(GetUserSharedOrgsDO getUserSharedOrgsDO)
throws OrganizationManagementException {
throws UserSharingMgtException {

// todo: Implement the logic to get user shared organizations in v2.
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.GeneralUserShareV2DO;
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.GetUserSharedOrgsDO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.PatchUserShareDO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.ResponseSharedOrgsV2DO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserShareV2DO;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.SelectiveUserUnshareDO;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos.UserSharePatchDO;

/**
* Service that manages the user sharing policy handler.
Expand Down Expand Up @@ -74,20 +73,20 @@ public interface UserSharingPolicyHandlerServiceV2 {
* <p>
* This method does not support sharing users with new organizations.
*
* @param patchUserShareDO Patch request containing update operations to be applied to an existing user sharing
* @param userSharePatchDO Patch request containing update operations to be applied to an existing user sharing
* configuration.
* @throws OrganizationManagementException If an error occurs while processing the patch operations.
* @throws UserSharingMgtException If an error occurs while processing the patch operations.
*/
void updateRoleAssignmentV2(PatchUserShareDO patchUserShareDO) throws OrganizationManagementException;
void updateRoleAssignmentV2(UserSharePatchDO userSharePatchDO) throws UserSharingMgtException;

/**
* Retrieves the organizations shared with a specific user based on the provided criteria.
*
* @param getUserSharedOrgsDO Data object containing parameters for retrieving shared organizations.
* @return ResponseSharedOrgsV2DO Object containing the list of organizations shared with the user and related
* metadata.
* @throws OrganizationManagementException If an error occurs while retrieving the shared organizations.
* @throws UserSharingMgtException If an error occurs while retrieving the shared organizations.
*/
ResponseSharedOrgsV2DO getUserSharedOrganizationsV2(GetUserSharedOrgsDO getUserSharedOrgsDO)
throws OrganizationManagementException;
throws UserSharingMgtException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
/**
* Enum representing the types of user share role assignment operations. Applicable to role assignment updates.
*/
public enum RoleAssignmentOperation {
public enum UserSharePatchOperation {

ADD("add"),
REMOVE("remove");

private final String value;

RoleAssignmentOperation(String value) {
UserSharePatchOperation(String value) {

this.value = value;
}
Expand All @@ -37,16 +37,16 @@ public String getValue() {
return value;
}

public static RoleAssignmentOperation fromValue(String value) {
public static UserSharePatchOperation fromValue(String value) {

for (RoleAssignmentOperation operation : RoleAssignmentOperation.values()) {
for (UserSharePatchOperation operation : UserSharePatchOperation.values()) {
if (operation.getValue().equals(value)) {
return operation;
}
}
// Throw an exception with a helpful message listing valid operations.
String validOperations = String.join(", ",
java.util.Arrays.stream(RoleAssignmentOperation.values())
java.util.Arrays.stream(UserSharePatchOperation.values())
.map(Enum::name)
.toArray(String[]::new));
throw new IllegalArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ public class GetUserSharedOrgsDO {
private Boolean recursive;
private List<String> attributes;

public GetUserSharedOrgsDO() {

}

public GetUserSharedOrgsDO(String userId, String parentOrgId) {

this.userId = userId;
this.parentOrgId = parentOrgId;
}

public GetUserSharedOrgsDO(String userId, String parentOrgId, String before, String after, String filter,
Integer limit,
Boolean recursive, List<String> attributes) {
Integer limit, Boolean recursive, List<String> attributes) {

this.userId = userId;
this.parentOrgId = parentOrgId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,34 @@

package org.wso2.carbon.identity.organization.management.organization.user.sharing.models.dos;

import org.wso2.carbon.identity.organization.management.organization.user.sharing.constant.RoleAssignmentOperation;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.constant.UserSharePatchOperation;

/**
* This class represents the user share update operation in user-sharing v2.
*/
public class RoleAssignmentUpdateDO {
public class PatchOperationDO {

private RoleAssignmentOperation operation;
private UserSharePatchOperation operation;
private String path;
private Object values;

public RoleAssignmentUpdateDO(RoleAssignmentOperation operation, String path, Object values) {
public PatchOperationDO() {

}

public PatchOperationDO(UserSharePatchOperation operation, String path, Object values) {

this.operation = operation;
this.path = path;
this.values = values;
}

public RoleAssignmentOperation getOperation() {
public UserSharePatchOperation getOperation() {

return operation;
}

public void setOperation(
RoleAssignmentOperation operation) {
public void setOperation(UserSharePatchOperation operation) {

this.operation = operation;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.organization.management.organization.user.sharing.models.dos;

import org.wso2.carbon.identity.organization.management.organization.user.sharing.models.usercriteria.UserCriteriaType;

import java.util.List;

/**
* Model that represents the user share patch data object.
*/
public class UserSharePatchDO extends BaseUserShareDO<UserCriteriaType> {

private List<PatchOperationDO> patchOperations;

public List<PatchOperationDO> getPatchOperations() {

return patchOperations;
}

public void setPatchOperations(List<PatchOperationDO> patchOperations) {

this.patchOperations = patchOperations;
}
}