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 30 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,99 @@
<?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>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,98 @@
/*
* 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.");

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