add admins config field
This commit is contained in:
parent
f85b043c27
commit
85f2730fb0
@ -44,7 +44,7 @@ func BlacklistHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func BlacklistRemoveHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func LogsHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func SendMessage(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func SettingsHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func TicketListHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func TicketViewHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func LogViewHandler(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildId, userId) {
|
||||
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||
return
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package manage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/TicketsBot/GoPanel/config"
|
||||
"github.com/TicketsBot/GoPanel/database/table"
|
||||
"github.com/TicketsBot/GoPanel/utils"
|
||||
"github.com/TicketsBot/GoPanel/utils/discord"
|
||||
@ -131,7 +132,7 @@ func WebChatWs(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// Verify the user has permissions to be here
|
||||
if !guild.Owner && !table.IsAdmin(guildIdParsed, userId) {
|
||||
if !utils.Contains(config.Conf.Admins, userIdStr) && !guild.Owner && !table.IsAdmin(guildIdParsed, userId) {
|
||||
fmt.Println(err.Error())
|
||||
conn.Close()
|
||||
return
|
||||
|
@ -1,3 +1,5 @@
|
||||
admins=["217617036749176833"]
|
||||
|
||||
[server]
|
||||
host="0.0.0.0:3000"
|
||||
baseUrl="http://localhost:3000"
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
|
||||
type (
|
||||
Config struct {
|
||||
Admins []string
|
||||
Server Server
|
||||
Oauth Oauth
|
||||
MariaDB MariaDB
|
||||
|
Loading…
x
Reference in New Issue
Block a user