Browse Source

fix population of app-dependent objects

tags/v0.9.14
Jonathan Cobb 4 years ago
parent
commit
b152a99256
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java

+ 10
- 1
bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java View File

@@ -19,11 +19,13 @@ import bubble.model.cloud.CloudService;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.cobbzilla.wizard.model.Identifiable;
import org.cobbzilla.wizard.model.IdentifiableBase;

import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

import static bubble.cloud.NoopCloud.NOOP_CLOUD;
import static bubble.cloud.storage.local.LocalStorageDriver.LOCAL_STORAGE_STANDARD_BASE_DIR;
@@ -171,8 +173,11 @@ public abstract class EntityIterator implements Iterator<Identifiable> {
// Only copy app-related objects if the corresponding app is among the planApps
// Make copied objects templates
for (AppTemplateEntity e : (List<? extends AppTemplateEntity>) entities) {
if (planAppEnabled(e.getApp(), planApps)) {
if (userAppEnabled(e.getApp(), userApps)) {
log.info("addEntities: adding " + c.getSimpleName() + "/" + e.getUuid() + " (app="+e.getApp()+") as template");
add(e.setTemplate(true));
} else {
log.info("addEntities: NOT adding " + c.getSimpleName() + "/" + e.getUuid() + " (app="+e.getApp()+"), app not enabled (planApps="+planApps.stream().map(IdentifiableBase::getUuid).collect(Collectors.joining(", "))+")");
}
}

@@ -193,6 +198,10 @@ public abstract class EntityIterator implements Iterator<Identifiable> {
return planApps == null || planApps.stream().anyMatch(planApp -> planApp.getApp().equals(appUuid));
}

private boolean userAppEnabled(String appUuid, List<BubbleApp> userApps) {
return userApps == null || userApps.stream().anyMatch(app -> app.getUuid().equals(appUuid));
}

private AccountSshKey setInstallKey(AccountSshKey sshKey, BubbleNetwork network) {
if (network == null) return sshKey;
if (network.hasSshKey() && network.getSshKey().equals(sshKey.getUuid())) {


Loading…
Cancel
Save