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

sync master branch #12779

Merged
merged 31 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d5ffd60
Add implementation for GW visibility control feature
Dec 8, 2024
bbd4c28
Fix NPE
Dec 13, 2024
449eb3a
Add improvements to support gw visibilty for API products
Dec 15, 2024
8cb730f
Set setResolveCombinators to false when parsing OpenAPI/Swagger defin…
ashanhr Dec 12, 2024
f78fbae
Add publisher rest API changes to support GW visibility
Jan 3, 2025
c4d9496
~~Fix integration test failures by handling a NPE
Jan 3, 2025
7194e8a
Add admin rest API changes to support environment visibility
Jan 6, 2025
1f3e7ba
Handle NPE
Jan 7, 2025
7cc8e85
Clear cache after internal role update
PasanT9 Jan 8, 2025
236f07a
Add new table to handle gw visibility permissions
Jan 7, 2025
8299c30
Fix WSDL test failure
Jan 10, 2025
9619717
Merge pull request #12740 from PasanT9/role-update-2
PasanT9 Jan 20, 2025
78506ed
[WSO2 Release] [Jenkins #7397] [Release 9.30.98] prepare release v9.3…
wso2-jenkins-bot Jan 20, 2025
f6a7785
[WSO2 Release] [Jenkins #7397] [Release 9.30.98] prepare for next dev…
wso2-jenkins-bot Jan 20, 2025
ae4e383
Merge pull request #12726 from ashanhr/master
hisanhunais Jan 22, 2025
169aa6b
[WSO2 Release] [Jenkins #7399] [Release 9.30.99] prepare release v9.3…
wso2-jenkins-bot Jan 22, 2025
364ea98
[WSO2 Release] [Jenkins #7399] [Release 9.30.99] prepare for next dev…
wso2-jenkins-bot Jan 22, 2025
f70b2c3
Bump APIM version constant to 4.5.0
hisanhunais Jan 23, 2025
1f1f114
Merge pull request #12757 from hisanhunais/4.5.0-changes
hisanhunais Jan 23, 2025
3173a73
[WSO2 Release] [Jenkins #7401] [Release 9.30.100] prepare release v9.…
wso2-jenkins-bot Jan 23, 2025
648a0b7
[WSO2 Release] [Jenkins #7401] [Release 9.30.100] prepare for next de…
wso2-jenkins-bot Jan 23, 2025
3904ba2
Fix review comments
Jan 24, 2025
ce19f6a
Update dependencies
hisanhunais Jan 24, 2025
c1d9429
Fix review comments
Jan 24, 2025
4a2f795
Merge pull request #12722 from npamudika/master
npamudika Jan 24, 2025
e4016a1
[WSO2 Release] [Jenkins #7404] [Release 9.31.0] prepare release v9.31.0
wso2-jenkins-bot Jan 24, 2025
84cc006
[WSO2 Release] [Jenkins #7404] [Release 9.31.0] prepare for next deve…
wso2-jenkins-bot Jan 24, 2025
96e2268
Merge pull request #12767 from hisanhunais/4.5.0-changes-2
hisanhunais Jan 24, 2025
afc9fe4
[WSO2 Release] [Jenkins #7406] [Release 9.31.1] prepare release v9.31.1
wso2-jenkins-bot Jan 24, 2025
e09fe17
[WSO2 Release] [Jenkins #7406] [Release 9.31.1] prepare for next deve…
wso2-jenkins-bot Jan 24, 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
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.wso2.carbon.apimgt.api;

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;
Expand Down Expand Up @@ -355,6 +356,14 @@ KeyManagerConfigurationDTO updateKeyManagerConfiguration(KeyManagerConfiguration
*/
KeyManagerPermissionConfigurationDTO getKeyManagerPermissions(String id) throws APIManagementException;

/**
* This method used to get gateway visibility permissions with gateway environment id and role
* @param id uuid of gateway environment
* @return gateway visibility permissions
* @throws APIManagementException
*/
GatewayVisibilityPermissionConfigurationDTO getGatewayVisibilityPermissions(String id) throws APIManagementException;

/**
* hTis method used to delete IDP mapped with key manager
* @param organization organization requested
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.wso2.carbon.apimgt.api.model.CommentList;
import org.wso2.carbon.apimgt.api.model.Application;
import org.wso2.carbon.apimgt.api.model.Comment;
import org.wso2.carbon.apimgt.api.model.Environment;
import org.wso2.carbon.apimgt.api.model.Identifier;
import org.wso2.carbon.apimgt.api.model.KeyManagerApplicationInfo;
import org.wso2.carbon.apimgt.api.model.Monetization;
import org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo;
import org.wso2.carbon.apimgt.api.model.OrganizationInfo;
Expand Down Expand Up @@ -885,6 +885,16 @@ List<KeyManagerConfigurationDTO> getKeyManagerConfigurationsByOrganization(Strin
boolean isKeyManagerByNameAllowedForUser(String keyManagerName, String organization, String username)
throws APIManagementException;

/**
* This method used to retrieve gateway environment for tenant
* @param organization organization of the gateway environment
* @param username username of the logged-in user
* @return Environment list
* @throws APIManagementException if error occurred
*/
Map<String, Environment> getGatewayEnvironmentsByOrganization(String organization, String username)
throws APIManagementException;

/**
* Remove application keys.
* @param application application
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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;

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

/**
*GatewayVisibilityPermissionConfiguration model
*/
public class GatewayVisibilityPermissionConfigurationDTO implements Serializable {

private String permissionType = null;
private List<String> roles = new ArrayList<String>();

public GatewayVisibilityPermissionConfigurationDTO () {
this.setPermissionType("PUBLIC");
}

public GatewayVisibilityPermissionConfigurationDTO(String permissionType, List<String> roles) {
this.permissionType = permissionType;
this.roles = roles;
}

public String getPermissionType () {
return permissionType;
}

public void setPermissionType (String permissionType) {
this.permissionType = permissionType;
}

public List<String> getRoles() {
return roles;
}

public void setRoles(List<String> roles) {
if (roles == null) {
return;
}
this.roles = roles;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.commons.lang3.StringUtils;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIConstants;
import org.wso2.carbon.apimgt.api.dto.GatewayVisibilityPermissionConfigurationDTO;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -55,6 +56,11 @@ public class Environment implements Serializable {
private String gatewayType;
private Map<String, String> additionalProperties = new HashMap<>();

private String[] visibilityRoles;
private String visibility;

private GatewayVisibilityPermissionConfigurationDTO permissions = new GatewayVisibilityPermissionConfigurationDTO();

public boolean isDefault() {
return isDefault;
}
Expand Down Expand Up @@ -159,6 +165,49 @@ public void setName(String name) {
}
}

public String getVisibility() {
return visibility;
}

public void setVisibility(String visibility) {
this.visibility = visibility;
}

public String[] getVisibilityRoles() {
if (visibilityRoles != null) {
return visibilityRoles;
} else if (visibility != null) {
return visibility.split(",");
}
return null;
}

public void setVisibility(String[] visibilityRoles) {
if (visibilityRoles != null && !"".equals(visibilityRoles[0].trim())) {
StringBuilder builder = new StringBuilder();
for (String role : visibilityRoles) {
builder.append(role).append(',');
}
builder.deleteCharAt(builder.length() - 1);
this.visibility = builder.toString();
} else {
this.visibility = "PUBLIC";
this.visibilityRoles[0] = "internal/everyone";
}
this.visibilityRoles = visibilityRoles;
}

public GatewayVisibilityPermissionConfigurationDTO getPermissions() {
return permissions;
}

public void setPermissions(GatewayVisibilityPermissionConfigurationDTO permissions) {
if (permissions == null) {
permissions = new GatewayVisibilityPermissionConfigurationDTO();
}
this.permissions = permissions;
}

public String getDisplayName() {
return displayName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ private void setSwaggerToMessageContext(MessageContext messageContext) {
swagger = localEntryObj.getValue().toString();
OpenAPIParser parser = new OpenAPIParser();
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true);
parseOptions.setResolveFully(true);
parseOptions.setResolveCombinators(false);
openAPI = parser.readContents(swagger, null, parseOptions).getOpenAPI();
// HTTP headers should be case insensitive as for HTTP 1.1 RFC
// Thus converting headers to lowercase for schema validation.
Expand Down
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>9.30.98-SNAPSHOT</version>
<version>9.31.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIMgtResourceNotFoundException;
import org.wso2.carbon.apimgt.api.ExceptionCodes;
import org.wso2.carbon.apimgt.api.dto.GatewayVisibilityPermissionConfigurationDTO;
import org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO;
import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.dto.KeyManagerPermissionConfigurationDTO;
Expand Down Expand Up @@ -926,6 +927,18 @@ public KeyManagerPermissionConfigurationDTO getKeyManagerPermissions(String id)
return keyManagerPermissionConfigurationDTO;
}

@Override
public GatewayVisibilityPermissionConfigurationDTO getGatewayVisibilityPermissions(String id) throws APIManagementException {

GatewayVisibilityPermissionConfigurationDTO gatewayVisibilityPermissionConfigurationDTO;
try {
gatewayVisibilityPermissionConfigurationDTO = apiMgtDAO.getGatewayVisibilityPermissions(id);
} catch (APIManagementException e) {
throw new APIManagementException("Gateway Visibility Permissions retrieval failed for gateway environment id " + id, e);
}
return gatewayVisibilityPermissionConfigurationDTO;
}

private IdentityProvider updatedIDP(IdentityProvider retrievedIDP,
KeyManagerConfigurationDTO keyManagerConfigurationDTO) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ private Permissions() {
public static final String API_GATEWAY = "APIGateway.";
public static final String API_GATEWAY_NAME = "Name";
public static final String API_GATEWAY_DISPLAY_NAME = "DisplayName";
public static final String API_GATEWAY_VISIBILITY = "Visibility";
public static final String API_GATEWAY_SERVER_URL = "ServerURL";
public static final String API_GATEWAY_USERNAME = "Username";
public static final String API_GATEWAY_PASSWORD = "Password";
Expand Down Expand Up @@ -3207,6 +3208,10 @@ public enum ConfigType {
public static final String WSO2_APK_GATEWAY = "wso2/apk";
public static final String WSO2_SYNAPSE_GATEWAY = "wso2/synapse";

public static final String PERMISSION_ALLOW = "ALLOW";
public static final String PERMISSION_DENY = "DENY";
public static final String PERMISSION_NOT_RESTRICTED = "PUBLIC";

// Protocol variables
public static final String HTTP_TRANSPORT_PROTOCOL_NAME = "http";
public static final String HTTPS_TRANSPORT_PROTOCOL_NAME = "https";
Expand Down
Loading
Loading