fix(hook): instance admins wrongly restricted by permissions checks
This exception existed for both instance admins and repo admins before ApplyToAdmins was introduced in79b7089360
. It should have been kept for instance admins only because they are not subject to permission checks. (cherry picked from commit05f0007437
)
This commit is contained in:
parent
bad8e72bcd
commit
baec3dc6b9
|
@ -398,6 +398,11 @@ func preReceiveBranch(ctx *preReceiveContext, oldCommitID, newCommitID string, r
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're an admin for the instance, we can ignore checks
|
||||||
|
if ctx.user.IsAdmin {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// It's not allowed t overwrite protected files. Unless if the user is an
|
// It's not allowed t overwrite protected files. Unless if the user is an
|
||||||
// admin and the protected branch rule doesn't apply to admins.
|
// admin and the protected branch rule doesn't apply to admins.
|
||||||
if changedProtectedfiles && (!ctx.user.IsAdmin || protectBranch.ApplyToAdmins) {
|
if changedProtectedfiles && (!ctx.user.IsAdmin || protectBranch.ApplyToAdmins) {
|
||||||
|
|
Loading…
Reference in New Issue