cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [10/50] git commit: updated refs/heads/sf-plugins to bcf1c72
Date Tue, 28 Jul 2015 20:14:56 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/82567f78
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/82567f78
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/82567f78

Branch: refs/heads/sf-plugins
Commit: 82567f78aba8d5bc15ad04f0224c8c565207f6f3
Parents: 74208d5
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Wed Jul 8 15:07:13 2015 -0600
Committer: CloudStack <cloudstack@cloudstack-virtual-machine.(none)>
Committed: Tue Jul 28 13:42:41 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/82567f78/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