Преглед изворни кода

limit pass-thru delegation to services already delegated, and not on local nodes

tags/v0.9.0
Jonathan Cobb пре 5 година
родитељ
комит
e31eda7716
1 измењених фајлова са 17 додато и 10 уклоњено
  1. +17
    -10
      bubble-server/src/main/java/bubble/dao/account/AccountDAO.java

+ 17
- 10
bubble-server/src/main/java/bubble/dao/account/AccountDAO.java Прегледај датотеку

@@ -1,6 +1,7 @@
package bubble.dao.account;

import bubble.cloud.CloudServiceDriver;
import bubble.cloud.compute.ComputeNodeSizeType;
import bubble.dao.account.message.AccountMessageDAO;
import bubble.dao.app.*;
import bubble.dao.bill.BillDAO;
@@ -173,17 +174,23 @@ public class AccountDAO extends AbstractCRUDDAO<Account> implements SqlViewSearc
if (driver.disableDelegation()) {
return accountEntity.setTemplate(false);

} else if (selfNodeService.getThisNetwork() != null && selfNodeService.getThisNetwork().getInstallType() == AnsibleInstallType.node) {
// on a node, sub-accounts can use the same cloud/config/credentials as their admin
return accountEntity.setDelegated(parentEntity.getDelegated())
.setCredentialsJson(parentEntity.getCredentialsJson())
.setDriverConfigJson(parentEntity.getDriverConfigJson())
.setTemplate(false);

} else {
return accountEntity.setDelegated(parentEntity.getUuid())
.setCredentials(CloudCredentials.delegate(configuration.getThisNode(), configuration))
.setTemplate(false);
final BubbleNetwork thisNetwork = selfNodeService.getThisNetwork();
if (parentEntity.delegated()
&& thisNetwork != null
&& thisNetwork.getInstallType() == AnsibleInstallType.node
&& thisNetwork.getComputeSizeType() != ComputeNodeSizeType.local) {
// on a node, sub-accounts can use the same cloud/config/credentials as their admin
return accountEntity.setDelegated(parentEntity.getDelegated())
.setCredentialsJson(parentEntity.getCredentialsJson())
.setDriverConfigJson(parentEntity.getDriverConfigJson())
.setTemplate(false);

} else {
return accountEntity.setDelegated(parentEntity.getUuid())
.setCredentials(CloudCredentials.delegate(configuration.getThisNode(), configuration))
.setTemplate(false);
}
}
}
@Override public void postCreate(CloudService parentEntity, CloudService accountEntity) {


Loading…
Откажи
Сачувај