Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API Support to Parent Organization Admins to Share Users with Sub Organizations #784

Merged
merged 36 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
11e7260
Initiate user sharing api
BimsaraBodaragama Oct 29, 2024
81a1e5e
Update poms
BimsaraBodaragama Oct 29, 2024
f11cd9d
Initiate UsersApiServiceCore Implementation
BimsaraBodaragama Oct 29, 2024
8166354
Implement UsersApiServiceCore for selective share
BimsaraBodaragama Oct 29, 2024
d8ce2b7
Implement UsersApiServiceCore for all types of shares and unshares
BimsaraBodaragama Oct 29, 2024
e699962
Set version of org-mgt to the latest release
BimsaraBodaragama Oct 29, 2024
96da282
Set unique identifiers to the beans in user-sharing cxf.xml
BimsaraBodaragama Oct 29, 2024
a0bf83f
Change setters and getters of the UserSharingMgtOSGIServiceFactory an…
BimsaraBodaragama Oct 29, 2024
f74b716
Change policy enums with _
BimsaraBodaragama Oct 30, 2024
7d71571
Add new policies
BimsaraBodaragama Oct 31, 2024
6dda458
Refine UsersApiServiceCore to support new DOs in identity-org-mgt
BimsaraBodaragama Nov 2, 2024
96887a1
API Support for Generic user criteria
BimsaraBodaragama Nov 12, 2024
0573ed2
Directly assign policy to PolicyEnum form API
BimsaraBodaragama Nov 13, 2024
b1db7e9
Rename the methods
BimsaraBodaragama Nov 15, 2024
5c35caf
Rename the modules
BimsaraBodaragama Nov 15, 2024
3a44a44
Move PolicyEnum from user.sharing to resource.sharing
BimsaraBodaragama Nov 20, 2024
b6f226b
Adapt to renaming of userCriteria to usercriteria
BimsaraBodaragama Nov 20, 2024
76098e0
Add usercriteria to unshare
BimsaraBodaragama Jan 14, 2025
aabcfb0
Merge master
BimsaraBodaragama Jan 23, 2025
824b0c6
rename userIds to userIdList.
BimsaraBodaragama Jan 25, 2025
51f83fa
update licence and pom versions.
BimsaraBodaragama Jan 25, 2025
cabd548
address comments.
BimsaraBodaragama Jan 25, 2025
1d9eb50
Remove Spring
sahandilshan Jan 25, 2025
e7646da
format.
BimsaraBodaragama Jan 25, 2025
f8720c1
return response.
BimsaraBodaragama Jan 25, 2025
aa86e6b
Introduce GETs
BimsaraBodaragama Jan 26, 2025
524294c
format.
BimsaraBodaragama Jan 26, 2025
d3f84fd
api def change.
BimsaraBodaragama Jan 26, 2025
8dc1bd5
Remove unnecessary errors and spring dependency.
BimsaraBodaragama Jan 26, 2025
869393b
renaming of the exception classes.
BimsaraBodaragama Jan 26, 2025
075ad4f
update pom.
BimsaraBodaragama Jan 26, 2025
9d57eac
Merge branch 'master' into feature/user-share-new
BimsaraBodaragama Jan 26, 2025
870d844
update pom to 1.3.56-SNAPSHOT.
BimsaraBodaragama Jan 26, 2025
ab89f0d
Update scopes in yaml.
BimsaraBodaragama Jan 26, 2025
bfbac18
update poms for next version.
BimsaraBodaragama Jan 26, 2025
a6e7b8b
update poms after org-mgt release.
BimsaraBodaragama Jan 27, 2025
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
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.organization.user.sharing.management</artifactId>
<version>1.3.30-SNAPSHOT</version>
BimsaraBodaragama marked this conversation as resolved.
Show resolved Hide resolved
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.organization.user.sharing.management.common</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.organization.user.sharing</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.resource.sharing.policy.management</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
BimsaraBodaragama marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -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.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.UserSharingPolicyHandlerService;

BimsaraBodaragama marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* 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.
ERROR_CODE_USER_NOT_FOUND("60000",
"Invalid user identifier is provided.",
"Invalid user identifier %s is provided."),
ERROR_CODE_INVALID_INVITATION("60001",
"Invalid invitation.",
"Provided invitation with the id %s is invalid."),
ERROR_CODE_INVALID_CONFIRMATION_CODE("60002",
"Invalid confirmation code.",
"Could not validate the confirmation code %s."),
ERROR_CODE_MULTIPLE_INVITATIONS_FOR_USER("60003",
"Unable to create the invitation.",
"Multiple invitations found for users given in the list %s."),
ERROR_CODE_UNSUPPORTED_LIMIT("60004",
ERROR_UNSUPPORTED_PARAM,
"Limit param is not supported yet."),
ERROR_CODE_UNSUPPORTED_OFFSET("60005",
ERROR_UNSUPPORTED_PARAM,
"Offset param is not supported yet."),
ERROR_CODE_UNSUPPORTED_SORT_ORDER("60006",
ERROR_UNSUPPORTED_PARAM,
"Sort order param is not supported yet."),
ERROR_CODE_UNSUPPORTED_SORT_BY("60007",
ERROR_UNSUPPORTED_PARAM,
"Sort order param is not supported yet."),
ERROR_CODE_ACTIVE_INVITATION_AVAILABLE("60008",
"Invitation already exists.",
"An active invitation already exists for the user %s."),
ERROR_CODE_INVALID_FILTER("60009",
"Invalid filter.",
"Provided filter %s is not valid."),
ERROR_CODE_INVALID_APPLICATION("60009",
"Invalid application provided.",
"One of the provided applications with roles are not valid."),
ERROR_CODE_INVALID_CONFIRMATION_CODE_FOR_ACCEPTANCE("60010",
"Invalid confirmation code.",
"Could not accept the invitation since the confirmation code %s is not valid."),
ERROR_CODE_INVALID_USER("60011",
"Invalid user provided.",
"Invalid user is provided."),
ERROR_CODE_EXISTING_USER("60012",
"Authenticated user exist.",
"The authenticated user is already available in the organization."),
ERROR_CODE_INVALID_ROLE("60013",
"Invalid role list provided.",
"The provided role lists are not valid."),
ERROR_CODE_INVALID_USER_INFORMATION("60014",
"Unable to create an invitation to all the users given in the list.",
"User invitation creation failed for the users: %s"),
ERROR_CODE_INVALID_GROUP("60015",
"Invalid group list provided.",
"The provided group lists are not valid."),

// Server errors.
ERROR_CODE_CREATE_INVITATION("65001",
"Unable to create the invitation.",
"Could not create the invitation to the user %s."),
ERROR_CODE_GET_INVITATIONS("65002",
"Unable to retrieve the invitations.",
"Could not retrieve the invitations for the organization."),
ERROR_CODE_VALIDATE_INVITATION("65003",
"Unable to validate the invitation.",
"Could not validate the invitation with the confirmation code %s."),
ERROR_CODE_DELETE_INVITATION("65004",
"Unable to delete the invitation.",
"Could not delete the invitation with the id %s."),
ERROR_CODE_ACCEPT_INVITATION("65005",
"Unable to accept the invitation.",
"Could not accept the invitation with the confirmation code %s."),
ERROR_CODE_NOT_IMPLEMENTED("65100",
"Not Implemented.",
"Method is not implemented.");

BimsaraBodaragama marked this conversation as resolved.
Show resolved Hide resolved

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;
}
}
}
Loading
Loading