🚑 Fix permission

This commit is contained in:
Sébastien Clément 2022-06-22 09:54:14 +00:00 committed by GitHub
parent a3f6adf6f5
commit 1b3bd15aaf

View File

@ -26,35 +26,34 @@ public class GuildController {
}
@GetMapping("mutual")
public List<Guild> getMutualGuilds(Authentication authentication){
public List<Guild> 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<Channel> getVoiceChannels(@PathVariable String guildId, Authentication authentication){
public List<Channel> 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<Channel> getTextChannels(@PathVariable String guildId, Authentication authentication){
public List<Channel> 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<Role> getRoles(@PathVariable String guildId){
public List<Role> getRoles(@PathVariable String guildId) {
return guildService.getRole(guildId);
}
}