fix missing gin context (fixes #1)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -141,8 +140,7 @@ func (aH *AccessHandler) AuthorizeRole(suffix string) gin.HandlerFunc {
|
||||
|
||||
// Validate that a role was found
|
||||
if len(roles) == 0 {
|
||||
log.Println("not logged in")
|
||||
aH.logger.Error("AuthorizeRole", "no logged in")
|
||||
aH.logger.Error("AuthorizeRole", "not logged in")
|
||||
c.JSON(http.StatusUnauthorized, http.StatusUnauthorized)
|
||||
return
|
||||
} else if len(roles) > 1 {
|
||||
@@ -153,7 +151,6 @@ func (aH *AccessHandler) AuthorizeRole(suffix string) gin.HandlerFunc {
|
||||
|
||||
// Check permissions
|
||||
for _, permission := range roles[0].Permissions {
|
||||
fmt.Println(100, permissionPath, permission.Name)
|
||||
if permission.Name == permissionPath {
|
||||
c.Next()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user