diff --git a/changelog/unreleased/implement-sharing-roles.md b/changelog/unreleased/implement-sharing-roles.md new file mode 100644 index 00000000000..eae0d3314e4 --- /dev/null +++ b/changelog/unreleased/implement-sharing-roles.md @@ -0,0 +1,6 @@ +Enhancement: Implement sharing roles + +Implement libre graph sharing roles + +https://github.com/cs3org/reva/pull/4267 +https://github.com/owncloud/ocis/issues/7418 diff --git a/cmd/reva/ocm-share-create.go b/cmd/reva/ocm-share-create.go index f183cdfb32e..65ce3f90884 100644 --- a/cmd/reva/ocm-share-create.go +++ b/cmd/reva/ocm-share-create.go @@ -30,7 +30,7 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" ocmshare "github.com/cs3org/reva/v2/pkg/ocm/share" "github.com/cs3org/reva/v2/pkg/utils" "github.com/jedib0t/go-pretty/table" diff --git a/cmd/reva/share-create.go b/cmd/reva/share-create.go index 1806cbeeaf2..5579c3b6312 100644 --- a/cmd/reva/share-create.go +++ b/cmd/reva/share-create.go @@ -28,7 +28,7 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/utils" "github.com/jedib0t/go-pretty/table" "github.com/pkg/errors" diff --git a/go.mod b/go.mod index df5fdfc6c29..24871e936fd 100644 --- a/go.mod +++ b/go.mod @@ -60,6 +60,7 @@ require ( github.com/onsi/ginkgo v1.16.5 github.com/onsi/ginkgo/v2 v2.11.0 github.com/onsi/gomega v1.27.8 + github.com/owncloud/libre-graph-api-go v1.0.5-0.20230512172639-d458ad6b300b github.com/owncloud/ocis/v2 v2.0.1-0.20230606150602-25d7dae4667b github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.9 @@ -85,13 +86,13 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - golang.org/x/crypto v0.11.0 + golang.org/x/crypto v0.14.0 golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 - golang.org/x/oauth2 v0.10.0 + golang.org/x/oauth2 v0.13.0 golang.org/x/sync v0.2.0 - golang.org/x/sys v0.10.0 - golang.org/x/term v0.10.0 - golang.org/x/text v0.11.0 + golang.org/x/sys v0.13.0 + golang.org/x/term v0.13.0 + golang.org/x/text v0.13.0 google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 @@ -213,10 +214,10 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.23.0 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.9.3 // indirect - google.golang.org/appengine v1.6.7 // indirect + google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/ini.v1 v1.67.0 // indirect @@ -229,3 +230,5 @@ require ( // the replacement build is based on https://github.com/dragonchaser/cs3apis/tree/master replace github.com/cs3org/go-cs3apis => github.com/aduffeck/go-cs3apis v0.0.0-20231009082215-ad45e19edac0 + +replace github.com/owncloud/libre-graph-api-go => github.com/owncloud/libre-graph-api-go v1.0.5-0.20231013101137-2757d88d116d diff --git a/go.sum b/go.sum index fa52827689a..a6968daf47f 100644 --- a/go.sum +++ b/go.sum @@ -1058,6 +1058,8 @@ github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/owncloud/libre-graph-api-go v1.0.5-0.20231013101137-2757d88d116d h1:CDmOfOkS0Yu0O+EAmshJzm6LWnV4pxQAkguykuB9I7o= +github.com/owncloud/libre-graph-api-go v1.0.5-0.20231013101137-2757d88d116d/go.mod h1:iKdVH6nYpI8RBeK9sjeLfzrPByST6r9d+NG2IJHoJmU= github.com/owncloud/ocis/v2 v2.0.1-0.20230606150602-25d7dae4667b h1:Aiou+DcU5B10HSCIumhg9X+2Qaljt6Qc+aIEfM5VsCc= github.com/owncloud/ocis/v2 v2.0.1-0.20230606150602-25d7dae4667b/go.mod h1:B+5L2ssUvYoy1yDi2PM7/qRAtsHcJ6SGGqC5SvmljjY= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= @@ -1302,8 +1304,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1411,8 +1413,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1424,6 +1426,7 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -1438,8 +1441,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1569,8 +1572,8 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1578,8 +1581,8 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1594,8 +1597,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1738,8 +1741,9 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= diff --git a/internal/http/services/owncloud/ocdav/propfind/propfind.go b/internal/http/services/owncloud/ocdav/propfind/propfind.go index ea0be352e07..0aa094f3246 100644 --- a/internal/http/services/owncloud/ocdav/propfind/propfind.go +++ b/internal/http/services/owncloud/ocdav/propfind/propfind.go @@ -43,8 +43,8 @@ import ( "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/publicshare" rstatus "github.com/cs3org/reva/v2/pkg/rgrpc/status" diff --git a/internal/http/services/owncloud/ocdav/tus.go b/internal/http/services/owncloud/ocdav/tus.go index 84a3515eddb..1a7fd36e2d7 100644 --- a/internal/http/services/owncloud/ocdav/tus.go +++ b/internal/http/services/owncloud/ocdav/tus.go @@ -35,8 +35,8 @@ import ( "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/rhttp" "github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/utils" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/sharees.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/sharees.go index cdb027c2c93..3feaf9096c8 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/sharees.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/sharees.go @@ -24,9 +24,9 @@ import ( grouppb "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1" userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/token.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/token.go index 60314c6cc7d..be0c12e1cab 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/token.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/sharees/token.go @@ -31,9 +31,9 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/storagespace" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/group.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/group.go index 3a5d6a69c8f..31da73f23dc 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/group.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/group.go @@ -26,8 +26,8 @@ import ( collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + "github.com/cs3org/reva/v2/pkg/conversions" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" ) diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go index b408909c2ac..237b23d590c 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go @@ -32,9 +32,9 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/utils" "github.com/go-chi/chi/v5" "github.com/pkg/errors" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go index f1f636914a6..b0487216bbc 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go @@ -29,11 +29,11 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/huandu/xstrings" "github.com/rs/zerolog/log" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go index 14e81551463..c118f559c86 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go @@ -32,8 +32,8 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/ocm/share" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/go-chi/chi/v5" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 4d3674f9268..5b6c2881645 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -40,6 +40,7 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/password" "github.com/go-chi/chi/v5" "github.com/rs/zerolog" @@ -48,7 +49,6 @@ import ( ocmv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go index a473ca0f43e..f3def1ca593 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go @@ -31,9 +31,9 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" registry "github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go index 8b535be7f70..e88ef16a675 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go @@ -28,9 +28,9 @@ import ( ocmpb "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/utils" diff --git a/internal/http/services/owncloud/ocs/handlers/cloud/user/user.go b/internal/http/services/owncloud/ocs/handlers/cloud/user/user.go index 0c6465d1adb..fa859cb68ea 100644 --- a/internal/http/services/owncloud/ocs/handlers/cloud/user/user.go +++ b/internal/http/services/owncloud/ocs/handlers/cloud/user/user.go @@ -22,8 +22,8 @@ import ( "fmt" "net/http" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" ) diff --git a/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go b/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go index da105fd1ea9..a494191b873 100644 --- a/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go +++ b/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go @@ -30,9 +30,9 @@ import ( cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" cs3storage "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/utils" diff --git a/internal/http/services/sciencemesh/share.go b/internal/http/services/sciencemesh/share.go index efb6f3d4a74..af51c5e6b4e 100644 --- a/internal/http/services/sciencemesh/share.go +++ b/internal/http/services/sciencemesh/share.go @@ -31,9 +31,9 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" providerpb "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/internal/http/services/reqres" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/ocm/share" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/go-playground/validator/v10" diff --git a/pkg/cbox/utils/conversions.go b/pkg/cbox/utils/conversions.go index 96f25864660..250b26f9990 100644 --- a/pkg/cbox/utils/conversions.go +++ b/pkg/cbox/utils/conversions.go @@ -31,7 +31,7 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" ) // DBShare stores information about user and public shares. diff --git a/internal/http/services/owncloud/ocs/conversions/main.go b/pkg/conversions/main.go similarity index 100% rename from internal/http/services/owncloud/ocs/conversions/main.go rename to pkg/conversions/main.go diff --git a/internal/http/services/owncloud/ocs/conversions/permissions.go b/pkg/conversions/permissions.go similarity index 100% rename from internal/http/services/owncloud/ocs/conversions/permissions.go rename to pkg/conversions/permissions.go diff --git a/internal/http/services/owncloud/ocs/conversions/permissions_test.go b/pkg/conversions/permissions_test.go similarity index 100% rename from internal/http/services/owncloud/ocs/conversions/permissions_test.go rename to pkg/conversions/permissions_test.go diff --git a/internal/http/services/owncloud/ocs/conversions/role.go b/pkg/conversions/role.go similarity index 100% rename from internal/http/services/owncloud/ocs/conversions/role.go rename to pkg/conversions/role.go diff --git a/pkg/conversions/unifiedrole.go b/pkg/conversions/unifiedrole.go new file mode 100644 index 00000000000..cbb05322eb8 --- /dev/null +++ b/pkg/conversions/unifiedrole.go @@ -0,0 +1,320 @@ +package conversions + +import ( + libregraph "github.com/owncloud/libre-graph-api-go" + "google.golang.org/protobuf/proto" +) + +const ( + // UnifiedRoleViewerID Unified role viewer id. + UnifiedRoleViewerID = "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + // UnifiedRoleSpaceViewerID Unified role space viewer id. + UnifiedRoleSpaceViewerID = "a8d5fe5e-96e3-418d-825b-534dbdf22b99" + // UnifiedRoleEditorID Unified role editor id. + UnifiedRoleEditorID = "fb6c3e19-e378-47e5-b277-9732f9de6e21" + // UnifiedRoleSpaceEditorID Unified role space editor id. + UnifiedRoleSpaceEditorID = "58c63c02-1d89-4572-916a-870abc5a1b7d" + // UnifiedRoleFileEditorID Unified role file editor id. + UnifiedRoleFileEditorID = "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + // UnifiedRoleCoownerID Unified role coowner id. + UnifiedRoleCoownerID = "3a4ba8e9-6a0d-4235-9140-0e7a34007abe" + // UnifiedRoleUploaderID Unified role uploader id. + UnifiedRoleUploaderID = "1c996275-f1c9-4e71-abdf-a42f6495e960" + // UnifiedRoleManagerID Unified role manager id. + UnifiedRoleManagerID = "312c0871-5ef7-4b3a-85b6-0e4074c64049" + + // UnifiedRoleUnknownID Unified role unknown id. + UnifiedRoleUnknownID = "d76b1f66-8cd6-4ac1-9769-468cfcb6c683" + // UnifiedRoleLegacyID Unified role legacy id. + UnifiedRoleLegacyID = "9486869a-bfa0-415e-81c4-c15e41b7cb2a" + // UnifiedRoleDeniedID Unified role denied id + UnifiedRoleDeniedID = "91a93759-19a7-41c0-adba-a2f343178b75" + + // UnifiedRoleNoneID Unified role none id + UnifiedRoleNoneID = "312c0871-5ef7-4b3a-85b6-0e4074c64049" + + // UnifiedRoleConditionSelf TODO defines constraints when the principal is the owner of the target resource + UnifiedRoleConditionSelf = "Self: @Subject.objectId == @Resource.objectId" + // UnifiedRoleConditionOwner TODO defines constraints when the principal is the owner of the target resource + UnifiedRoleConditionOwner = "Owner: @Subject.objectId Any_of @Resource.owners" + // UnifiedRoleConditionGrantee TODO does not exist in MS Graph, but we use it to express permissions on shared resources + UnifiedRoleConditionGrantee = "Grantee: @Subject.objectId Any_of @Resource.grantee" +) + +// NewUnknownUnifiedRole creates an unknown role. An Unknown role has no permissions over a cs3 resource nor any ocs endpoint. +func NewUnknownUnifiedRole() *libregraph.UnifiedRoleDefinition { + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleUnknownID), + Description: proto.String("An Unknown role has no permissions over a cs3 resource nor any ocs endpoint"), + DisplayName: displayName(NewUnknownRole()), + LibreGraphWeight: proto.Int32(0), + } +} + +// NewDeniedUnifiedRole creates a fully denied role +func NewDeniedUnifiedRole() *libregraph.UnifiedRoleDefinition { + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleDeniedID), + Description: proto.String("A fully denied role"), + DisplayName: displayName(NewDeniedRole()), + LibreGraphWeight: proto.Int32(0), + } +} + +// NewViewerUnifiedRole creates a viewer role. `sharing` indicates if sharing permission should be added +func NewViewerUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition { + r := NewViewerRole(sharing) + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleViewerID), + Description: proto.String("Allows reading the shared file or folder"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewSpaceViewerUnifiedRole creates a spaceviewer role +func NewSpaceViewerUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewSpaceViewerRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleSpaceViewerID), + Description: proto.String("Allows reading the shared space"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionOwner), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewEditorUnifiedRole creates an editor role. `sharing` indicates if sharing permission should be added +func NewEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition { + r := NewEditorRole(sharing) + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleEditorID), + Description: proto.String("Allows creating, reading, updating and deleting the shared file or folder"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewSpaceEditorUnifiedRole creates an editor role +func NewSpaceEditorUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewSpaceEditorRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleSpaceEditorID), + Description: proto.String("Allows creating, reading, updating and deleting file or folder in the shared space"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionOwner), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewFileEditorUnifiedRole creates a file-editor role +func NewFileEditorUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewFileEditorRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleFileEditorID), + Description: proto.String("Allows reading and updating file"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewCoownerUnifiedRole creates a coowner role. +func NewCoownerUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewCoownerRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleCoownerID), + Description: proto.String(""), // TODO add the description + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewUploaderUnifiedRole creates an uploader role +func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewUploaderRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleUploaderID), + Description: proto.String("Allows upload file or folder"), + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +// NewNoneUnifiedRole creates a role with no permissions +// TODO Do we need to map it? +func NewNoneUnifiedRole() *libregraph.UnifiedRoleDefinition { + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleNoneID), + Description: proto.String("A role with no permissions"), + DisplayName: displayName(NewNoneRole()), + LibreGraphWeight: proto.Int32(0), + } +} + +// NewManagerUnifiedRole creates a manager role +func NewManagerUnifiedRole() *libregraph.UnifiedRoleDefinition { + r := NewManagerRole() + return &libregraph.UnifiedRoleDefinition{ + Id: proto.String(UnifiedRoleManagerID), + Description: proto.String(""), // TODO add the description + DisplayName: displayName(r), + RolePermissions: []libregraph.UnifiedRolePermission{ + { + AllowedResourceActions: convert(r), + Condition: proto.String(UnifiedRoleConditionGrantee), + }, + }, + LibreGraphWeight: proto.Int32(0), + } +} + +func displayName(role *Role) *string { + if role == nil { + return nil + } + var displayName string + switch role.Name { + case RoleViewer: + displayName = "Viewer" + break + case RoleSpaceViewer: + displayName = "Space Viewer" + break + case RoleEditor: + displayName = "Editor" + break + case RoleSpaceEditor: + displayName = "Space Editor" + break + case RoleFileEditor: + displayName = "File Editor" + break + case RoleCoowner: + displayName = "Co Owner" + break + case RoleUploader: + displayName = "Uploader" + break + case RoleManager: + displayName = "Manager" + break + case RoleUnknown: + displayName = "Unknown" + break + case RoleLegacy: + displayName = "Legacy" + break + case RoleDenied: + displayName = "Denied" + break + default: + return nil + } + return proto.String(displayName) +} + +func convert(role *Role) []string { + actions := make([]string, 0, 8) + if role == nil && role.cS3ResourcePermissions == nil { + return actions + } + p := role.CS3ResourcePermissions() + if p.AddGrant { + actions = append(actions, "libre.graph/driveItem/permissions/create") + } + if p.CreateContainer { + actions = append(actions, "libre.graph/driveItem/children/create") + } + if p.Delete { + actions = append(actions, "libre.graph/driveItem/standard/delete") + } + if p.GetPath { + actions = append(actions, "libre.graph/driveItem/path/read") + } + if p.GetQuota { + actions = append(actions, "libre.graph/driveItem/quota/read") + } + if p.InitiateFileDownload { + actions = append(actions, "libre.graph/driveItem/content/read") + } + if p.InitiateFileUpload { + actions = append(actions, "libre.graph/driveItem/upload/create") + } + if p.ListGrants { + actions = append(actions, "libre.graph/driveItem/permissions/read") + } + if p.ListContainer { + actions = append(actions, "libre.graph/driveItem/children/read") + } + if p.ListFileVersions { + actions = append(actions, "libre.graph/driveItem/versions/read") + } + if p.ListRecycle { + actions = append(actions, "libre.graph/driveItem/deleted/read") + } + if p.Move { + actions = append(actions, "libre.graph/driveItem/path/update") + } + if p.RemoveGrant { + actions = append(actions, "libre.graph/driveItem/permissions/delete") + } + if p.PurgeRecycle { + actions = append(actions, "libre.graph/driveItem/deleted/delete") + } + if p.RestoreFileVersion { + actions = append(actions, "libre.graph/driveItem/versions/update") + } + if p.RestoreRecycleItem { + actions = append(actions, "libre.graph/driveItem/deleted/update") + } + if p.Stat { + actions = append(actions, "libre.graph/driveItem/basic/read") + } + if p.UpdateGrant { + actions = append(actions, "libre.graph/driveItem/permissions/update") + } + if p.DenyGrant { + actions = append(actions, "libre.graph/driveItem/permissions/deny") + } + return actions +} diff --git a/pkg/publicshare/manager/owncloudsql/conversions.go b/pkg/publicshare/manager/owncloudsql/conversions.go index d5dbc211977..4bbf8c8e749 100644 --- a/pkg/publicshare/manager/owncloudsql/conversions.go +++ b/pkg/publicshare/manager/owncloudsql/conversions.go @@ -27,7 +27,7 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/jellydator/ttlcache/v2" diff --git a/pkg/publicshare/manager/owncloudsql/owncloudsql_test.go b/pkg/publicshare/manager/owncloudsql/owncloudsql_test.go index f3bc8c126b5..d3aa8ace366 100644 --- a/pkg/publicshare/manager/owncloudsql/owncloudsql_test.go +++ b/pkg/publicshare/manager/owncloudsql/owncloudsql_test.go @@ -29,7 +29,7 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/publicshare" "github.com/cs3org/reva/v2/pkg/publicshare/manager/owncloudsql" diff --git a/pkg/share/manager/jsoncs3/jsoncs3_test.go b/pkg/share/manager/jsoncs3/jsoncs3_test.go index 419a6222413..b91c322cacc 100644 --- a/pkg/share/manager/jsoncs3/jsoncs3_test.go +++ b/pkg/share/manager/jsoncs3/jsoncs3_test.go @@ -30,7 +30,7 @@ import ( collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/rgrpc/status" sharespkg "github.com/cs3org/reva/v2/pkg/share" diff --git a/pkg/share/manager/owncloudsql/conversions.go b/pkg/share/manager/owncloudsql/conversions.go index 9b496ce0473..8801cb40621 100644 --- a/pkg/share/manager/owncloudsql/conversions.go +++ b/pkg/share/manager/owncloudsql/conversions.go @@ -30,7 +30,7 @@ import ( collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/utils" diff --git a/pkg/storage/fs/owncloudsql/filecache/filecache.go b/pkg/storage/fs/owncloudsql/filecache/filecache.go index 60266d631dc..a9fac0630d3 100644 --- a/pkg/storage/fs/owncloudsql/filecache/filecache.go +++ b/pkg/storage/fs/owncloudsql/filecache/filecache.go @@ -31,7 +31,7 @@ import ( "time" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/pkg/errors" "github.com/rs/zerolog/log" diff --git a/pkg/storage/fs/owncloudsql/owncloudsql.go b/pkg/storage/fs/owncloudsql/owncloudsql.go index 7da1e11e98a..2e09d1e480f 100644 --- a/pkg/storage/fs/owncloudsql/owncloudsql.go +++ b/pkg/storage/fs/owncloudsql/owncloudsql.go @@ -40,8 +40,8 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" "github.com/cs3org/reva/v2/internal/grpc/services/storageprovider" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/events" diff --git a/pkg/storage/fs/owncloudsql/upload.go b/pkg/storage/fs/owncloudsql/upload.go index 3d19715c6c3..b3763d4f885 100644 --- a/pkg/storage/fs/owncloudsql/upload.go +++ b/pkg/storage/fs/owncloudsql/upload.go @@ -31,8 +31,8 @@ import ( userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/logger" diff --git a/pkg/storage/utils/decomposedfs/node/node_test.go b/pkg/storage/utils/decomposedfs/node/node_test.go index c0fe3488f71..8245438903d 100644 --- a/pkg/storage/utils/decomposedfs/node/node_test.go +++ b/pkg/storage/utils/decomposedfs/node/node_test.go @@ -23,7 +23,7 @@ import ( "time" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - ocsconv "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + ocsconv "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node" helpers "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/testhelpers" diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index e0b28313b96..139e29c6244 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -34,8 +34,8 @@ import ( v1beta11 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - ocsconv "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + ocsconv "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/rgrpc/status" diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 270524f38d4..50f9493f802 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -40,8 +40,8 @@ import ( rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" "github.com/cs3org/reva/v2/pkg/appctx" + "github.com/cs3org/reva/v2/pkg/conversions" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/eosclient" "github.com/cs3org/reva/v2/pkg/eosclient/eosbinary" diff --git a/tests/integration/grpc/ocm_share_test.go b/tests/integration/grpc/ocm_share_test.go index 47590469b62..1a8c39a2ece 100644 --- a/tests/integration/grpc/ocm_share_test.go +++ b/tests/integration/grpc/ocm_share_test.go @@ -34,7 +34,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" storagep "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/cs3org/reva/v2/internal/http/services/datagateway" - "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions" + "github.com/cs3org/reva/v2/pkg/conversions" "github.com/cs3org/reva/v2/pkg/ocm/share" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/rhttp"