Fix permissions inheritance issue on newly created server groups

This commit is contained in:
Colin McDonald 2016-07-13 23:14:42 -04:00
parent 6c16fa7b18
commit 3a213de233

View File

@ -1,6 +1,7 @@
package net.frozenorb.apiv3.model; package net.frozenorb.apiv3.model;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mongodb.async.SingleResultCallback; import com.mongodb.async.SingleResultCallback;
import com.mongodb.async.client.MongoCollection; import com.mongodb.async.client.MongoCollection;
import fr.javatic.mongo.jacksonCodec.Entity; import fr.javatic.mongo.jacksonCodec.Entity;
@ -73,8 +74,12 @@ public final class ServerGroup {
} }
public Map<String, Boolean> calculatePermissions(Rank rank) { public Map<String, Boolean> calculatePermissions(Rank rank) {
if (permissions == null) {
return ImmutableMap.of();
} else {
return PermissionUtils.mergeUpTo(permissions, rank); return PermissionUtils.mergeUpTo(permissions, rank);
} }
}
public void insert(SingleResultCallback<Void> callback) { public void insert(SingleResultCallback<Void> callback) {
serverGroupCache.add(this); serverGroupCache.add(this);