You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2015/09/19 03:31:22 UTC

[16/50] git commit: updated refs/heads/sf-plugins to 157efc3

A root admin can see all accounts whereas others can only see the account they belong to


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/26af0a40
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26af0a40
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26af0a40

Branch: refs/heads/sf-plugins
Commit: 26af0a401d91dffa0d09a44c673983c2f58fbc19
Parents: 15213a3
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Wed Jul 8 15:07:13 2015 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri Sep 18 19:28:19 2015 -0600

----------------------------------------------------------------------
 ui/plugins/sfSharedVolume/sfSharedVolume.js | 25 ++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26af0a40/ui/plugins/sfSharedVolume/sfSharedVolume.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/sfSharedVolume.js b/ui/plugins/sfSharedVolume/sfSharedVolume.js
index 90395cc..0f55a5d 100644
--- a/ui/plugins/sfSharedVolume/sfSharedVolume.js
+++ b/ui/plugins/sfSharedVolume/sfSharedVolume.js
@@ -110,20 +110,41 @@
                   },
                   isHidden: true,
                   select: function(args) {
+                    var accountNameParam = "";
+
                     if (isAdmin()) {
                       args.$form.find('.form-item[rel=account]').show();
                     }
+                    else {
+                      accountNameParam = "&name=" + g_account;
+                    }
 
                     $.ajax({
-                      url: createURL("listAccounts"),
+                      url: createURL("listAccounts&listAll=true" + accountNameParam),
                       dataType: "json",
                       async: true,
                       success: function(json) {
                         var accountObjs = json.listaccountsresponse.account;
+                        var filteredAccountObjs = [];
+
+                        if (isAdmin()) {
+                          filteredAccountObjs = accountObjs;
+                        }
+                        else {
+                          for (int i = 0; i < accountObjs.length; i++) {
+                            var accountObj = accountObjs[i];
+
+                            if (accountObj.domainid == g_domainid) {
+                              filteredAccountObjs.push(accountObj);
+
+                              break; // there should only be one account with a particular name in a domain
+                            }
+                          }
+                        }
 
                         args.response.success({
                           descriptionField: 'name',
-                          data: accountObjs
+                          data: filteredAccountObjs
                         });
                       }
                     });