proper permission checking

This commit is contained in:
Dot-Rar 2020-04-15 20:38:44 +01:00
parent 5ab238cc1c
commit 7b5646d007
2 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/rxdn/gdl/objects/guild" "github.com/rxdn/gdl/objects/guild"
) )
0
func IndexHandler(ctx *gin.Context) { func IndexHandler(ctx *gin.Context) {
store := sessions.Default(ctx) store := sessions.Default(ctx)
if store == nil { if store == nil {

View File

@ -6,6 +6,7 @@ import (
"github.com/TicketsBot/GoPanel/rpc/cache" "github.com/TicketsBot/GoPanel/rpc/cache"
"github.com/TicketsBot/GoPanel/rpc/ratelimit" "github.com/TicketsBot/GoPanel/rpc/ratelimit"
"github.com/rxdn/gdl/objects/guild" "github.com/rxdn/gdl/objects/guild"
"github.com/rxdn/gdl/permission"
"github.com/rxdn/gdl/rest" "github.com/rxdn/gdl/rest"
"strconv" "strconv"
) )
@ -23,8 +24,8 @@ func IsAdmin(g guild.Guild, userId uint64, res chan bool) {
res <- true res <- true
} }
if g.Permissions & 0x8 != 0 { if permission.HasPermissionRaw(g.Permissions, permission.Administrator) {
res <- true res <- true
} }
adminRolesChan := make(chan []uint64) adminRolesChan := make(chan []uint64)