mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-28 18:14:41 +00:00
Drop error only on purpose or else report back or log (#514)
- Remove Deadcode - Simplify Code - Drop error only on purpose
This commit is contained in:
@@ -104,7 +104,10 @@ func SetPerm() gin.HandlerFunc {
|
||||
perm.Repo = repo.FullName
|
||||
perm.UserID = user.ID
|
||||
perm.Synced = time.Now().Unix()
|
||||
store_.PermUpsert(perm)
|
||||
if err := store_.PermUpsert(perm); err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ func MustAdmin() gin.HandlerFunc {
|
||||
case user == nil:
|
||||
c.String(401, "User not authorized")
|
||||
c.Abort()
|
||||
case user.Admin == false:
|
||||
case !user.Admin:
|
||||
c.String(403, "User not authorized")
|
||||
c.Abort()
|
||||
default:
|
||||
@@ -95,7 +95,7 @@ func MustRepoAdmin() gin.HandlerFunc {
|
||||
case user == nil:
|
||||
c.String(401, "User not authorized")
|
||||
c.Abort()
|
||||
case perm.Admin == false:
|
||||
case !perm.Admin:
|
||||
c.String(403, "User not authorized")
|
||||
c.Abort()
|
||||
default:
|
||||
|
Reference in New Issue
Block a user