cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [16/50] git commit: updated refs/heads/sf-plugins to 157efc3
Date Sat, 19 Sep 2015 01:31:22 GMT
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 <mike.tutkowski@solidfire.com>
Authored: Wed Jul 8 15:07:13 2015 -0600
Committer: Mike Tutkowski <mike.tutkowski@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
                         });
                       }
                     });


Mime
View raw message