From 01b9521d09c6878a00abd4fc28ee65d72144fa67 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Fri, 6 Sep 2024 07:05:55 +0200 Subject: [PATCH] temporarily vendor from fork Signed-off-by: Christian Richter --- go.mod | 2 + go.sum | 4 +- .../pkg/ocm/provider/authorizer/json/json.go | 6 +- .../v2/pkg/ocm/share/repository/json/json.go | 93 ++++++++++++++++++- vendor/modules.txt | 3 +- 5 files changed, 102 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 5500c42769..2229d150ca 100644 --- a/go.mod +++ b/go.mod @@ -365,6 +365,8 @@ replace github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-202 replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 +replace github.com/cs3org/reva/v2 => github.com/dragonchaser/reva/v2 v2.4.1-0.20240906050800-d68d37964295 + // exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3 // see https://github.com/mattn/go-sqlite3/issues/965 for more details exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible diff --git a/go.sum b/go.sum index a632b15692..ec891731e9 100644 --- a/go.sum +++ b/go.sum @@ -255,8 +255,6 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE= -github.com/cs3org/reva/v2 v2.23.1-0.20240905133054-2de6ff31c4e3 h1:L1fD7ShX6W17e5YMgWpcmCq2KVHQy48gFrnc261iohQ= -github.com/cs3org/reva/v2 v2.23.1-0.20240905133054-2de6ff31c4e3/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= @@ -291,6 +289,8 @@ github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyG github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dragonchaser/reva/v2 v2.4.1-0.20240906050800-d68d37964295 h1:/fGWgMqZ6YZ3979MJ3UgQRHNDZIxzCX1vlY2008f3d8= +github.com/dragonchaser/reva/v2 v2.4.1-0.20240906050800-d68d37964295/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= diff --git a/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go b/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go index fc3eb0c891..dac24f9c99 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go @@ -104,7 +104,11 @@ func normalizeDomain(d string) (string, error) { return "", err } - return u.Host, nil + normalizedDomain := u.Hostname() + if port := u.Port(); port != "" { + normalizedDomain += ":" + port + } + return normalizedDomain, nil } func (a *authorizer) GetInfoByDomain(_ context.Context, domain string) (*ocmprovider.ProviderInfo, error) { diff --git a/vendor/github.com/cs3org/reva/v2/pkg/ocm/share/repository/json/json.go b/vendor/github.com/cs3org/reva/v2/pkg/ocm/share/repository/json/json.go index 139a320b4e..234b76553a 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/ocm/share/repository/json/json.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/ocm/share/repository/json/json.go @@ -381,8 +381,97 @@ func receivedShareEqual(ref *ocm.ShareReference, s *ocm.ReceivedShare) bool { return false } -func (m *mgr) UpdateShare(ctx context.Context, user *userpb.User, ref *ocm.ShareReference, f ...*ocm.UpdateOCMShareRequest_UpdateField) (*ocm.Share, error) { - return nil, errtypes.NotSupported("not yet implemented") +// UpdateShare updates the share with the given fields. +func (m *mgr) UpdateShare(ctx context.Context, user *userpb.User, ref *ocm.ShareReference, fields ...*ocm.UpdateOCMShareRequest_UpdateField) (*ocm.Share, error) { + m.Lock() + defer m.Unlock() + if err := m.load(); err != nil { + return nil, err + } + for _, s := range m.model.Shares { + if sharesEqual(ref, s) { + if utils.UserEqual(user.Id, s.Owner) || utils.UserEqual(user.Id, s.Creator) { + + for _, f := range fields { + if exp := f.GetExpiration(); exp != nil { + s.Expiration = exp + } + if am := f.GetAccessMethods(); am != nil { + var ( + webdavOptions *ocm.WebDAVAccessMethod + webappOptions *ocm.WebappAccessMethod + transferOptions *ocm.TransferAccessMethod + // TODO: *AccessMethod_GenericOptions + + newWebdavOptions *ocm.WebDAVAccessMethod + newWebappOptions *ocm.WebappAccessMethod + newTransferOptions *ocm.TransferAccessMethod + // TODO: *AccessMethod_GenericOptions + ) + + for _, sm := range s.GetAccessMethods() { + webdavOptions = sm.GetWebdavOptions() + webappOptions = sm.GetWebappOptions() + transferOptions = sm.GetTransferOptions() + } + + newWebdavOptions = am.GetWebdavOptions() + newWebappOptions = am.GetWebappOptions() + newTransferOptions = am.GetTransferOptions() + + newAccesMethods := []*ocm.AccessMethod{} + + if newWebdavOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_WebdavOptions{ + WebdavOptions: newWebdavOptions, + }, + }) + } else if webdavOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_WebdavOptions{ + WebdavOptions: webdavOptions, + }, + }) + } + + if newWebappOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_WebappOptions{ + WebappOptions: newWebappOptions, + }, + }) + } else if webappOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_WebappOptions{ + WebappOptions: webappOptions, + }, + }) + } + + if newTransferOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_TransferOptions{ + TransferOptions: newTransferOptions, + }, + }) + } else if transferOptions != nil { + newAccesMethods = append(newAccesMethods, &ocm.AccessMethod{ + Term: &ocm.AccessMethod_TransferOptions{ + TransferOptions: transferOptions, + }, + }) + } + s.AccessMethods = newAccesMethods + } + } + + return s, nil + } + } + } + + return nil, errtypes.NotFound(ref.String()) } func (m *mgr) ListShares(ctx context.Context, user *userpb.User, filters []*ocm.ListOCMSharesRequest_Filter) ([]*ocm.Share, error) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 927340e68b..7b353727f0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -367,7 +367,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.23.1-0.20240905133054-2de6ff31c4e3 +# github.com/cs3org/reva/v2 v2.23.1-0.20240905133054-2de6ff31c4e3 => github.com/dragonchaser/reva/v2 v2.4.1-0.20240906050800-d68d37964295 ## explicit; go 1.21 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime @@ -2437,3 +2437,4 @@ stash.kopano.io/kgol/rndm # github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240802074440-aade4a234387 # github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c # github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 +# github.com/cs3org/reva/v2 => github.com/dragonchaser/reva/v2 v2.4.1-0.20240906050800-d68d37964295