mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-19 08:21:01 +00:00
22 lines
342 B
Go
22 lines
342 B
Go
|
package session
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func MustTeamAdmin() gin.HandlerFunc {
|
||
|
return func(c *gin.Context) {
|
||
|
user := User(c)
|
||
|
switch {
|
||
|
case user == nil:
|
||
|
c.String(401, "User not authorized")
|
||
|
c.Abort()
|
||
|
case user.Admin == false:
|
||
|
c.String(413, "User not authorized")
|
||
|
c.Abort()
|
||
|
default:
|
||
|
c.Next()
|
||
|
}
|
||
|
}
|
||
|
}
|