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

[Draft] Org visibility initial PR #12771

Open
wants to merge 92 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
62cd1b1
Add initial implementation
chamilaadhi Aug 13, 2024
413a84a
Merge pull request #12512 from chamilaadhi/org_visibility
chamilaadhi Aug 13, 2024
6930c4e
Add api org visibility to registry property
chamilaadhi Aug 16, 2024
197b95c
Add application sharing with the organization
chamilaadhi Aug 17, 2024
9514f90
Remove invalid files
chamilaadhi Aug 17, 2024
bdbab23
Merge pull request #12517 from chamilaadhi/org_visibility
chamilaadhi Aug 17, 2024
74ce0a9
Add application visibility info to the payload
chamilaadhi Aug 21, 2024
44adec3
Allow api visibility to admin users
chamilaadhi Aug 21, 2024
20abc2d
Merge pull request #12519 from chamilaadhi/org_visibility
chamilaadhi Aug 21, 2024
9b4b931
Fix bug
chamilaadhi Aug 21, 2024
6a13494
Merge pull request #12521 from chamilaadhi/org_visibility
chamilaadhi Aug 21, 2024
cbbec05
Add subscription tiers visibility by org
chamilaadhi Aug 23, 2024
6f04ad5
Merge pull request #12523 from chamilaadhi/org_visibility
chamilaadhi Aug 23, 2024
75f595d
Fix issues
chamilaadhi Aug 28, 2024
3a95871
Merge pull request #12528 from chamilaadhi/test-org
chamilaadhi Aug 28, 2024
364cec9
Fix admin dev portal api loading issue
chamilaadhi Aug 29, 2024
ba78056
Add indexed document modification logic
chamilaadhi Aug 29, 2024
2aa39f2
Merge pull request #12529 from chamilaadhi/org_visibility
chamilaadhi Aug 29, 2024
78bb1e7
Fix bug
chamilaadhi Sep 5, 2024
788ee7e
Merge pull request #12542 from chamilaadhi/org_visibility
chamilaadhi Sep 6, 2024
c7f06ad
Merge remote-tracking branch 'upstream/org_visibility' into org_test
chamilaadhi Sep 6, 2024
fca7dd0
Merge pull request #12549 from chamilaadhi/org_test
chamilaadhi Sep 9, 2024
66ba661
Fix multiple status display issue
chamilaadhi Sep 12, 2024
1fa232f
Fix shared application view issue
chamilaadhi Sep 12, 2024
cd392b5
Merge pull request #12559 from chamilaadhi/org_visibility
chamilaadhi Sep 12, 2024
e28bc64
Introduce config to enable org related visibility
chamilaadhi Sep 18, 2024
e1f97f1
Add dev portal org visibility to seperate section
chamilaadhi Sep 18, 2024
034ca35
Fix bug
chamilaadhi Sep 18, 2024
134b2c0
Fix bug
chamilaadhi Sep 18, 2024
60441da
Merge pull request #12572 from chamilaadhi/org_visibility
chamilaadhi Sep 18, 2024
62c00fc
Add capability to append org id and org name to dev portal token urls
chamilaadhi Sep 24, 2024
a33a3dd
Backend for keymanager visibility
chamilaadhi Oct 2, 2024
1ea20af
Revert url template change
chamilaadhi Oct 2, 2024
8a875bc
Format
chamilaadhi Oct 2, 2024
1c4e79a
Merge pull request #12592 from chamilaadhi/org_visibility
chamilaadhi Oct 2, 2024
9477c98
Refactor subcription visibility db
chamilaadhi Oct 4, 2024
4b34048
Merge pull request #12634 from chamilaadhi/org_visibility
chamilaadhi Oct 4, 2024
48ec34a
Fix app keys loading issue for shared apps
chamilaadhi Oct 7, 2024
d892178
Merge pull request #12640 from chamilaadhi/org_visibility
chamilaadhi Oct 7, 2024
88b7607
Add capability to use multiple keymanagers with same issuer
chamilaadhi Oct 9, 2024
27b3d21
Merge pull request #12652 from chamilaadhi/org_visibility
chamilaadhi Oct 9, 2024
6a6d5ce
Add org with spaces in the name
chamilaadhi Oct 10, 2024
4ca72b4
Merge pull request #12653 from chamilaadhi/org_visibility
chamilaadhi Oct 10, 2024
9081ab9
Fix orgs with space
chamilaadhi Oct 11, 2024
867d569
Merge pull request #12655 from chamilaadhi/org_visibility
chamilaadhi Oct 11, 2024
763494a
Provide config to set claim to select the organization info
chamilaadhi Oct 15, 2024
10c523b
Merge pull request #12670 from chamilaadhi/org_visibility
chamilaadhi Oct 15, 2024
1c6916b
Fix api overview page visibility
chamilaadhi Oct 16, 2024
08f9959
Merge pull request #12675 from chamilaadhi/org_visibility
chamilaadhi Oct 16, 2024
9d8bb3d
Merge remote-tracking branch 'upstream/master' into org_visibility_ma…
chamilaadhi Nov 22, 2024
10b0c64
Merge pull request #12707 from chamilaadhi/org_visibility
chamilaadhi Nov 22, 2024
60c483e
Fix issues related to unit test failures -carbon.apimgt.persistence
RusJaI Nov 22, 2024
3eafcbc
Fix issues related to unit test failures - carbon.apimgt.impl
RusJaI Nov 24, 2024
12961fb
Fix issues related to unit test failures - carbon.apimgt.gateway
RusJaI Nov 25, 2024
41002da
Undo expanding waiting time
RusJaI Nov 25, 2024
442cc04
Update language level for apimgt.impl component. This is not affected…
RusJaI Nov 25, 2024
e0c2c6b
Fix unit test related issues
RusJaI Nov 26, 2024
0ccafa1
Merge pull request #12711 from RusJaI/org_visibility
chamilaadhi Nov 26, 2024
e907f6d
Fix unified API search for APIs across organizations
RusJaI Dec 2, 2024
946c893
Fix tag based search
RusJaI Dec 3, 2024
2565f11
Fix api state based search
RusJaI Dec 4, 2024
011aab7
Fix api category based search
RusJaI Dec 4, 2024
f6aae23
Fix the visibility of API in Store for admin in same domain
RusJaI Dec 9, 2024
134262e
Maintain existing behavior when org visibility is not enabled
RusJaI Dec 10, 2024
a237ec8
save visibility value as a property for api artifacts
RusJaI Dec 12, 2024
99ecfb4
Introduce constants for search attribute fields
RusJaI Dec 27, 2024
354b156
Refactor the function which adds org visibility value for API Artifacts
RusJaI Dec 27, 2024
ecd772f
Merge pull request #12717 from RusJaI/org_visibility
chamilaadhi Jan 2, 2025
012f9f5
Fix NPE in product listing in dev portal
chamilaadhi Jan 7, 2025
6da5c7f
Merge pull request #12738 from chamilaadhi/org_visibility
chamilaadhi Jan 7, 2025
3369374
Fix dev portal rest api search
chamilaadhi Jan 8, 2025
7887bc2
Merge pull request #12739 from chamilaadhi/org_visibility
chamilaadhi Jan 8, 2025
41049bb
Merge branch 'org_visibility' into master-new-merge-2
chamilaadhi Jan 8, 2025
b4144a2
Merge branch 'master-new-merge-2' into org_mst
chamilaadhi Jan 9, 2025
bd27617
Merge pull request #12743 from chamilaadhi/org_mst
chamilaadhi Jan 9, 2025
8a25a77
Fix duplicate keymanager name issue
chamilaadhi Jan 10, 2025
0a13353
Merge pull request #12744 from chamilaadhi/org_visibility
chamilaadhi Jan 10, 2025
b58d3a2
Fix NPE
chamilaadhi Jan 11, 2025
43b2f8d
Merge pull request #12745 from chamilaadhi/org_visibility
chamilaadhi Jan 11, 2025
40ba285
Remove org visibilty in business policy
chamilaadhi Jan 16, 2025
5741008
Merge pull request #12748 from chamilaadhi/org_visibility_remove_poli…
chamilaadhi Jan 17, 2025
6aacca7
Backend for managing organization
chamilaadhi Jan 21, 2025
aff7001
Merge pull request #12752 from chamilaadhi/org_visibility
chamilaadhi Jan 21, 2025
0a545c7
Restructure org persistance
chamilaadhi Jan 23, 2025
6351df7
Merge pull request #12758 from chamilaadhi/org_visibility
chamilaadhi Jan 23, 2025
e894e09
Add improvement to login flow
chamilaadhi Jan 23, 2025
72034f1
Merge pull request #12759 from chamilaadhi/org_visibility
chamilaadhi Jan 23, 2025
479ebe8
Fix app sharing issue
chamilaadhi Jan 23, 2025
17a946a
Merge pull request #12760 from chamilaadhi/org_visibility
chamilaadhi Jan 23, 2025
f4acefe
Add claim check
chamilaadhi Jan 25, 2025
11c595b
Merge pull request #12769 from chamilaadhi/org_visibility
chamilaadhi Jan 25, 2025
da6a6bf
Merge remote-tracking branch 'upstream/org_visibility' into master-ne…
chamilaadhi Jan 25, 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
Expand Up @@ -20,6 +20,7 @@
import org.wso2.carbon.apimgt.api.dto.GatewayVisibilityPermissionConfigurationDTO;
import org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO;
import org.wso2.carbon.apimgt.api.dto.KeyManagerPermissionConfigurationDTO;
import org.wso2.carbon.apimgt.api.dto.OrganizationDetailsDTO;
import org.wso2.carbon.apimgt.api.model.APICategory;
import org.wso2.carbon.apimgt.api.model.Application;
import org.wso2.carbon.apimgt.api.model.ApplicationInfo;
Expand Down Expand Up @@ -603,4 +604,46 @@ List<KeyManagerConfigurationDTO> getGlobalKeyManagerConfigurations(String organi
* @throws APIManagementException If retrieval fails.
*/
LLMProvider getLLMProvider(String organization, String llmProviderId) throws APIManagementException;

/**
*
* Retrieves list of organizations available for the given parent organization.
*
* @param parentOrgId parent organization id
* @param tenantDomain super domain
* @return organization list
*/
List<OrganizationDetailsDTO> getOrganizations(String parentOrgId, String tenantDomain) throws APIManagementException;

/**
* Add new organization
* @param orgDto organization details
* @return added organization
*/
OrganizationDetailsDTO addOrganization(OrganizationDetailsDTO orgDto) throws APIManagementException;

/**
* Get organization details
* @param organizationId organization id
* @param tenantDomain tenant domain
* @return
* @throws APIManagementException
*/
OrganizationDetailsDTO getOrganizationDetails(String organizationId, String tenantDomain)
throws APIManagementException;

/**
* Update organization details
* @param organizationInfoDTO request object
* @return updated organization info
* @throws APIManagementException
*/
OrganizationDetailsDTO updateOrganization(OrganizationDetailsDTO organizationInfoDTO) throws APIManagementException;

/**
* Delete organization
* @param organizationId organization
* @param tenantDomain tenantDomain
*/
void deleteOrganization(String organizationId, String tenantDomain) throws APIManagementException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.wso2.carbon.apimgt.api.model.Identifier;
import org.wso2.carbon.apimgt.api.model.Monetization;
import org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo;
import org.wso2.carbon.apimgt.api.model.OrganizationInfo;
import org.wso2.carbon.apimgt.api.model.ResourceFile;
import org.wso2.carbon.apimgt.api.model.Scope;
import org.wso2.carbon.apimgt.api.model.SubscribedAPI;
Expand Down Expand Up @@ -461,12 +462,13 @@ OAuthApplicationInfo updateAuthClient(String userId, Application application,
* @param offset
* @param groupingId the groupId to which the applications must belong.
* @param organization Identifier of an organization
* @param sharedOrganization
* @return Applications
* @throws APIManagementException if failed to applications for given subscriber
*/

Application[] getApplicationsWithPagination(Subscriber subscriber, String groupingId, int start, int offset,
String search, String sortColumn, String sortOrder, String organization)
String search, String sortColumn, String sortOrder, String organization, String sharedOrganization)
throws APIManagementException;

/**
Expand Down Expand Up @@ -901,4 +903,26 @@ Map<String, Environment> getGatewayEnvironmentsByOrganization(String organizatio
* @throws APIManagementException
*/
boolean removalKeys(Application application, String keyMappingId, String xWSO2Tenant) throws APIManagementException;

/**
* @param searchQuery search query. ex : provider:admin
* @param organizationInfo Identifier of an organization
* @param start starting number
* @param end ending number
* @return
* @throws APIManagementException
*/
Map<String, Object> searchPaginatedAPIs(String searchQuery, OrganizationInfo organizationInfo, int start, int end,
String sortBy, String sortOrder) throws APIManagementException;

/**
* @param searchQuery search query
* @param organizationInfo Information about the organization
* @param start
* @param end
* @return
* @throws APIManagementException
*/
Map<String, Object> searchPaginatedContent(String searchQuery, OrganizationInfo organizationInfo, int start, int end)
throws APIManagementException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.wso2.carbon.apimgt.api.dto.CertificateMetadataDTO;
import org.wso2.carbon.apimgt.api.dto.ClientCertificateDTO;
import org.wso2.carbon.apimgt.api.dto.EnvironmentPropertiesDTO;
import org.wso2.carbon.apimgt.api.dto.OrganizationDetailsDTO;
import org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage;
import org.wso2.carbon.apimgt.api.dto.WorkflowDTO;
import org.wso2.carbon.apimgt.api.model.*;
Expand Down Expand Up @@ -2035,4 +2036,14 @@ void updateSoapToRestSequences(String organization, String apiId, List<SOAPToRes
* @throws APIManagementException
*/
WorkflowDTO retrieveWorkflow(String workflowReferenceID) throws APIManagementException;

/**
*
* Retrieves list of organizations available for the given parent organization.
*
* @param parentOrgId parent organization id
* @param tenantDomain super domain
* @return organization list
*/
List<OrganizationDetailsDTO> getOrganizations(String orgId, String superOrganization) throws APIManagementException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public enum ExceptionCodes implements ErrorHandler {
INVALID_CONTEXT(900346, "Invalid context provided", 400, "Invalid context provided for API: %s:%s"),
INVALID_ENDPOINT_URL(900346, "Endpoint URL(s) is(are) not valid", 400, "Endpoint URL(s) is(are) not valid"),
USER_ROLES_CANNOT_BE_NULL(900610, "Access control roles cannot be empty", 400, "Access control roles cannot be empty when visibility is restricted"),
ORGS_CANNOT_BE_NULL(900610, "Access control organizatoins cannot be empty", 400, "Access control organizations cannot be empty when visibility is restricted"),
API_REVISION_NOT_FOUND(900347, "API Revision Not Found", 404, "Requested API Revision with id %s not found"),
EXISTING_API_REVISION_DEPLOYMENT_FOUND(900348, "Can not delete API Revision ", 400, "Couldn't delete API revision since API revision is currently deployed to a gateway. " +
"You need to undeploy the API Revision from the gateway before attempting deleting API Revision: %s "),
Expand Down Expand Up @@ -423,6 +424,10 @@ public enum ExceptionCodes implements ErrorHandler {

// Tenant related
INVALID_TENANT(901300,"Tenant Not Found", 400, "Tenant Not Found"),

// Organization related
INVALID_ORGANINATION(901301,"Organization Not Found", 404, "Organization Not Found"),
MISSING_ORGANINATION(901302,"Organization Not Found", 403, "User does not belong to any organization"),
// Key Manager Related
INVALID_KEY_MANAGER_TYPE(901400, "Key Manager Type not configured", 400, "Key Manager Type not configured"),
REQUIRED_KEY_MANAGER_CONFIGURATION_MISSING(901401,"Required Key Manager configuration missing",400,"Missing " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.wso2.carbon.apimgt.api;

import org.wso2.carbon.apimgt.api.model.OrganizationInfo;

/**
* Details about an oauth Access Token.
*/
Expand All @@ -33,6 +35,8 @@ public class OAuthTokenInfo {
private long validityPeriod;

private String endUserName;

private OrganizationInfo userOrganizationInfo;

public boolean isTokenValid() {
return isTokenValid;
Expand Down Expand Up @@ -92,5 +96,13 @@ public String getConsumerKey() {
public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
}

public OrganizationInfo getUserOrganizationInfo() {
return userOrganizationInfo;
}

public void setUserOrganizationInfo(OrganizationInfo userOrganizationInfo) {
this.userOrganizationInfo = userOrganizationInfo;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
package org.wso2.carbon.apimgt.api.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand All @@ -44,6 +46,7 @@ public class KeyManagerConfigurationDTO implements Serializable {
private String alias = null;
private KeyManagerPermissionConfigurationDTO permissions = new KeyManagerPermissionConfigurationDTO();
private Boolean isUsed = null;
private List<String> allowedOrganizations = new ArrayList<String>();

public KeyManagerConfigurationDTO() {
}
Expand All @@ -62,6 +65,7 @@ public KeyManagerConfigurationDTO(KeyManagerConfigurationDTO keyManagerConfigura
this.externalReferenceId = keyManagerConfigurationDTO.getExternalReferenceId();
this.endpoints = keyManagerConfigurationDTO.getEndpoints();
this.setPermissions(keyManagerConfigurationDTO.getPermissions());
this.allowedOrganizations = keyManagerConfigurationDTO.getAllowedOrganizations();
}
public String getName() {

Expand Down Expand Up @@ -207,4 +211,12 @@ public void setUsed(Boolean isUsed) {

this.isUsed = isUsed;
}

public List<String> getAllowedOrganizations() {
return allowedOrganizations;
}

public void setAllowedOrganizations(List<String> allowedOrganizations) {
this.allowedOrganizations = allowedOrganizations;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2025, WSO2 LLc. (http://www.wso2.org) All Rights Reserved.
*
* 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.apimgt.api.dto;

public class OrganizationDetailsDTO {

private String organizationId;
private String parentOrganizationId;
private String externalOrganizationReference;
private String Name;
private String tenantDomain;
private String description;
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
public String getParentOrganizationId() {
return parentOrganizationId;
}
public void setParentOrganizationId(String parentOrganizationId) {
this.parentOrganizationId = parentOrganizationId;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getTenantDomain() {
return tenantDomain;
}
public void setTenantDomain(String tenantDomain) {
this.tenantDomain = tenantDomain;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getExternalOrganizationReference() {
return externalOrganizationReference;
}
public void setExternalOrganizationReference(String externalOrganizationReference) {
this.externalOrganizationReference = externalOrganizationReference;
}
@Override
public String toString() {
return "OrganizationDetailsDTO [organizationId=" + organizationId + ", parentOrganizationId="
+ parentOrganizationId + ", externalOrganizationReference=" + externalOrganizationReference + ", Name="
+ Name + ", tenantDomain=" + tenantDomain + ", description=" + description + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ public class API implements Serializable {
private String visibility;
private String visibleRoles;
private String visibleTenants;
private String visibleOrganizations;

private boolean endpointSecured = false;

private boolean endpointSecured = false;
private boolean endpointAuthDigest = false;
private String endpointUTUsername;
private String endpointUTPassword;
Expand Down Expand Up @@ -1561,6 +1563,14 @@ public List<OperationPolicy> getApiPolicies() {
public void setApiPolicies(List<OperationPolicy> apiPolicies) {
this.apiPolicies = apiPolicies;
}

public String getVisibleOrganizations() {
return visibleOrganizations;
}

public void setVisibleOrganizations(String visibleOrganizations) {
this.visibleOrganizations = visibleOrganizations;
}

/**
* Property to hold whether the API isEGRESS (1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public Map<String, Map<String, OAuthApplicationInfo>> getKeyManagerWiseOAuthApp(
private String keyType;
private int subscriptionCount;
private String keyManager;
private String sharedOrganization;

public String getCreatedTime() {
return createdTime;
}
Expand Down Expand Up @@ -320,4 +322,12 @@ public void setOrganization(String organization) {

this.organization = organization;
}

public String getSharedOrganization() {
return sharedOrganization;
}

public void setSharedOrganization(String sharedOrganization) {
this.sharedOrganization = sharedOrganization;
}
}
Loading
Loading