Skip to content

Commit

Permalink
Merge pull request #12342 from CrowleyRajapakse/masternew
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowleyRajapakse committed Mar 22, 2024
2 parents 735af3d + 49aba2f commit 3c11e81
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ private Permissions() {
public static final String API_PUBLISHER_URL = API_PUBLISHER + "URL";
public static final String API_PUBLISHER_ENABLE_API_DOC_VISIBILITY_LEVELS = API_PUBLISHER
+ "EnableAPIDocVisibilityLevels";
public static final String API_PUBLISHER_ENABLE_PORTAL_CONFIGURATION_ONLY_MODE = API_PUBLISHER + "EnablePortalConfigurationOnlyMode";
// Configuration that need to enable to add access control to APIs in publisher
public static final String API_PUBLISHER_ENABLE_ACCESS_CONTROL_LEVELS = API_PUBLISHER
+ "EnableAccessControl";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,22 @@ public static boolean isDocVisibilityLevelsEnabled() {
APIConstants.API_PUBLISHER_ENABLE_API_DOC_VISIBILITY_LEVELS).equals("true");
}

/**
* Check if Portal Configuration Only Mode is enabled
*
* @return True if Portal Configuration Only Mode is enabled
*/
public static boolean isPortalConfigurationOnlyModeEnabled() {
// checking if API Read Only Mode is enabled in api-manager.xml
String isPortalConfigurationOnlyModeEnabled = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().
getAPIManagerConfiguration().getFirstProperty(
APIConstants.API_PUBLISHER_ENABLE_PORTAL_CONFIGURATION_ONLY_MODE);
if (StringUtils.isNotEmpty(isPortalConfigurationOnlyModeEnabled)) {
return Boolean.parseBoolean(isPortalConfigurationOnlyModeEnabled);
}
return false;
}

/**
* Returns the External API Store Configuration with the given Store Name
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11906,6 +11906,12 @@ components:
description: |
Is Document Visibility configuration enabled
example: false
portalConfigurationOnlyModeEnabled:
type: boolean
description: |
Is Portal Configuration Only Mode enabled
example: false
default: false
crossTenantSubscriptionEnabled:
type: boolean
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class SettingsDTO {
private Object securityAuditProperties = null;
private Boolean externalStoresEnabled = null;
private Boolean docVisibilityEnabled = null;
private Boolean portalConfigurationOnlyModeEnabled = false;
private Boolean crossTenantSubscriptionEnabled = false;
private String defaultAdvancePolicy = null;
private String defaultSubscriptionPolicy = null;
Expand Down Expand Up @@ -202,6 +203,24 @@ public void setDocVisibilityEnabled(Boolean docVisibilityEnabled) {
this.docVisibilityEnabled = docVisibilityEnabled;
}

/**
* Is Portal Configuration Only Mode enabled
**/
public SettingsDTO portalConfigurationOnlyModeEnabled(Boolean portalConfigurationOnlyModeEnabled) {
this.portalConfigurationOnlyModeEnabled = portalConfigurationOnlyModeEnabled;
return this;
}


@ApiModelProperty(example = "false", value = "Is Portal Configuration Only Mode enabled ")
@JsonProperty("portalConfigurationOnlyModeEnabled")
public Boolean isPortalConfigurationOnlyModeEnabled() {
return portalConfigurationOnlyModeEnabled;
}
public void setPortalConfigurationOnlyModeEnabled(Boolean portalConfigurationOnlyModeEnabled) {
this.portalConfigurationOnlyModeEnabled = portalConfigurationOnlyModeEnabled;
}

