From 7342c97fa905555502c163115f015e09fd6d44e7 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Mon, 7 Oct 2013 13:20:49 -0700 Subject: [PATCH] Populate acl_group_account_map table in creating an account. --- server/src/com/cloud/user/AccountManagerImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 270ab7910df..de528f1a764 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -599,6 +599,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M //delete the account from project accounts _projectAccountDao.removeAccountFromProjects(accountId); + //delete the account from group + _aclGroupAccountDao.removeAccountFromGroups(accountId); + // delete all vm groups belonging to accont List groups = _vmGroupDao.listByAccountId(accountId); for (InstanceGroupVO group : groups) { @@ -943,6 +946,13 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M String registrationToken = UUID.nameUUIDFromBytes(bytes).toString(); user.setRegistrationToken(registrationToken); } + + // create correct account and group association based on accountType + if (accountType != Account.ACCOUNT_TYPE_PROJECT) { + AclGroupAccountMapVO grpAcct = new AclGroupAccountMapVO(accountType + 1, accountId); + _aclGroupAccountDao.persist(grpAcct); + } + txn.commit(); CallContext.current().putContextParameter(Account.class, account.getUuid());