Skip to content

Commit

Permalink
bump reva to latest edge (#7727)
Browse files Browse the repository at this point in the history
* bump reva to latest edge

To get cs3org/reva#4336

* graph: Import unified role related code from reva

The UnifiedRole related types are pretty specific to the graph service.
Maintaining them as part of reva makes things more complex that required.

* chore: add failing cases to the expected failures

---------

Co-authored-by: Florian Schade <f.schade@icloud.com>
  • Loading branch information
rhafer and fschade authored Nov 17, 2023
1 parent 6bfbbc3 commit 50f63bf
Show file tree
Hide file tree
Showing 20 changed files with 173 additions and 69 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/bump-reva.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Enhancement: Bump reva
bumps reva version

https://github.com/owncloud/ocis/pull/7721
https://github.com/owncloud/ocis/pull/7727
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.7.0
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781
github.com/cs3org/reva/v2 v2.16.1-0.20231113153113-e258a7c4dfb0
github.com/cs3org/reva/v2 v2.16.1-0.20231115174649-4c665a7f03ac
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/disintegration/imaging v1.6.2
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,8 @@ 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-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY=
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.16.1-0.20231113153113-e258a7c4dfb0 h1:k7WdgewYRI5sWqfnyV3GG+nPCxyAZfh1YEkqZep1Nf8=
github.com/cs3org/reva/v2 v2.16.1-0.20231113153113-e258a7c4dfb0/go.mod h1:utPCNSrWDdAwz2biLrKvzO6nDH9L7vRVGNzof13r8Kw=
github.com/cs3org/reva/v2 v2.16.1-0.20231115174649-4c665a7f03ac h1:0JZeSa52mBW4aC5wFO7+MPTka4ccH3H1HBD9HL5z/+4=
github.com/cs3org/reva/v2 v2.16.1-0.20231115174649-4c665a7f03ac/go.mod h1:utPCNSrWDdAwz2biLrKvzO6nDH9L7vRVGNzof13r8Kw=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
18 changes: 9 additions & 9 deletions services/graph/pkg/service/v0/rolemanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"net/http"
"net/url"

"github.com/cs3org/reva/v2/pkg/conversions"
"github.com/go-chi/chi/v5"
"github.com/go-chi/render"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
"github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole"
)

