X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2ab1b540a710fd454f33e9ba22db601e67f3d217..cb19768b29658ec88b0df76e5b2e221934176057:/services/ws/permission.go diff --git a/services/ws/permission.go b/services/ws/permission.go index 8bfcfcb9e6..ac895f80e5 100644 --- a/services/ws/permission.go +++ b/services/ws/permission.go @@ -1,11 +1,17 @@ -package main +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +package ws import ( + "context" "net/http" "net/url" "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/ctxlog" ) const ( @@ -15,7 +21,7 @@ const ( type permChecker interface { SetToken(token string) - Check(uuid string) (bool, error) + Check(ctx context.Context, uuid string) (bool, error) } func newPermChecker(ac arvados.Client) permChecker { @@ -50,9 +56,9 @@ func (pc *cachingPermChecker) SetToken(token string) { pc.cache = make(map[string]cacheEnt) } -func (pc *cachingPermChecker) Check(uuid string) (bool, error) { +func (pc *cachingPermChecker) Check(ctx context.Context, uuid string) (bool, error) { pc.nChecks++ - logger := logger(nil). + logger := ctxlog.FromContext(ctx). WithField("token", pc.Client.AuthToken). WithField("uuid", uuid) pc.tidy() @@ -70,7 +76,8 @@ func (pc *cachingPermChecker) Check(uuid string) (bool, error) { pc.nMisses++ err = pc.RequestAndDecode(&buf, "GET", path, nil, url.Values{ - "select": {`["uuid"]`}, + "include_trash": {"true"}, + "select": {`["uuid"]`}, }) var allowed bool