mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-17 03:45:13 +00:00
allow in a patch update to change the build number if the user is an admin
This commit is contained in:
parent
c8313f8cd8
commit
a848f3e793
2 changed files with 14 additions and 10 deletions
|
@ -57,13 +57,14 @@ func (r *Repo) Update(from *Repo) {
|
||||||
|
|
||||||
// RepoPatch represents a repository patch object.
|
// RepoPatch represents a repository patch object.
|
||||||
type RepoPatch struct {
|
type RepoPatch struct {
|
||||||
Config *string `json:"config_file,omitempty"`
|
Config *string `json:"config_file,omitempty"`
|
||||||
IsTrusted *bool `json:"trusted,omitempty"`
|
IsTrusted *bool `json:"trusted,omitempty"`
|
||||||
IsGated *bool `json:"gated,omitempty"`
|
IsGated *bool `json:"gated,omitempty"`
|
||||||
Timeout *int64 `json:"timeout,omitempty"`
|
Timeout *int64 `json:"timeout,omitempty"`
|
||||||
Visibility *string `json:"visibility,omitempty"`
|
Visibility *string `json:"visibility,omitempty"`
|
||||||
AllowPull *bool `json:"allow_pr,omitempty"`
|
AllowPull *bool `json:"allow_pr,omitempty"`
|
||||||
AllowPush *bool `json:"allow_push,omitempty"`
|
AllowPush *bool `json:"allow_push,omitempty"`
|
||||||
AllowDeploy *bool `json:"allow_deploy,omitempty"`
|
AllowDeploy *bool `json:"allow_deploy,omitempty"`
|
||||||
AllowTag *bool `json:"allow_tag,omitempty"`
|
AllowTag *bool `json:"allow_tag,omitempty"`
|
||||||
|
BuildCounter *int `json:"build_counter,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ func PatchRepo(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in.IsTrusted != nil || in.Timeout != nil) && !user.Admin {
|
if (in.IsTrusted != nil || in.Timeout != nil || in.BuildCounter != nil) && !user.Admin {
|
||||||
c.String(403, "Insufficient privileges")
|
c.String(403, "Insufficient privileges")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,9 @@ func PatchRepo(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if in.BuildCounter != nil {
|
||||||
|
repo.Counter = *in.BuildCounter
|
||||||
|
}
|
||||||
|
|
||||||
err := store.UpdateRepo(c, repo)
|
err := store.UpdateRepo(c, repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue