Merge pull request #3535 from shapeblue/minor_413_fixes

Misc fixes to sharing templates functionality
This commit is contained in:
Andrija Panic 2019-08-02 12:35:46 +02:00 committed by GitHub
commit a9569d5ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -318,6 +318,8 @@
g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
// Allow users to see all accounts within a domain
g_allowUserViewAllDomainAccounts = json.listcapabilitiesresponse.capability.allowuserviewalldomainaccounts;
if (json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax) * 3; //multiply 3 to be on safe side
@ -374,6 +376,7 @@
g_kvmsnapshotenabled = null;
g_regionsecondaryenabled = null;
g_loginCmdText = null;
g_allowUserViewAllDomainAccounts = null;
// Remove any cookies
var cookies = document.cookie.split(";");
@ -410,6 +413,7 @@
g_kvmsnapshotenabled = null;
g_regionsecondaryenabled = null;
g_loginCmdText = null;
g_allowUserViewAllDomainAccounts = null;
// Remove any cookies
var cookies = document.cookie.split(";");

View File

@ -36,7 +36,7 @@ var g_queryAsyncJobResultInterval = 3000;
var g_idpList = null;
var g_appendIdpDomain = false;
var g_sortKeyIsAscending = false;
var g_allowUserViewAllDomainAccounts= false;
var g_allowUserViewAllDomainAccounts = false;
//keyboard keycode
var keycode_Enter = 13;

View File

@ -1643,8 +1643,8 @@
success: function (jsonAccounts) {
var accountByName = {};
$.each(jsonAccounts.listaccountsresponse.account, function(idx, account) {
// Only add current domain's accounts as update template permissions supports that
if (account.domainid === g_domainid) {
// Only add current domain's accounts for add as update template permissions supports that
if (account.domainid === g_domainid && operation === "add") {
accountByName[account.name] = {
projName: account.name,
hasPermission: false
@ -1658,7 +1658,9 @@
success: function (json) {
items = json.listtemplatepermissionsresponse.templatepermission.account;
$.each(items, function(idx, accountName) {
accountByName[accountName].hasPermission = true;
if (accountByName[accountName]) {
accountByName[accountName].hasPermission = true;
}
});
var accountObjs = [];
@ -1707,8 +1709,8 @@
success: function (jsonProjects) {
var projectsByIds = {};
$.each(jsonProjects.listprojectsresponse.project, function(idx, project) {
// Only add current domain's projects as update template permissions supports that
if (project.domainid === g_domainid) {
// Only add current domain's projects for add operation as update template permissions supports that
if ((project.domainid === g_domainid && operation === "add") || operation === "remove") {
projectsByIds[project.id] = {
projName: project.name,
hasPermission: false
@ -1723,7 +1725,9 @@
success: function (json) {
items = json.listtemplatepermissionsresponse.templatepermission.projectids;
$.each(items, function(idx, projectId) {
projectsByIds[projectId].hasPermission = true;
if (projectsByIds[projectId]) {
projectsByIds[projectId].hasPermission = true;
}
});
var projectObjs = [];