Skip to content

Commit

Permalink
Use ocs permission objects in the reva GRPC client
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Jan 27, 2022
1 parent b3f53a1 commit d3111a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/share-create-perm-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Use ocs permission objects in the reva GRPC client

There was a bug introduced by differing CS3APIs permission definitions
for the same role across services. This is a first step in making
all services use consistent definitions.

https://github.com/cs3org/reva/pull/2478
44 changes: 4 additions & 40 deletions cmd/reva/share-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +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/internal/http/services/owncloud/ocs/conversions"
"github.com/cs3org/reva/pkg/utils"
"github.com/jedib0t/go-pretty/table"
"github.com/pkg/errors"
Expand Down Expand Up @@ -158,48 +159,11 @@ func getGrantType(t string) provider.GranteeType {
func getSharePerm(p string) (*provider.ResourcePermissions, error) {
switch p {
case viewerPermission:
return &provider.ResourcePermissions{
GetPath: true,
ListContainer: true,
Stat: true,
}, nil
case readerPermission:
return &provider.ResourcePermissions{
GetPath: true,
InitiateFileDownload: true,
ListFileVersions: true,
ListContainer: true,
Stat: true,
}, nil
return conversions.NewViewerRole().CS3ResourcePermissions(), nil
case editorPermission:
return &provider.ResourcePermissions{
GetPath: true,
InitiateFileDownload: true,
ListFileVersions: true,
ListContainer: true,
Stat: true,
CreateContainer: true,
Delete: true,
InitiateFileUpload: true,
RestoreFileVersion: true,
Move: true,
}, nil
return conversions.NewEditorRole().CS3ResourcePermissions(), nil
case collabPermission:
return &provider.ResourcePermissions{
GetPath: true,
InitiateFileDownload: true,
ListFileVersions: true,
ListContainer: true,
Stat: true,
CreateContainer: true,
Delete: true,
InitiateFileUpload: true,
RestoreFileVersion: true,
Move: true,
AddGrant: true,
UpdateGrant: true,
RemoveGrant: true,
}, nil
return conversions.NewCoownerRole().CS3ResourcePermissions(), nil
case denyPermission:
return &provider.ResourcePermissions{}, nil
default:
Expand Down

0 comments on commit d3111a4

Please sign in to comment.