From 1562c2fe7a163c6055c7a7fa7098a25e485d847e Mon Sep 17 00:00:00 2001 From: bfederle Date: Mon, 30 Jan 2012 16:17:48 -0800 Subject: [PATCH] bug 12984 Allow domain admins the same project privileges as ROOT admins status 12984: resolved fixed --- ui/scripts/projects.js | 7 ++++--- ui/scripts/ui-custom/projects.js | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js index c7f7bb0b0e0..5c83fbe4a73 100644 --- a/ui/scripts/projects.js +++ b/ui/scripts/projects.js @@ -486,7 +486,7 @@ url: createURL('listProjects', { ignoreProject: true }), data: { accountId: user.userid, - listAll: isAdmin() + listAll: true }, dataType: 'json', async: true, @@ -539,7 +539,7 @@ } } - var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=' + isAdmin(); + var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=true'; $.ajax({ url: createURL(apiCmd, { ignoreProject: true }), dataType: 'json', @@ -829,7 +829,8 @@ var projectsActionFilter = function(args) { var allowedActions = ['destroy']; - if (args.context.item.account == cloudStack.context.users[0].account || isAdmin()) { + if (args.context.item.account == cloudStack.context.users[0].account || + isAdmin() || isDomainAdmin()) { if (args.context.item.state == 'Suspended') { allowedActions.push('enable'); } else if (args.context.item.state == 'Active') { diff --git a/ui/scripts/ui-custom/projects.js b/ui/scripts/ui-custom/projects.js index 2031e38c590..7d1121be39a 100644 --- a/ui/scripts/ui-custom/projects.js +++ b/ui/scripts/ui-custom/projects.js @@ -160,7 +160,7 @@ }; // Only show management tabs to owner of project - if (isAdmin() || ( + if (isAdmin() || isDomainAdmin() || ( cloudStack.context.projects && (cloudStack.context.projects[0].account == cloudStack.context.users[0].account) )) { @@ -170,7 +170,7 @@ tabs.invitations = pageElems.dashboardTabs.invitations; } - if (isAdmin()) { + if (isAdmin() || isDomainAdmin()) { tabs.resources = pageElems.dashboardTabs.resources; } } @@ -333,7 +333,7 @@ ) ); - if (isAdmin()) { + if (isAdmin() || isDomainAdmin()) { $ul.append( // Resources tab $('
  • ').addClass('last').append( @@ -346,7 +346,7 @@ cloudStack.context.projects = [project]; var $resources; - if (isAdmin()) { + if (isAdmin() || isDomainAdmin()) { $resouces = $('
    ') .attr({ id: 'new-project-review-tabs-resouces' }) .appendTo($tabs) @@ -544,7 +544,7 @@ loadData(function() { if (!$list.find('li').size()) { cloudStack.dialog.notice({ - message: isAdmin() || g_userProjectsEnabled ? + message: isAdmin() || isDomainAdmin() || g_userProjectsEnabled ? 'You do not have any projects.
    Please create a new one from the projects section.' : 'You do not have any projects.
    Please ask your administrator to create a new project.' }).closest('.ui-dialog');