diff --git a/src/main/java/app/controllers/discord/DiscordController.java b/src/main/java/app/controllers/discord/DiscordController.java index eef7449..aa5910f 100644 --- a/src/main/java/app/controllers/discord/DiscordController.java +++ b/src/main/java/app/controllers/discord/DiscordController.java @@ -8,10 +8,7 @@ import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("api/discord") @@ -29,4 +26,26 @@ public class DiscordController { @RequestParam String discord_id) { return new ResponseEntity(discordAuthService.getSteamIDofDiscordID(discord_id), HttpStatus.OK); } + + @PostMapping + @CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) + public ResponseEntity registerDiscordUser(HttpServletRequest request, + @RequestParam String steam64, + @RequestParam String discord_id){ + SteamID steamID = discordAuthService.getSteamIDofDiscordID(discord_id); + if (steamID != null) return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE); + //Релизовать регистрацию пользователя + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + + @DeleteMapping + @CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) + public ResponseEntity unregisterDiscordUser(HttpServletRequest request, + @RequestParam String steam64, + @RequestParam String discord_id){ + SteamID steamID = discordAuthService.getSteamIDofDiscordID(discord_id); + if (steamID == null) return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE); + //Релизовать де-регистрацию + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } } diff --git a/src/main/java/app/services/db/PermitionService.java b/src/main/java/app/services/db/PermitionService.java index 1bb3165..605fc4c 100644 --- a/src/main/java/app/services/db/PermitionService.java +++ b/src/main/java/app/services/db/PermitionService.java @@ -24,6 +24,7 @@ public class PermitionService { } public boolean CheckMorePowerfull(SteamID user_1, SteamID user_2) { + if (user_1.is(user_2)) return true; Permition permition_1 = getPermition(user_1); if (permition_1 == null) return false; Permition permition_2 = getPermition(user_2);