mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat: UI for the pull request trust management panel
See the documentation pull request for a description https://codeberg.org/forgejo/docs/pulls/1567 https://forgejo.codeberg.page/@docs_pull_1567/docs/next/user/actions/security-pull-request/
This commit is contained in:
parent
465d057fae
commit
57f986c7b1
10 changed files with 559 additions and 2 deletions
|
|
@ -111,6 +111,19 @@ func RequireRepoReaderOr(unitTypes ...unit.Type) func(ctx *Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func RequireRepoDelegateActionTrust() func(ctx *Context) {
|
||||
return func(ctx *Context) {
|
||||
if CheckRepoDelegateActionTrust(ctx) {
|
||||
return
|
||||
}
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
}
|
||||
}
|
||||
|
||||
func CheckRepoDelegateActionTrust(ctx *Context) bool {
|
||||
return ctx.Repo.IsAdmin() || (ctx.IsSigned && ctx.Doer.IsAdmin) || ctx.Repo.CanWrite(unit.TypeActions)
|
||||
}
|
||||
|
||||
// CheckRepoScopedToken check whether personal access token has repo scope
|
||||
func CheckRepoScopedToken(ctx *Context, repo *repo_model.Repository, level auth_model.AccessTokenScopeLevel) {
|
||||
if !ctx.IsBasicAuth || ctx.Data["IsApiToken"] != true {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue