Limit ws logs to admin
This commit is contained in:
parent
26514c0961
commit
e1a750cbe3
1 changed files with 7 additions and 4 deletions
|
@ -2,9 +2,8 @@ package dev.peerat.backend.routes.admins;
|
|||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.jose4j.json.internal.json_simple.JSONObject;
|
||||
|
||||
import dev.peerat.backend.bonus.extract.RouteDoc;
|
||||
import dev.peerat.backend.model.Group;
|
||||
import dev.peerat.backend.model.PeerAtUser;
|
||||
import dev.peerat.backend.repository.DatabaseRepository;
|
||||
import dev.peerat.framework.Context;
|
||||
|
@ -29,9 +28,13 @@ public class DynamicLogs implements Response{
|
|||
@RouteDoc(path = "/admin/logs", responseCode = 200, responseDescription = "L'utilisateur peux voir les logs en directe")
|
||||
@RouteDoc(responseCode = 401, responseDescription = "L'utilisateur n'a pas accès à cette ressource")
|
||||
|
||||
@Route(path = "^/admin/logs$", websocket = true)
|
||||
@Route(path = "^/admin/logs$", needLogin = true, websocket = true)
|
||||
public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception {
|
||||
//check if admin
|
||||
Group group = this.repo.getPlayerGroup(context.<PeerAtUser>getUser().getId(), 1);
|
||||
if(!group.getName().equalsIgnoreCase("Quarter-Master - Battles PAC x CEI")){
|
||||
context.response(423);
|
||||
return;
|
||||
}
|
||||
|
||||
Key key = new Key();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue