@@ -21,15 +21,14 @@ import (
21
21
22
22
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
23
23
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
24
- edb "github.com/sourcegraph/sourcegraph/enterprise/internal/database"
25
- ghaauth "github.com/sourcegraph/sourcegraph/enterprise/internal/github_apps/auth"
26
- ghtypes "github.com/sourcegraph/sourcegraph/enterprise/internal/github_apps/types"
27
24
authcheck "github.com/sourcegraph/sourcegraph/internal/auth"
28
25
"github.com/sourcegraph/sourcegraph/internal/database"
29
26
"github.com/sourcegraph/sourcegraph/internal/encryption"
30
27
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
31
28
"github.com/sourcegraph/sourcegraph/internal/extsvc"
32
29
"github.com/sourcegraph/sourcegraph/internal/extsvc/github"
30
+ ghaauth "github.com/sourcegraph/sourcegraph/internal/github_apps/auth"
31
+ ghtypes "github.com/sourcegraph/sourcegraph/internal/github_apps/types"
33
32
"github.com/sourcegraph/sourcegraph/internal/rcache"
34
33
"github.com/sourcegraph/sourcegraph/internal/trace"
35
34
"github.com/sourcegraph/sourcegraph/internal/types"
@@ -51,8 +50,7 @@ func Middleware(db database.DB) *auth.Middleware {
51
50
52
51
const cacheTTLSeconds = 60 * 60 // 1 hour
53
52
54
- func newMiddleware (ossDB database.DB , authPrefix string , isAPIHandler bool , next http.Handler ) http.Handler {
55
- db := edb .NewEnterpriseDB (ossDB )
53
+ func newMiddleware (db database.DB , authPrefix string , isAPIHandler bool , next http.Handler ) http.Handler {
56
54
ghAppState := rcache .NewWithTTL ("github_app_state" , cacheTTLSeconds )
57
55
handler := newServeMux (db , authPrefix , ghAppState )
58
56
@@ -72,7 +70,7 @@ func newMiddleware(ossDB database.DB, authPrefix string, isAPIHandler bool, next
72
70
}
73
71
74
72
// checkSiteAdmin checks if the current user is a site admin and sets http error if not
75
- func checkSiteAdmin (db edb. EnterpriseDB , w http.ResponseWriter , req * http.Request ) error {
73
+ func checkSiteAdmin (db database. DB , w http.ResponseWriter , req * http.Request ) error {
76
74
err := authcheck .CheckCurrentUserIsSiteAdmin (req .Context (), db )
77
75
if err == nil {
78
76
return nil
@@ -117,7 +115,7 @@ type gitHubAppStateDetails struct {
117
115
AppID int `json:"app_id,omitempty"`
118
116
}
119
117
120
- func newServeMux (db edb. EnterpriseDB , prefix string , cache * rcache.Cache ) http.Handler {
118
+ func newServeMux (db database. DB , prefix string , cache * rcache.Cache ) http.Handler {
121
119
r := mux .NewRouter ()
122
120
123
121
r .Path (prefix + "/state" ).Methods ("GET" ).HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
0 commit comments