mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 05:41:12 +00:00
added missing capability item to context to prevent login panic
This commit is contained in:
parent
6b721f5b98
commit
a61c19dddc
1 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,7 @@ import (
|
||||||
"github.com/drone/drone/plugin/remote/github"
|
"github.com/drone/drone/plugin/remote/github"
|
||||||
"github.com/drone/drone/plugin/remote/gitlab"
|
"github.com/drone/drone/plugin/remote/gitlab"
|
||||||
"github.com/drone/drone/server/blobstore"
|
"github.com/drone/drone/server/blobstore"
|
||||||
|
"github.com/drone/drone/server/capability"
|
||||||
"github.com/drone/drone/server/datastore"
|
"github.com/drone/drone/server/datastore"
|
||||||
"github.com/drone/drone/server/datastore/database"
|
"github.com/drone/drone/server/datastore/database"
|
||||||
"github.com/drone/drone/server/worker/director"
|
"github.com/drone/drone/server/worker/director"
|
||||||
|
@ -67,6 +68,8 @@ var (
|
||||||
nodes StringArr
|
nodes StringArr
|
||||||
|
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
|
|
||||||
|
caps map[string]bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -90,6 +93,9 @@ func main() {
|
||||||
github.Register()
|
github.Register()
|
||||||
gitlab.Register()
|
gitlab.Register()
|
||||||
|
|
||||||
|
caps = map[string]bool{}
|
||||||
|
caps[capability.Registration] = open
|
||||||
|
|
||||||
// setup the database and cancel all pending
|
// setup the database and cancel all pending
|
||||||
// commits in the system.
|
// commits in the system.
|
||||||
db = database.MustConnect(driver, datasource)
|
db = database.MustConnect(driver, datasource)
|
||||||
|
@ -183,6 +189,7 @@ func ContextMiddleware(c *web.C, h http.Handler) http.Handler {
|
||||||
ctx = pool.NewContext(ctx, workers)
|
ctx = pool.NewContext(ctx, workers)
|
||||||
ctx = director.NewContext(ctx, worker)
|
ctx = director.NewContext(ctx, worker)
|
||||||
ctx = pubsub.NewContext(ctx, pub)
|
ctx = pubsub.NewContext(ctx, pub)
|
||||||
|
ctx = capability.NewContext(ctx, caps)
|
||||||
|
|
||||||
// add the context to the goji web context
|
// add the context to the goji web context
|
||||||
webcontext.Set(c, ctx)
|
webcontext.Set(c, ctx)
|
||||||
|
|
Loading…
Reference in a new issue