Skip to content

Commit

Permalink
Merge branch 'org_visibility_temp' into master-temp
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Feb 3, 2025
2 parents fee8274 + b2b4a2c commit 40d4d1d
Show file tree
Hide file tree
Showing 105 changed files with 4,639 additions and 241 deletions.
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 @@ -2052,4 +2053,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 @@ -428,6 +429,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,96 @@
/*
* 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;
private String organizationHandle;

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

public String getOrganizationHandle() {
return organizationHandle;
}

public void setOrganizationHandle(String organizationHandle) {
this.organizationHandle = organizationHandle;
}

@Override
public String toString() {
return "OrganizationDetailsDTO [organizationId=" + organizationId + ", parentOrganizationId="
+ parentOrganizationId + ", externalOrganizationReference=" + externalOrganizationReference + ", Name="
+ Name + ", tenantDomain=" + tenantDomain + ", description=" + description + ", organizationHandle="
+ organizationHandle + "]";
}


}
Loading

0 comments on commit 40d4d1d

Please sign in to comment.