// GetRoleDefinitions a list of permission roles than can be used when sharing with users or groups
Expand Down Expand Up @@ -39,14 +39,14 @@ func (g Graph) GetRoleDefinition(w http.ResponseWriter, r *http.Request) {

func getRoleDefinitionList(resharing bool) []*libregraph.UnifiedRoleDefinition {
return []*libregraph.UnifiedRoleDefinition{
conversions.NewViewerUnifiedRole(resharing),
conversions.NewSpaceViewerUnifiedRole(),
conversions.NewEditorUnifiedRole(resharing),
conversions.NewSpaceEditorUnifiedRole(),
conversions.NewFileEditorUnifiedRole(),
conversions.NewCoownerUnifiedRole(),
conversions.NewUploaderUnifiedRole(),
conversions.NewManagerUnifiedRole(),
unifiedrole.NewViewerUnifiedRole(resharing),
unifiedrole.NewSpaceViewerUnifiedRole(),
unifiedrole.NewEditorUnifiedRole(resharing),
unifiedrole.NewSpaceEditorUnifiedRole(),
unifiedrole.NewFileEditorUnifiedRole(resharing),
unifiedrole.NewCoownerUnifiedRole(),
unifiedrole.NewUploaderUnifiedRole(),
unifiedrole.NewManagerUnifiedRole(),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package conversions
package unifiedrole

import (
"github.com/cs3org/reva/v2/pkg/conversions"
libregraph "github.com/owncloud/libre-graph-api-go"
"google.golang.org/protobuf/proto"
)
Expand Down Expand Up @@ -33,7 +34,7 @@ const (

// NewViewerUnifiedRole creates a viewer role. `sharing` indicates if sharing permission should be added
func NewViewerUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {
r := NewViewerRole(sharing)
r := conversions.NewViewerRole(sharing)
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleViewerID),
Description: proto.String("Allows reading the shared file or folder"),
Expand All @@ -50,7 +51,7 @@ func NewViewerUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {

// NewSpaceViewerUnifiedRole creates a spaceviewer role
func NewSpaceViewerUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewSpaceViewerRole()
r := conversions.NewSpaceViewerRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleSpaceViewerID),
Description: proto.String("Allows reading the shared space"),
Expand All @@ -67,7 +68,7 @@ func NewSpaceViewerUnifiedRole() *libregraph.UnifiedRoleDefinition {

// NewEditorUnifiedRole creates an editor role. `sharing` indicates if sharing permission should be added
func NewEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {
r := NewEditorRole(sharing)
r := conversions.NewEditorRole(sharing)
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleEditorID),
Description: proto.String("Allows creating, reading, updating and deleting the shared file or folder"),
Expand All @@ -84,7 +85,7 @@ func NewEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {

// NewSpaceEditorUnifiedRole creates an editor role
func NewSpaceEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewSpaceEditorRole()
r := conversions.NewSpaceEditorRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleSpaceEditorID),
Description: proto.String("Allows creating, reading, updating and deleting file or folder in the shared space"),
Expand All @@ -100,8 +101,8 @@ func NewSpaceEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
}

// NewFileEditorUnifiedRole creates a file-editor role
func NewFileEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewFileEditorRole()
func NewFileEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {
r := conversions.NewFileEditorRole(sharing)
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleFileEditorID),
Description: proto.String("Allows reading and updating file"),
Expand All @@ -118,7 +119,7 @@ func NewFileEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {

// NewCoownerUnifiedRole creates a coowner role.
func NewCoownerUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewCoownerRole()
r := conversions.NewCoownerRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleCoownerID),
Description: proto.String("Grants co-owner permissions on a resource"),
Expand All @@ -135,7 +136,7 @@ func NewCoownerUnifiedRole() *libregraph.UnifiedRoleDefinition {

// NewUploaderUnifiedRole creates an uploader role
func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewUploaderRole()
r := conversions.NewUploaderRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleUploaderID),
Description: proto.String("Allows upload file or folder"),
Expand All @@ -152,7 +153,7 @@ func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition {

// NewManagerUnifiedRole creates a manager role
func NewManagerUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := NewManagerRole()
r := conversions.NewManagerRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleManagerID),
Description: proto.String("Grants manager permissions on a resource. Semantically equivalent to co-owner"),
Expand All @@ -167,37 +168,37 @@ func NewManagerUnifiedRole() *libregraph.UnifiedRoleDefinition {
}
}

func displayName(role *Role) *string {
func displayName(role *conversions.Role) *string {
if role == nil {
return nil
}
var displayName string
switch role.Name {
case RoleViewer:
case conversions.RoleViewer:
displayName = "Viewer"
case RoleSpaceViewer:
case conversions.RoleSpaceViewer:
displayName = "Space Viewer"
case RoleEditor:
case conversions.RoleEditor:
displayName = "Editor"
case RoleSpaceEditor:
case conversions.RoleSpaceEditor:
displayName = "Space Editor"
case RoleFileEditor:
case conversions.RoleFileEditor:
displayName = "File Editor"
case RoleCoowner:
case conversions.RoleCoowner:
displayName = "Co Owner"
case RoleUploader:
case conversions.RoleUploader:
displayName = "Uploader"
case RoleManager:
case conversions.RoleManager:
displayName = "Manager"
default:
return nil
}
return proto.String(displayName)
}

func convert(role *Role) []string {
func convert(role *conversions.Role) []string {
actions := make([]string, 0, 8)
if role == nil && role.cS3ResourcePermissions == nil {
if role == nil && role.CS3ResourcePermissions() == nil {
return actions
}
p := role.CS3ResourcePermissions()
Expand Down
5 changes: 5 additions & 0 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ _ocdav: double-check the webdav property parsing when custom namespaces are used
- [coreApiVersions/fileVersionAuthor.feature:297](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature#L297)
- [coreApiVersions/fileVersionAuthor.feature:316](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature#L316)

#### [moving a file into a shared folder as the sharee and as the sharer](https://github.com/owncloud/ocis/issues/1287)

- [coreApiVersions/fileVersions.feature:382](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiVersions/fileVersions.feature#382) Scenario: moving a file (with versions) into a shared folder as the sharee and as the sharer
- [coreApiVersions/fileVersions.feature:383](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiVersions/fileVersions.feature#383) Scenario: moving a file (with versions) into a shared folder as the sharee and as the sharer

### Sync

Synchronization features like etag propagation, setting mtime and locking files
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 50f63bf

Please sign in to comment.