Publish current project state
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gochat/gochat/internal/auth"
|
||||
"github.com/gochat/gochat/internal/model"
|
||||
"github.com/gochat/gochat/internal/service"
|
||||
applogger "github.com/gochat/gochat/pkg/logger"
|
||||
@@ -247,7 +248,7 @@ func (h *CaptainCustomToolHandler) ensureCustomToolsEnabled(c *gin.Context, acco
|
||||
|
||||
func (h *CaptainCustomToolHandler) ensureCustomToolAdmin(c *gin.Context) bool {
|
||||
if role, exists := c.Get("role"); exists {
|
||||
if role == "administrator" || role == "super_admin" {
|
||||
if role == auth.RoleAdministrator || role == auth.RoleSuperAdmin {
|
||||
return true
|
||||
}
|
||||
c.JSON(http.StatusForbidden, gin.H{"error": "You are not authorized to do this action"})
|
||||
@@ -293,5 +294,5 @@ func captainCustomToolPayload(c *gin.Context, tool *model.CaptainCustomTool) gin
|
||||
|
||||
func captainCustomToolShowAuthConfig(c *gin.Context) bool {
|
||||
role, exists := c.Get("role")
|
||||
return exists && (role == "administrator" || role == "super_admin")
|
||||
return exists && (role == auth.RoleAdministrator || role == auth.RoleSuperAdmin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user