mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
UI: Fix user role login due to missing API access on custom hypervisor name (#7939)
* UI: Fix user role login due to missing API access on custom hypervisor name * Refactor to include the custom HW display name as part of the response of listCapabilities API * Add since parameter
This commit is contained in:
parent
710f34ee90
commit
940733cedf
@ -59,6 +59,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
|
||||
response.setAllowUserViewAllDomainAccounts((Boolean)capabilities.get("allowUserViewAllDomainAccounts"));
|
||||
response.setKubernetesServiceEnabled((Boolean)capabilities.get("kubernetesServiceEnabled"));
|
||||
response.setKubernetesClusterExperimentalFeaturesEnabled((Boolean)capabilities.get("kubernetesClusterExperimentalFeaturesEnabled"));
|
||||
response.setCustomHypervisorDisplayName((String) capabilities.get("customHypervisorDisplayName"));
|
||||
if (capabilities.containsKey("apiLimitInterval")) {
|
||||
response.setApiLimitInterval((Integer)capabilities.get("apiLimitInterval"));
|
||||
}
|
||||
|
||||
@ -100,6 +100,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
||||
@Param(description = "true if experimental features for Kubernetes cluster such as Docker private registry are enabled, false otherwise")
|
||||
private boolean kubernetesClusterExperimentalFeaturesEnabled;
|
||||
|
||||
@SerializedName("customhypervisordisplayname")
|
||||
@Param(description = "Display name for custom hypervisor", since = "4.19.0")
|
||||
private String customHypervisorDisplayName;
|
||||
|
||||
@SerializedName("defaultuipagesize")
|
||||
@Param(description = "default page size in the UI for various views, value set in the configurations", since = "4.15.2")
|
||||
private Long defaultUiPageSize;
|
||||
@ -215,4 +219,8 @@ public class CapabilitiesResponse extends BaseResponse {
|
||||
public void setInstancesDisksStatsRetentionTime(Integer instancesDisksStatsRetentionTime) {
|
||||
this.instancesDisksStatsRetentionTime = instancesDisksStatsRetentionTime;
|
||||
}
|
||||
|
||||
public void setCustomHypervisorDisplayName(String customHypervisorDisplayName) {
|
||||
this.customHypervisorDisplayName = customHypervisorDisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.hypervisor.HypervisorGuru;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
|
||||
@ -4326,6 +4327,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
capabilities.put("allowUserViewAllDomainAccounts", allowUserViewAllDomainAccounts);
|
||||
capabilities.put("kubernetesServiceEnabled", kubernetesServiceEnabled);
|
||||
capabilities.put("kubernetesClusterExperimentalFeaturesEnabled", kubernetesClusterExperimentalFeaturesEnabled);
|
||||
capabilities.put("customHypervisorDisplayName", HypervisorGuru.HypervisorCustomDisplayName.value());
|
||||
capabilities.put(ApiServiceConfiguration.DefaultUIPageSize.key(), ApiServiceConfiguration.DefaultUIPageSize.value());
|
||||
capabilities.put(ApiConstants.INSTANCES_STATS_RETENTION_TIME, StatsCollector.vmStatsMaxRetentionTime.value());
|
||||
capabilities.put(ApiConstants.INSTANCES_STATS_USER_ONLY, StatsCollector.vmStatsCollectUserVMOnly.value());
|
||||
|
||||
@ -286,6 +286,9 @@ const user = {
|
||||
if (result && result.defaultuipagesize) {
|
||||
commit('SET_DEFAULT_LISTVIEW_PAGE_SIZE', result.defaultuipagesize)
|
||||
}
|
||||
if (result && result.customhypervisordisplayname) {
|
||||
commit('SET_CUSTOM_HYPERVISOR_NAME', result.customhypervisordisplayname)
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
@ -302,15 +305,6 @@ const user = {
|
||||
commit('SET_CLOUDIAN', cloudian)
|
||||
}).catch(ignored => {
|
||||
})
|
||||
|
||||
api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
|
||||
if (json.listconfigurationsresponse.configuration !== null) {
|
||||
const config = json.listconfigurationsresponse.configuration[0]
|
||||
commit('SET_CUSTOM_HYPERVISOR_NAME', config.value)
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user