mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-22 05:15:22 +02:00
permission
This commit is contained in:
parent
d17a0b13f1
commit
3e8de17db3
@ -143,6 +143,9 @@ func NotifyNewPullRequest(ctx context.Context, pr *issues_model.PullRequest, men
|
|||||||
log.Error("%v", err)
|
log.Error("%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if err := pr.Issue.LoadPoster(ctx); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if pr.Issue.Poster.IsBots() {
|
if pr.Issue.Poster.IsBots() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
bots_model "code.gitea.io/gitea/models/bots"
|
||||||
"code.gitea.io/gitea/models/organization"
|
"code.gitea.io/gitea/models/organization"
|
||||||
"code.gitea.io/gitea/models/perm"
|
"code.gitea.io/gitea/models/perm"
|
||||||
perm_model "code.gitea.io/gitea/models/perm"
|
perm_model "code.gitea.io/gitea/models/perm"
|
||||||
@ -187,6 +188,17 @@ func repoAssignment() func(ctx *context.APIContext) {
|
|||||||
ctx.Repo.Repository = repo
|
ctx.Repo.Repository = repo
|
||||||
|
|
||||||
if ctx.Doer != nil && ctx.Doer.ID == user_model.BotUserID {
|
if ctx.Doer != nil && ctx.Doer.ID == user_model.BotUserID {
|
||||||
|
botTaskID := ctx.Data["BotTaskID"].(int64)
|
||||||
|
task, err := bots_model.GetTaskByID(ctx, botTaskID)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Error(http.StatusInternalServerError, "bots_model.GetTaskByID", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if task.RepoID != repo.ID {
|
||||||
|
ctx.NotFound()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Repo.Permission.AccessMode = perm_model.AccessModeAdmin
|
ctx.Repo.Permission.AccessMode = perm_model.AccessModeAdmin
|
||||||
if err := ctx.Repo.Repository.LoadUnits(ctx); err != nil {
|
if err := ctx.Repo.Repository.LoadUnits(ctx); err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "LoadUnits", err)
|
ctx.Error(http.StatusInternalServerError, "LoadUnits", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user