Selaa lähdekoodia

Merge branch 'master' of git.bubblev.org:bubblev/bubble

tags/v1.1.0
Jonathan Cobb 4 vuotta sitten
vanhempi
commit
5822bfec83
2 muutettua tiedostoa jossa 23 lisäystä ja 1 poistoa
  1. +1
    -1
      bin/first_time_setup.sh
  2. +22
    -0
      bubble-server/src/main/java/bubble/dao/account/AccountDAO.java

+ 1
- 1
bin/first_time_setup.sh Näytä tiedosto

@@ -46,7 +46,7 @@ abp-parser
"
pushd utils
for repo in ${UTIL_REPOS} ; do
pushd ${repo} && git checkout master && mvn -DskipTests=true -Dcheckstyle.skip=true clean install && popd || die "Error installing ${repo}"
pushd ${repo} && mvn -DskipTests=true -Dcheckstyle.skip=true clean install && popd || die "Error installing ${repo}"
done
popd



+ 22
- 0
bubble-server/src/main/java/bubble/dao/account/AccountDAO.java Näytä tiedosto

@@ -37,7 +37,9 @@ import org.glassfish.grizzly.http.server.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import javax.annotation.Nullable;
import javax.transaction.Transactional;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -346,6 +348,26 @@ public class AccountDAO extends AbstractCRUDDAO<Account> implements SqlViewSearc
log.info("copyTemplates completed: "+acct);
}

private final String NETWORK_OWNER_ACCOUNT_UUID_PARAM = "__thisNetworkOwnerAccountUuid__";

@Override public int bulkDeleteWhere(@NonNull final String whereClause,
@Nullable final Map<String, Object> parameters) {
final Map<String, Object> enhancedParams = parameters != null ? parameters : new HashMap<>();
enhancedParams.put(NETWORK_OWNER_ACCOUNT_UUID_PARAM, configuration.getThisNetwork().getAccount());

return super.bulkDeleteWhere("uuid != :" + NETWORK_OWNER_ACCOUNT_UUID_PARAM + " AND (" + whereClause + ")",
enhancedParams);
}

@Override public void delete(@Nullable final Collection<Account> accounts) {
if (empty(accounts)) return;
final var networkOwnerUuid = configuration.getThisNetwork().getAccount();
if (accounts.removeIf(a -> a != null && a.getUuid().equals(networkOwnerUuid))) {
log.warn("delete: skipping deletion of network owner's account: " + networkOwnerUuid);
}
super.delete(accounts);
}

@Override public void delete(@NonNull final String uuid) {
// you cannot delete the account that owns the current network
if (uuid.equals(configuration.getThisNetwork().getAccount())) {


Ladataan…
Peruuta
Tallenna