-
Notifications
You must be signed in to change notification settings - Fork 66
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
Introduce Resource Sharing Policy Management Component #416
Open
BimsaraBodaragama
wants to merge
51
commits into
wso2-extensions:main
Choose a base branch
from
BimsaraBodaragama:component/resource-sharing-policy-mgt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
91de7f1
cmp_resource: Initiate Resource Sharing policy management Component
BimsaraBodaragama d528223
cmp_resource: Checkstyle format
BimsaraBodaragama 350e476
cmp_resource: Introduce PolicyEnum to resource sharing policy manager
BimsaraBodaragama 7b44434
cmp_resource: Introduce add resource sharing policy record
BimsaraBodaragama 262ce9f
cmp_resource: Introduce add shared resource attribute record
BimsaraBodaragama 142c6c2
cmp_resource: Make adding of shared resource attributes dumb
BimsaraBodaragama 341a3f2
cmp_resource: Add new delete methods for deleting resource sharing po…
BimsaraBodaragama 12dbac4
cmp_resource: Remove deleting resource sharing policy by querying its…
BimsaraBodaragama f155832
cmp_resource: Remove deleting resource sharing policy by querying its…
BimsaraBodaragama 1d66d83
cmp_resource: Add a batch insert with transaction when adding shared …
BimsaraBodaragama 9b52181
cmp_resource: Implement GET to SharedResourceAttributes
BimsaraBodaragama 7c3dc5d
cmp_resource: Implement GET to SharedResourceAttributes - Part 2
BimsaraBodaragama 789504e
cmp_resource: Support to implement get sharing policy
BimsaraBodaragama be9407a
cmp_resource: Put the ids in the models to reference UM_IDs in the DB…
BimsaraBodaragama 1e4e1fc
cmp_resource: Restructured SharedResourceAttribute
BimsaraBodaragama ff15b6c
cmp_resource: Implement GETTERS for the SharedResourceAttributes
BimsaraBodaragama 4fa453e
cmp_resource: Implement GETTERS for the ResourceSharingPolicies
BimsaraBodaragama 84eb221
cmp_resource: Implement DELETE with type and id
BimsaraBodaragama be18f1b
cmp_resource: Restructure method sequence in the ResourceSharingPolic…
BimsaraBodaragama 33018fa
cmp_resource: Rename models to model
BimsaraBodaragama 1a6dacc
cmp_resource: Remove Builders from the GETs and replaced them with se…
BimsaraBodaragama 63b63f3
cmp_resource: Refactor query in DELETE of ResourceSharingPolicy
BimsaraBodaragama 56f7967
cmp_resource: Refactor deletions to support only from sharing initiat…
BimsaraBodaragama 1ea53cc
cmp_resource: Unit test suits
BimsaraBodaragama 511730c
cmp_resource: Unit test suits refactor
BimsaraBodaragama 74a581c
cmp_resource: Restructure the method sequence in the component.
BimsaraBodaragama 547de22
cmp_resource: Restructure the method sequence in the component - Part 2.
BimsaraBodaragama 92336b1
cmp_resource: Refine test constants.
BimsaraBodaragama a795981
cmp_resource: Resolve dependencies.
BimsaraBodaragama 16404d7
cmp_resource: Resolve Test Exclusions.
BimsaraBodaragama 56ce388
cmp_resource: Make export packaged specific.
BimsaraBodaragama c30c9d5
cmp_resource: Revisit privatising packages.
BimsaraBodaragama 78708e3
cmp_user-share: Resolve dependencies.
BimsaraBodaragama c5f9d67
cmp_resource: Rollback dependencies
BimsaraBodaragama 0463865
cmp_resource: Re-resolve dependencies (Re did the dependency resolvin…
BimsaraBodaragama 8ec95fa
cmp_resource: Clear up unused resources.
BimsaraBodaragama 6153882
cmp_resource: Restructure with applicable attributes to policies and …
BimsaraBodaragama 1de61d8
cmp_resource: Restructure the ResourceTypes to hold the applicable Sh…
BimsaraBodaragama d3f58a7
cmp_resource: Refine tests.
BimsaraBodaragama a4a4230
cmp_resource: Improve javadoc comments on interfaces following the CS…
BimsaraBodaragama bd2a43f
cmp_resource: Refine constants.
BimsaraBodaragama 91b1175
cmp_resource: Update formatting.
BimsaraBodaragama b33e8b3
cmp_resource: Make safe for sql injections.
BimsaraBodaragama b3a92a7
cmp_resource: Rename deleteRequestInitiatedOrgId -> sharingPolicyInit…
BimsaraBodaragama c1f5b5f
cmp_resource: GET ResourceSharingPolicyById with FetchSingleRecord in…
BimsaraBodaragama 1a7584e
cmp_resource: Format - GET ResourceSharingPolicyById with FetchSingle…
BimsaraBodaragama edcad1c
cmp_resource: Make GET ResourceSharingPolicyById Optional
BimsaraBodaragama ee5eca2
cmp_resource: New method to add resource sharing policy and attribute…
BimsaraBodaragama 0439ba5
cmp_resource: New method to get resource sharing policy and attribute…
BimsaraBodaragama 170abc7
cmp_resource: Remove generic validation methods for inputs and only a…
BimsaraBodaragama dd427f8
cmp_resource: Introduce organization scope to PolicyEnum and rename p…
BimsaraBodaragama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
188 changes: 188 additions & 0 deletions
188
components/org.wso2.carbon.identity.organization.resource.sharing.policy.management/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
~ | ||
~ WSO2 LLC. licenses this file to you under the Apache License, | ||
~ Version 2.0 (the "License"); you may not use this file except | ||
~ in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
<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"> | ||
<parent> | ||
<groupId>org.wso2.carbon.identity.organization.management</groupId> | ||
<artifactId>identity-organization-management</artifactId> | ||
<version>1.4.54</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>org.wso2.carbon.identity.organization.resource.sharing.policy.management</artifactId> | ||
<name>WSO2 - Organization Resource Sharing Policy Management Service</name> | ||
<packaging>bundle</packaging> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wso2.carbon</groupId> | ||
<artifactId>org.wso2.carbon.utils</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.organization.management.core</groupId> | ||
<artifactId>org.wso2.carbon.identity.organization.management.service</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.organization.management</groupId> | ||
<artifactId>org.wso2.carbon.identity.organization.management.ext</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.organization.management</groupId> | ||
<artifactId>org.wso2.carbon.identity.organization.management.role.management.service</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.application.authentication.framework</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.utils</groupId> | ||
<artifactId>org.wso2.carbon.database.utils</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon</groupId> | ||
<artifactId>org.wso2.carbon.user.core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon</groupId> | ||
<artifactId>org.wso2.carbon.utils</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.event</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.role.v2.mgt.core</artifactId> | ||
</dependency> | ||
<!--Test Dependencies--> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<instructions> | ||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> | ||
<Bundle-Name>${project.artifactId}</Bundle-Name> | ||
<Bundle-Description>Organization Resource Sharing Policy Service Bundle</Bundle-Description> | ||
<Private-Package> | ||
org.wso2.carbon.identity.organization.resource.sharing.policy.management.internal | ||
BimsaraBodaragama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Private-Package> | ||
<Export-Package> | ||
!org.wso2.carbon.identity.organization.resource.sharing.policy.management.internal, | ||
org.wso2.carbon.identity.organization.resource.sharing.policy.management.*; | ||
version="${identity.organization.management.exp.pkg.version}", | ||
</Export-Package> | ||
dhaura marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Import-Package> | ||
dhaura marked this conversation as resolved.
Show resolved
Hide resolved
|
||
javax.sql, | ||
org.apache.commons.logging; version="${org.apache.commons.logging.imp.pkg.version.range}", | ||
org.apache.commons.collections; version="${org.apache.commons.collections.imp.pkg.version.range}", | ||
org.apache.commons.lang;version="${org.apache.commons.lang.imp.pkg.version.range}", | ||
org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}", | ||
org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}", | ||
org.wso2.carbon.context;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.database.utils.jdbc;version="${org.wso2.carbon.database.utils.version.range}", | ||
org.wso2.carbon.database.utils.jdbc.exceptions;version="${org.wso2.carbon.database.utils.version.range}", | ||
org.wso2.carbon.identity.application.common;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.application.common.model;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.application.mgt;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.application.authentication.framework.util; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.core;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.core.util;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.role.v2.mgt.core;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.role.v2.mgt.core.exception;version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.organization.management.service; version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.service.util;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.service.exception;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.service.model; version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.service.constant;version="${org.wso2.identity.organization.mgt.core.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.role.management.service;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.role.management.service.models;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.organization.management.ext;version="${org.wso2.identity.organization.mgt.imp.pkg.version.range}", | ||
org.wso2.carbon.user.api;version="${carbon.user.api.imp.pkg.version.range}", | ||
org.wso2.carbon.user.core;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.user.core.common;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.user.core.listener;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.user.core.service;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.user.core.util;version="${carbon.kernel.package.import.version.range}", | ||
org.wso2.carbon.identity.event.handler; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.event.event; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.event; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.event.services; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon;version="${carbon.kernel.package.import.version.range}", | ||
</Import-Package> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>${jacoco.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<!-- attached to Maven test phase --> | ||
<execution> | ||
<id>report</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
119 changes: 119 additions & 0 deletions
119
.../organization/resource/sharing/policy/management/ResourceSharingPolicyHandlerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.wso2.carbon.identity.organization.resource.sharing.policy.management; | ||
|
||
import org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException; | ||
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementServerException; | ||
import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.ResourceType; | ||
import org.wso2.carbon.identity.organization.resource.sharing.policy.management.constant.SharedAttributeType; | ||
import org.wso2.carbon.identity.organization.resource.sharing.policy.management.exception.ResourceSharingPolicyMgtServerException; | ||
import org.wso2.carbon.identity.organization.resource.sharing.policy.management.models.ResourceSharingPolicy; | ||
import org.wso2.carbon.identity.organization.resource.sharing.policy.management.models.SharedResourceAttribute; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Service that manages the core service for managing resource sharing policies. | ||
*/ | ||
public interface ResourceSharingPolicyHandlerService { | ||
BimsaraBodaragama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Saves the resource sharing policy to the data store and return the record id. | ||
*/ | ||
BimsaraBodaragama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
int addResourceSharingPolicy(ResourceSharingPolicy resourceSharingPolicy) | ||
throws OrganizationManagementServerException, ResourceSharingPolicyMgtServerException, DataAccessException; | ||
|
||
/** | ||
* Deletes a resource sharing policy record by ID. | ||
*/ | ||
boolean deleteResourceSharingPolicyRecordById(int resourceSharingPolicyId) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Deletes a resource sharing policy record by resource Type and ID. | ||
*/ | ||
boolean deleteResourceSharingPolicyByResourceTypeAndId(ResourceType resourceType, String resourceId) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Retrieves resource sharing policies for the given organization IDs. | ||
*/ | ||
List<ResourceSharingPolicy> getResourceSharingPolicies(List<String> organizationIds) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Retrieves resource sharing policies for the given organization IDs grouped by resource type. | ||
*/ | ||
Map<ResourceType, List<ResourceSharingPolicy>> getResourceSharingPoliciesGroupedByResourceType( | ||
List<String> organizationIds) | ||
BimsaraBodaragama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
throws ResourceSharingPolicyMgtServerException; | ||
BimsaraBodaragama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Retrieves resource sharing policies for the given organization IDs grouped by resource policy holding org IDs. | ||
*/ | ||
Map<String, List<ResourceSharingPolicy>> getResourceSharingPoliciesGroupedByPolicyHoldingOrgId( | ||
List<String> organizationIds) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Saves the shared resource attributes to the data store. | ||
*/ | ||
void addSharedResourceAttributes(List<SharedResourceAttribute> sharedResourceAttributes) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Deletes shared resource attributes for a given resource sharing policy ID. | ||
*/ | ||
boolean deleteSharedResourceAttributesByResourceSharingPolicyId(int resourceSharingPolicyId, | ||
SharedAttributeType sharedAttributeType) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Deletes shared resource attributes by attribute Type and ID. | ||
*/ | ||
boolean deleteSharedResourceAttributeByAttributeTypeAndId(SharedAttributeType attributeType, String attributeId) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Retrieves shared resource attributes for a given resource sharing policy ID. | ||
*/ | ||
List<SharedResourceAttribute> getSharedResourceAttributesBySharingPolicyId(int resourceSharingPolicyId) | ||
throws ResourceSharingPolicyMgtServerException, DataAccessException; | ||
|
||
/** | ||
* Retrieves shared resource attributes for a given attribute Type. | ||
*/ | ||
List<SharedResourceAttribute> getSharedResourceAttributesByType(SharedAttributeType attributeType) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Retrieves shared resource attributes for a given attribute ID. | ||
*/ | ||
List<SharedResourceAttribute> getSharedResourceAttributesById(String attributeId) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
/** | ||
* Retrieves shared resource attributes for a given attribute Type and ID. | ||
*/ | ||
List<SharedResourceAttribute> getSharedResourceAttributesByTypeAndId(SharedAttributeType attributeType, | ||
String attributeId) | ||
throws ResourceSharingPolicyMgtServerException; | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to bump the version before merging