From 1b3bd15aaf0b7d9769e956c10c637b9affcff413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cl=C3=A9ment?= Date: Wed, 22 Jun 2022 09:54:14 +0000 Subject: [PATCH] :ambulance: Fix permission --- .../net/Broken/Api/Controllers/GuildController.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/Broken/Api/Controllers/GuildController.java b/src/main/java/net/Broken/Api/Controllers/GuildController.java index 617ce32..b2da436 100644 --- a/src/main/java/net/Broken/Api/Controllers/GuildController.java +++ b/src/main/java/net/Broken/Api/Controllers/GuildController.java @@ -26,35 +26,34 @@ public class GuildController { } @GetMapping("mutual") - public List getMutualGuilds(Authentication authentication){ + public List getMutualGuilds(Authentication authentication) { JwtPrincipal jwtPrincipal = (JwtPrincipal) authentication.getPrincipal(); return guildService.getMutualGuilds(jwtPrincipal.user()); } @GetMapping("inviteLink") - public InviteLink getInviteLink(){ - String link = MainBot.jda.getInviteUrl(Permission.ADMINISTRATOR); + public InviteLink getInviteLink() { + String link = MainBot.jda.setRequiredScopes("applications.commands").getInviteUrl(Permission.getPermissions(1636113579328L)); return new InviteLink(link); } - @GetMapping("/{guildId}/voiceChannels") @PreAuthorize("isInGuild(#guildId)") - public List getVoiceChannels(@PathVariable String guildId, Authentication authentication){ + public List getVoiceChannels(@PathVariable String guildId, Authentication authentication) { JwtPrincipal principal = (JwtPrincipal) authentication.getPrincipal(); return guildService.getVoiceChannel(guildId, principal.user().getDiscordId()); } @GetMapping("/{guildId}/textChannels") @PreAuthorize("isInGuild(#guildId)") - public List getTextChannels(@PathVariable String guildId, Authentication authentication){ + public List getTextChannels(@PathVariable String guildId, Authentication authentication) { JwtPrincipal principal = (JwtPrincipal) authentication.getPrincipal(); return guildService.getTextChannel(guildId, principal.user().getDiscordId()); } @GetMapping("/{guildId}/roles") @PreAuthorize("isInGuild(#guildId)") - public List getRoles(@PathVariable String guildId){ + public List getRoles(@PathVariable String guildId) { return guildService.getRole(guildId); } }