Fixed top level permission addition.

Bug where only the last known addition to the permission map would actually be added, moved map declaration outside of nested for loop and put the permissible setting outside as well to stop ridiculous amounts of calls to it.
This commit is contained in:
Corey Shupe 2018-02-21 21:02:23 -05:00 committed by Trent Hensler
parent f8774bab23
commit 6eb7e7a558

View File

@ -36,14 +36,13 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Permissab
} }
// Second level is the map between action -> access // Second level is the map between action -> access
for (Map.Entry<String, JsonElement> entry2 : entry.getValue().getAsJsonObject().entrySet()) {
Map<PermissableAction, Access> accessMap = new HashMap<>(); Map<PermissableAction, Access> accessMap = new HashMap<>();
for (Map.Entry<String, JsonElement> entry2 : entry.getValue().getAsJsonObject().entrySet()) {
PermissableAction permissableAction = PermissableAction.fromString(entry2.getKey()); PermissableAction permissableAction = PermissableAction.fromString(entry2.getKey());
Access access = Access.fromString(entry2.getValue().getAsString()); Access access = Access.fromString(entry2.getValue().getAsString());
accessMap.put(permissableAction, access); accessMap.put(permissableAction, access);
permissionsMap.put(permissable, accessMap);
} }
permissionsMap.put(permissable, accessMap);
} }
return permissionsMap; return permissionsMap;