Allow max device limit to be configurable per-user

// FREEBIE
This commit is contained in:
Moxie Marlinspike committed 2017-02-26 16:46:42 -08:00
1 parent 507d457900
commit 3d2f8a7ddb
5 files changed
+73 -10

No files matched your search

@@ -19,6 +19,7 @@ package org.whispersystems.textsecuregcm;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.whispersystems.textsecuregcm.configuration.FederationConfiguration;
import org.whispersystems.textsecuregcm.configuration.GraphiteConfiguration;
import org.whispersystems.textsecuregcm.configuration.MaxDeviceConfiguration;
import org.whispersystems.textsecuregcm.configuration.PushConfiguration;
import org.whispersystems.textsecuregcm.configuration.RateLimitsConfiguration;
import org.whispersystems.textsecuregcm.configuration.RedPhoneConfiguration;
@@ -77,6 +78,11 @@ public class WhisperServerConfiguration extends Configuration {
@JsonProperty
private List<TestDeviceConfiguration> testDevices = new LinkedList<>();
@Valid
@NotNull
@JsonProperty
private List<MaxDeviceConfiguration> maxDevices = new LinkedList<>();
@Valid
@JsonProperty
private FederationConfiguration federation = new FederationConfiguration();
@@ -178,4 +184,15 @@ public class WhisperServerConfiguration extends Configuration {
return results;
}
public Map<String, Integer> getMaxDevices() {
Map<String, Integer> results = new HashMap<>();
for (MaxDeviceConfiguration maxDeviceConfiguration : maxDevices) {
results.put(maxDeviceConfiguration.getNumber(),
maxDeviceConfiguration.getCount());
}
return results;
}
}