Repository: cloudstack
Updated Branches:
  refs/heads/4.4 4ae75b426 -> 52f40433b


CLOUDSTACK-6474: IAM - Not able to list shared networks that is created with 
scope="all"

Changes:
- On startup the root domain group should be created
- Also the SYSTEM and Root Admin accounts should be added to that group
- This will make sure that the root domain shared network's policy gets 
attached to the root domain group


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

Branch: refs/heads/4.4
Commit: 52f40433b9dbc5d78e7000410da09cb7f55e499f
Parents: 4ae75b4
Author: Prachi Damle <[email protected]>
Authored: Tue Apr 22 18:18:44 2014 -0700
Committer: Daan Hoogland <[email protected]>
Committed: Wed Apr 23 09:41:43 2014 +0200

----------------------------------------------------------------------
 .../org/apache/cloudstack/iam/IAMApiServiceImpl.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/52f40433/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java 
b/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java
index 8b454e0..77e588b 100644
--- a/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java
+++ b/services/iam/plugin/src/org/apache/cloudstack/iam/IAMApiServiceImpl.java
@@ -352,6 +352,21 @@ public class IAMApiServiceImpl extends ManagerBase 
implements IAMApiService, Man
         sysAccts.add(Account.ACCOUNT_ID_SYSTEM);
         sysAccts.add(Account.ACCOUNT_ID_SYSTEM + 1);
         _iamSrv.addAccountsToGroup(sysAccts, new 
Long(Account.ACCOUNT_TYPE_ADMIN + 1));
+
+        // add the root domain group
+        Domain domain = _domainDao.findById(Domain.ROOT_DOMAIN);
+        if (domain != null) {
+            List<IAMGroup> domainGroups = listDomainGroup(domain);
+            if (domainGroups != null && !domainGroups.isEmpty()) {
+                return;
+            }
+            IAMGroup rootDomainGrp = _iamSrv.createIAMGroup("DomainGrp-" + 
domain.getUuid(), "Root Domain group",
+                    domain.getPath());
+            // add the system accounts to the root domain group
+            _iamSrv.addAccountsToGroup(sysAccts, rootDomainGrp.getId());
+
+        }
+
     }
 
     private void addDomainWideResourceAccess(Map<String, Object> params) {

Reply via email to