Fixed /v1/players permisison level

Affects issues:
- #1210
This commit is contained in:
Rsl1122 2020-01-07 13:54:14 +02:00
parent ca89ab70d9
commit 3d3c7289bb

View File

@ -59,12 +59,16 @@ public class PlayersTableJSONResolver implements PageResolver {
UUID serverUUID = identifiers.getServerUUID(target); // Can throw BadRequestException UUID serverUUID = identifiers.getServerUUID(target); // Can throw BadRequestException
return JSONCache.getOrCache(DataID.PLAYERS, serverUUID, () -> new JSONResponse(jsonFactory.serverPlayersTableJSON(serverUUID))); return JSONCache.getOrCache(DataID.PLAYERS, serverUUID, () -> new JSONResponse(jsonFactory.serverPlayersTableJSON(serverUUID)));
} }
// Assume network // Assume players page
return JSONCache.getOrCache(DataID.PLAYERS, () -> new JSONResponse(jsonFactory.networkPlayersTableJSON())); return JSONCache.getOrCache(DataID.PLAYERS, () -> new JSONResponse(jsonFactory.networkPlayersTableJSON()));
} }
@Override @Override
public boolean isAuthorized(Authentication auth, RequestTarget target) throws WebUserAuthException { public boolean isAuthorized(Authentication auth, RequestTarget target) throws WebUserAuthException {
return auth.getWebUser().getPermLevel() <= 0; if (target.getParameter("server").isPresent()) {
return auth.getWebUser().getPermLevel() <= 0;
}
// Assume players page
return auth.getWebUser().getPermLevel() <= 1;
} }
} }