Skip to content

Commit

Permalink
Fix (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
ostcar authored Jan 7, 2021
1 parent 087e3a8 commit 0911e76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cmd/autoupdate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ func run() error {
// Permission Service.
var perms restrict.Permissioner = new(test.MockPermission)
var updater autoupdate.UserUpdater
if env["DEACTIVATE_PERMISSION"] != "false" {
fmt.Println("Permission-Service: fake")
permService := "fake"
if env["DEACTIVATE_PERMISSION"] == "false" {
permService = "permission"
p := permission.New(datastoreService)
perms = p
updater = p
}
fmt.Println("Permission-Service: " + permService)

// Restricter Service.
checker := restrict.RelationChecker(restrict.RelationLists, perms)
Expand Down
4 changes: 2 additions & 2 deletions internal/autoupdate/autoupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Autoupdate struct {
}

// New creates a new autoupdate service.
func New(datastore Datastore, restricter Restricter, userUdater UserUpdater, closed <-chan struct{}) *Autoupdate {
func New(datastore Datastore, restricter Restricter, userUpater UserUpdater, closed <-chan struct{}) *Autoupdate {
a := &Autoupdate{
datastore: datastore,
restricter: restricter,
Expand All @@ -49,7 +49,7 @@ func New(datastore Datastore, restricter Restricter, userUdater UserUpdater, clo
keys = append(keys, k)
}

uids, err := userUdater.AdditionalUpdate(context.TODO(), data)
uids, err := userUpater.AdditionalUpdate(context.TODO(), data)
if err != nil {
return fmt.Errorf("getting addition user ids: %w", err)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func Complex(mux *http.ServeMux, auth Authenticater, db keysbuilder.DataProvider
return
}

// TODO: This should not be run here. This is only for development
kb.Update(r.Context())

// This blocks until the request is done.
if err := liver.Live(r.Context(), uid, w, kb); err != nil {
handleError(w, err, false)
Expand Down

0 comments on commit 0911e76

Please sign in to comment.