mirror of https://github.com/go-gitea/gitea.git
Allow users with write permission to run actions (#32644)
--- I have a use case where I need a team to be able to run actions without admin access.
This commit is contained in:
parent
16a7d343d7
commit
1b296ed1a4
|
@ -168,8 +168,8 @@ func List(ctx *context.Context) {
|
||||||
actionsConfig := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
|
actionsConfig := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
|
||||||
ctx.Data["ActionsConfig"] = actionsConfig
|
ctx.Data["ActionsConfig"] = actionsConfig
|
||||||
|
|
||||||
if len(workflowID) > 0 && ctx.Repo.IsAdmin() {
|
if len(workflowID) > 0 && ctx.Repo.CanWrite(unit.TypeActions) {
|
||||||
ctx.Data["AllowDisableOrEnableWorkflow"] = true
|
ctx.Data["AllowDisableOrEnableWorkflow"] = ctx.Repo.IsAdmin()
|
||||||
isWorkflowDisabled := actionsConfig.IsWorkflowDisabled(workflowID)
|
isWorkflowDisabled := actionsConfig.IsWorkflowDisabled(workflowID)
|
||||||
ctx.Data["CurWorkflowDisabled"] = isWorkflowDisabled
|
ctx.Data["CurWorkflowDisabled"] = isWorkflowDisabled
|
||||||
|
|
||||||
|
|
|
@ -1406,7 +1406,7 @@ func registerRoutes(m *web.Router) {
|
||||||
m.Get("", actions.List)
|
m.Get("", actions.List)
|
||||||
m.Post("/disable", reqRepoAdmin, actions.DisableWorkflowFile)
|
m.Post("/disable", reqRepoAdmin, actions.DisableWorkflowFile)
|
||||||
m.Post("/enable", reqRepoAdmin, actions.EnableWorkflowFile)
|
m.Post("/enable", reqRepoAdmin, actions.EnableWorkflowFile)
|
||||||
m.Post("/run", reqRepoAdmin, actions.Run)
|
m.Post("/run", reqRepoActionsWriter, actions.Run)
|
||||||
|
|
||||||
m.Group("/runs/{run}", func() {
|
m.Group("/runs/{run}", func() {
|
||||||
m.Combo("").
|
m.Combo("").
|
||||||
|
|
Loading…
Reference in New Issue