/**
* Is Cross Tenant Subscriptions Enabled
**/
Expand Down Expand Up @@ -328,6 +347,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(securityAuditProperties, settings.securityAuditProperties) &&
Objects.equals(externalStoresEnabled, settings.externalStoresEnabled) &&
Objects.equals(docVisibilityEnabled, settings.docVisibilityEnabled) &&
Objects.equals(portalConfigurationOnlyModeEnabled, settings.portalConfigurationOnlyModeEnabled) &&
Objects.equals(crossTenantSubscriptionEnabled, settings.crossTenantSubscriptionEnabled) &&
Objects.equals(defaultAdvancePolicy, settings.defaultAdvancePolicy) &&
Objects.equals(defaultSubscriptionPolicy, settings.defaultSubscriptionPolicy) &&
Expand All @@ -338,7 +358,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(devportalUrl, environment, gatewayTypes, scopes, monetizationAttributes, subscriberContactAttributes, securityAuditProperties, externalStoresEnabled, docVisibilityEnabled, crossTenantSubscriptionEnabled, defaultAdvancePolicy, defaultSubscriptionPolicy, authorizationHeader, isJWTEnabledForLoginTokens, customProperties);
return Objects.hash(devportalUrl, environment, gatewayTypes, scopes, monetizationAttributes, subscriberContactAttributes, securityAuditProperties, externalStoresEnabled, docVisibilityEnabled, portalConfigurationOnlyModeEnabled, crossTenantSubscriptionEnabled, defaultAdvancePolicy, defaultSubscriptionPolicy, authorizationHeader, isJWTEnabledForLoginTokens, customProperties);
}

@Override
Expand All @@ -355,6 +375,7 @@ public String toString() {
sb.append(" securityAuditProperties: ").append(toIndentedString(securityAuditProperties)).append("\n");
sb.append(" externalStoresEnabled: ").append(toIndentedString(externalStoresEnabled)).append("\n");
sb.append(" docVisibilityEnabled: ").append(toIndentedString(docVisibilityEnabled)).append("\n");
sb.append(" portalConfigurationOnlyModeEnabled: ").append(toIndentedString(portalConfigurationOnlyModeEnabled)).append("\n");
sb.append(" crossTenantSubscriptionEnabled: ").append(toIndentedString(crossTenantSubscriptionEnabled)).append("\n");
sb.append(" defaultAdvancePolicy: ").append(toIndentedString(defaultAdvancePolicy)).append("\n");
sb.append(" defaultSubscriptionPolicy: ").append(toIndentedString(defaultSubscriptionPolicy)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public SettingsDTO fromSettingstoDTO(Boolean isUserAvailable, String organizatio
settingsDTO.setExternalStoresEnabled(
APIUtil.isExternalStoresEnabled(RestApiCommonUtil.getLoggedInUserTenantDomain()));
settingsDTO.setDocVisibilityEnabled(APIUtil.isDocVisibilityLevelsEnabled());
settingsDTO.setPortalConfigurationOnlyModeEnabled(APIUtil.isPortalConfigurationOnlyModeEnabled());
settingsDTO.setCrossTenantSubscriptionEnabled(APIUtil.isCrossTenantSubscriptionsEnabled());
Map<String, Environment> gatewayEnvironments = APIUtil.getReadOnlyGatewayEnvironments();
String authorizationHeader = APIUtil.getOAuthConfiguration(loggedInUserTenantDomain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11906,6 +11906,12 @@ components:
description: |
Is Document Visibility configuration enabled
example: false
portalConfigurationOnlyModeEnabled:
type: boolean
description: |
Is Portal Configuration Only Mode enabled
example: false
default: false
crossTenantSubscriptionEnabled:
type: boolean
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@
property,it will show two additional permission levels as visible only to all registered users in a particular
domain or only visible to API doc creator -->
<EnableAPIDocVisibilityLevels>{{apim.publisher.enable_api_doc_visibility}}</EnableAPIDocVisibilityLevels>
<EnablePortalConfigurationOnlyMode>{{apim.publisher.enable_portal_configuration_only_mode}}</EnablePortalConfigurationOnlyMode>
<!-- Uncomment this to limit the number of APIs in api the API Publisher -->
<!--APIsPerPage>30</APIsPerPage-->
<!-- This property need to be enabled to enable the publisher access control support -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
property,it will show two additional permission levels as visible only to all registered users in a particular
domain or only visible to API doc creator -->
<!--EnableAPIDocVisibilityLevels>true</EnableAPIDocVisibilityLevels-->
<!--EnablePortalConfigurationOnlyMode>false</EnablePortalConfigurationOnlyMode-->
<!-- Uncomment this to limit the number of APIs in api the API Publisher -->
<!--APIsPerPage>30</APIsPerPage-->
<!-- This property need to be enabled to enable the publisher access control support -->
Expand Down

0 comments on commit 3c11e81

Please sign in to comment.