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

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