[FEAT] API support for repository flags
Expose the repository flags feature over the API, so the flags can be
managed by a site administrator without using the web API.
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit bac9f0225d
)
This commit is contained in:
parent
f09f6e029b
commit
e7f5c1ba14
6 changed files with 686 additions and 0 deletions
|
@ -1096,6 +1096,18 @@ func Routes() *web.Route {
|
|||
m.Get("/permission", repo.GetRepoPermissions)
|
||||
})
|
||||
}, reqToken())
|
||||
if setting.Repository.EnableFlags {
|
||||
m.Group("/flags", func() {
|
||||
m.Combo("").Get(repo.ListFlags).
|
||||
Put(bind(api.ReplaceFlagsOption{}), repo.ReplaceAllFlags).
|
||||
Delete(repo.DeleteAllFlags)
|
||||
m.Group("/{flag}", func() {
|
||||
m.Combo("").Get(repo.HasFlag).
|
||||
Put(repo.AddFlag).
|
||||
Delete(repo.DeleteFlag)
|
||||
})
|
||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryAdmin), reqToken(), reqSiteAdmin())
|
||||
}
|
||||
m.Get("/assignees", reqToken(), reqAnyRepoReader(), repo.GetAssignees)
|
||||
m.Get("/reviewers", reqToken(), reqAnyRepoReader(), repo.GetReviewers)
|
||||
m.Group("/teams", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue