New setting delegated_qa to store QA managers
This commit is contained in:
parent
e000778696
commit
d2f409db7a
11 changed files with 148 additions and 20 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
@ -13,4 +15,18 @@ func DeclareRoutes(router *gin.RouterGroup) {
|
|||
declareThemesRoutes(apiRoutes)
|
||||
declareTodoRoutes(apiRoutes)
|
||||
declareVersionRoutes(apiRoutes)
|
||||
|
||||
apiManagerRoutes := router.Group("/api")
|
||||
apiManagerRoutes.Use(authMiddleware(func(ficteam string, teamid int64, c *gin.Context) bool {
|
||||
for _, manager := range ManagerUsers {
|
||||
if manager == ficteam {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"errmsg": "Not authorized."})
|
||||
return false
|
||||
}))
|
||||
|
||||
declareTodoManagerRoutes(apiManagerRoutes)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue