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
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ func BlacklistRemoveHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func LogsHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ func SendMessage(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func SettingsHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func TicketListHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func TicketViewHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func LogViewHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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
|
ctx.Redirect(302, config.Conf.Server.BaseUrl) // TODO: 403 Page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package manage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/TicketsBot/GoPanel/config"
|
||||||
"github.com/TicketsBot/GoPanel/database/table"
|
"github.com/TicketsBot/GoPanel/database/table"
|
||||||
"github.com/TicketsBot/GoPanel/utils"
|
"github.com/TicketsBot/GoPanel/utils"
|
||||||
"github.com/TicketsBot/GoPanel/utils/discord"
|
"github.com/TicketsBot/GoPanel/utils/discord"
|
||||||
@ -131,7 +132,7 @@ func WebChatWs(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the user has permissions to be here
|
// 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())
|
fmt.Println(err.Error())
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return
|
return
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
admins=["217617036749176833"]
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
host="0.0.0.0:3000"
|
host="0.0.0.0:3000"
|
||||||
baseUrl="http://localhost:3000"
|
baseUrl="http://localhost:3000"
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Config struct {
|
Config struct {
|
||||||
|
Admins []string
|
||||||
Server Server
|
Server Server
|
||||||
Oauth Oauth
|
Oauth Oauth
|
||||||
MariaDB MariaDB
|
MariaDB MariaDB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user