Sfoglia il codice sorgente

add syncPassword flag to account, update messages, add max_users to public config

tags/v0.15.4
Jonathan Cobb 4 anni fa
parent
commit
7c4ef9f15d
8 ha cambiato i file con 32 aggiunte e 7 eliminazioni
  1. +1
    -1
      bubble-server/src/main/java/bubble/dao/account/AccountDAO.java
  2. +5
    -1
      bubble-server/src/main/java/bubble/model/account/Account.java
  3. +4
    -0
      bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_password.java
  4. +13
    -2
      bubble-server/src/main/java/bubble/server/BubbleConfiguration.java
  5. +4
    -0
      bubble-server/src/main/java/bubble/service/account/StandardSyncPasswordService.java
  6. +2
    -0
      bubble-server/src/main/resources/db/migration/V2020072302__add_account_syncpassword.sql
  7. +2
    -2
      bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties
  8. +1
    -1
      bubble-web

+ 1
- 1
bubble-server/src/main/java/bubble/dao/account/AccountDAO.java Vedi File

@@ -181,7 +181,7 @@ public class AccountDAO extends AbstractCRUDDAO<Account> implements SqlViewSearc
}
if (context instanceof Account) {
final Account previousState = (Account) context;
if (previousState.isHashedPasswordChanged() && !previousState.skipSyncPassword()) {
if (account.syncPassword() && previousState.isHashedPasswordChanged() && !previousState.skipSyncPassword()) {
syncPasswordService.syncPassword(account);
}
}


+ 5
- 1
bubble-server/src/main/java/bubble/model/account/Account.java Vedi File

@@ -82,7 +82,7 @@ import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx;
@Entity @NoArgsConstructor @Accessors(chain=true) @Slf4j
public class Account extends IdentifiableBaseParentEntity implements TokenPrincipal, SqlViewSearchResult {

public static final String[] UPDATE_FIELDS = {"url", "description", "autoUpdatePolicy"};
public static final String[] UPDATE_FIELDS = {"url", "description", "autoUpdatePolicy", "syncPassword"};
public static final String[] ADMIN_UPDATE_FIELDS = ArrayUtil.append(UPDATE_FIELDS, "suspended", "admin");
public static final String[] CREATE_FIELDS = ArrayUtil.append(ADMIN_UPDATE_FIELDS,
"name", "termsAgreed", "preferredPlan");
@@ -169,6 +169,10 @@ public class Account extends IdentifiableBaseParentEntity implements TokenPrinci
@Getter @Setter private Long termsAgreed;
public Account setTermsAgreed() { return setTermsAgreed(now()); }

@ECField(index=130)
@Getter @Setter private Boolean syncPassword;
public boolean syncPassword() { return syncPassword == null ? true : syncPassword; }

@JsonIgnore @Embedded @Getter private HashedPassword hashedPassword;
public Account setHashedPassword (HashedPassword newPass) {
this.hashedPassword = newPass;


+ 4
- 0
bubble-server/src/main/java/bubble/notify/NotificationHandler_sync_password.java Vedi File

@@ -35,6 +35,10 @@ public class NotificationHandler_sync_password extends ReceivedNotificationHandl
reportError("sync_password: account not found: "+notification.getAccountUuid());
return;
}
if (!account.syncPassword()) {
log.info("sync_password: account "+account.getName()+" has syncPassword disabled, not synchronizing");
return;
}

account.getHashedPassword().setHashedPassword(notification.getHashedPassword());



+ 13
- 2
bubble-server/src/main/java/bubble/server/BubbleConfiguration.java Vedi File

@@ -10,7 +10,11 @@ import bubble.auth.PromoCodePolicy;
import bubble.client.BubbleApiClient;
import bubble.cloud.CloudServiceDriver;
import bubble.dao.account.AccountDAO;
import bubble.dao.bill.AccountPlanDAO;
import bubble.dao.bill.BubblePlanDAO;
import bubble.dao.cloud.CloudServiceDAO;
import bubble.model.bill.AccountPlan;
import bubble.model.bill.BubblePlan;
import bubble.model.cloud.*;
import bubble.model.device.DeviceSecurityLevel;
import bubble.server.listener.BubbleFirstTimeListener;
@@ -38,7 +42,10 @@ import org.cobbzilla.wizard.cache.redis.HasRedisConfiguration;
import org.cobbzilla.wizard.cache.redis.RedisConfiguration;
import org.cobbzilla.wizard.client.ApiClientBase;
import org.cobbzilla.wizard.server.RestServerHarness;
import org.cobbzilla.wizard.server.config.*;
import org.cobbzilla.wizard.server.config.HasDatabaseConfiguration;
import org.cobbzilla.wizard.server.config.LegalInfo;
import org.cobbzilla.wizard.server.config.PgRestServerConfiguration;
import org.cobbzilla.wizard.server.config.RecaptchaConfig;
import org.cobbzilla.wizard.util.ClasspathScanner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -92,6 +99,7 @@ public class BubbleConfiguration extends PgRestServerConfiguration
public static final String TAG_RESTORING_IN_PROGRESS = "restoreInProgress";
public static final String TAG_JAR_VERSION = "jarVersion";
public static final String TAG_JAR_UPGRADE_AVAILABLE = "jarUpgradeAvailable";
public static final String TAG_MAX_USERS = "maxUsers";

public static final String DEFAULT_LOCAL_STORAGE_DIR = HOME_DIR + "/.bubble_local_storage";

@@ -336,6 +344,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration
final AccountDAO accountDAO = getBean(AccountDAO.class);
final CloudServiceDAO cloudDAO = getBean(CloudServiceDAO.class);
final ActivationService activationService = getBean(ActivationService.class);
final AccountPlan accountPlan = thisNetwork == null ? null : getBean(AccountPlanDAO.class).findByNetwork(thisNetwork.getUuid());
final BubblePlan plan = accountPlan == null ? null : getBean(BubblePlanDAO.class).findByUuid(accountPlan.getPlan());

publicSystemConfigs.set(MapBuilder.build(new Object[][]{
{TAG_ALLOW_REGISTRATION, thisNetwork == null ? null : thisNetwork.getBooleanTag(TAG_ALLOW_REGISTRATION, false)},
@@ -357,7 +367,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration
{TAG_SUPPORT, getSupport()},
{TAG_SECURITY_LEVELS, DeviceSecurityLevel.values()},
{TAG_JAR_VERSION, getVersion()},
{TAG_JAR_UPGRADE_AVAILABLE, getJarUpgradeAvailable() ? getSageVersion() : null}
{TAG_JAR_UPGRADE_AVAILABLE, getJarUpgradeAvailable() ? getSageVersion() : null},
{TAG_MAX_USERS, plan == null ? null : plan.getMaxAccounts()}
}));
} else {
// some things has to be refreshed all the time in some cases:


+ 4
- 0
bubble-server/src/main/java/bubble/service/account/StandardSyncPasswordService.java Vedi File

@@ -39,6 +39,10 @@ public class StandardSyncPasswordService implements SyncPasswordService {
log.info("syncPassword: not syncing non-admin password");
return;
}
if (!account.syncPassword()) {
log.info("syncPassword: password sync disabled for account: "+account.getName());
return;
}
final AnsibleInstallType installType = thisNetwork.getInstallType();
final SyncPasswordNotification notification = new SyncPasswordNotification(account);
if (installType == AnsibleInstallType.sage) {


+ 2
- 0
bubble-server/src/main/resources/db/migration/V2020072302__add_account_syncpassword.sql Vedi File

@@ -0,0 +1,2 @@
ALTER TABLE account ADD COLUMN sync_password BOOLEAN;
UPDATE account set sync_password = true;

+ 2
- 2
bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties Vedi File

@@ -25,9 +25,9 @@ field_label_url=URL
field_label_administrator=Administrator
field_label_suspended=Suspended
field_label_sendWelcomeEmail=Send Welcome Email
field_label_auto_update_policy=Auto-Update Policy
field_label_auto_update_policy=Automatic Upgrades
field_label_auto_update_jar=Automatic Updates for Bubble Software
field_label_auto_update_apps=Automatic Updates for Apps
field_label_auto_update_apps=Automatic Updates for VPN Apps
button_label_update_profile=Update
link_label_change_password=Change Password
link_label_account_ssh_keys=Manage SSH Keys


+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 44dab2f86b4922d22099ef2330c083f84879d918
Subproject commit 74117dccae90c8905c8f4f54d16fcf19ce5eb27e

Caricamento…
Annulla
Salva