From 2968570a84cb3407fea5f06832c1dfa230561512 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 27 Mar 2024 09:58:10 +0100 Subject: [PATCH 1/3] refactor: adjust sharing ng role names and descriptions Adjusts display names and descriptions of sharing NG roles to align with the previously agreed upon terms. --- ...-sharing-ng-role-names-and-descriptions.md | 5 ++++ services/graph/pkg/unifiedrole/unifiedrole.go | 28 +++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 changelog/unreleased/enhancement-sharing-ng-role-names-and-descriptions.md diff --git a/changelog/unreleased/enhancement-sharing-ng-role-names-and-descriptions.md b/changelog/unreleased/enhancement-sharing-ng-role-names-and-descriptions.md new file mode 100644 index 0000000000..97cb95ace8 --- /dev/null +++ b/changelog/unreleased/enhancement-sharing-ng-role-names-and-descriptions.md @@ -0,0 +1,5 @@ +Enhancement: Sharing NG role names and descriptions + +We've adjusted the display names and descriptions of the sharing NG roles to align with the previously agreed upon terms. + +https://github.com/owncloud/ocis/pull/8743 diff --git a/services/graph/pkg/unifiedrole/unifiedrole.go b/services/graph/pkg/unifiedrole/unifiedrole.go index 2926299ea8..000abd8d74 100644 --- a/services/graph/pkg/unifiedrole/unifiedrole.go +++ b/services/graph/pkg/unifiedrole/unifiedrole.go @@ -73,7 +73,7 @@ func NewViewerUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition { r := conversions.NewViewerRole(sharing) return &libregraph.UnifiedRoleDefinition{ Id: proto.String(UnifiedRoleViewerID), - Description: proto.String("Allows reading the shared file or folder"), + Description: proto.String("View and download."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -90,7 +90,7 @@ func NewSpaceViewerUnifiedRole() *libregraph.UnifiedRoleDefinition { r := conversions.NewSpaceViewerRole() return &libregraph.UnifiedRoleDefinition{ Id: proto.String(UnifiedRoleSpaceViewerID), - Description: proto.String("Allows reading the shared space"), + Description: proto.String("View and download."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -107,7 +107,7 @@ func NewEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition { 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"), + Description: proto.String("View, download, upload, edit, add and delete."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -124,7 +124,7 @@ func NewSpaceEditorUnifiedRole() *libregraph.UnifiedRoleDefinition { 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"), + Description: proto.String("View, download, upload, edit, add and delete."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -141,7 +141,7 @@ 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"), + Description: proto.String("View, download and edit."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -158,7 +158,7 @@ func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition { r := conversions.NewUploaderRole() return &libregraph.UnifiedRoleDefinition{ Id: proto.String(UnifiedRoleUploaderID), - Description: proto.String("Allows upload file or folder"), + Description: proto.String("View, download and upload."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -175,7 +175,7 @@ func NewManagerUnifiedRole() *libregraph.UnifiedRoleDefinition { r := conversions.NewManagerRole() return &libregraph.UnifiedRoleDefinition{ Id: proto.String(UnifiedRoleManagerID), - Description: proto.String("Grants manager permissions on a resource. Semantically equivalent to co-owner"), + Description: proto.String("View, download, upload, edit, add, delete and manage members."), DisplayName: displayName(r), RolePermissions: []libregraph.UnifiedRolePermission{ { @@ -451,19 +451,19 @@ func displayName(role *conversions.Role) *string { var displayName string switch role.Name { case conversions.RoleViewer: - displayName = "Viewer" + displayName = "Can view" case conversions.RoleSpaceViewer: - displayName = "Space Viewer" + displayName = "Can view" case conversions.RoleEditor: - displayName = "Editor" + displayName = "Can edit" case conversions.RoleSpaceEditor: - displayName = "Space Editor" + displayName = "Can edit" case conversions.RoleFileEditor: - displayName = "File Editor" + displayName = "Can edit" case conversions.RoleUploader: - displayName = "Uploader" + displayName = "Can upload" case conversions.RoleManager: - displayName = "Manager" + displayName = "Can manage" default: return nil } From 66b29dcf5bd8d96aa24bef5d94f20c40252e7d65 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 27 Mar 2024 10:25:25 +0100 Subject: [PATCH 2/3] test: fix acceptance tests after adjusting share roles --- .../apiSharingNg/listPermissions.feature | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/listPermissions.feature b/tests/acceptance/features/apiSharingNg/listPermissions.feature index f573dcdf17..a3877df6fe 100644 --- a/tests/acceptance/features/apiSharingNg/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg/listPermissions.feature @@ -71,13 +71,13 @@ Feature: List a sharing permissions "description": { "type": "string", "enum": [ - "Allows upload file or folder" + "View, download and upload." ] }, "displayName": { "type": "string", "enum": [ - "Uploader" + "Can upload" ] }, "id": { @@ -106,13 +106,13 @@ Feature: List a sharing permissions "description": { "type": "string", "enum": [ - "Allows reading the shared file or folder" + "View and download." ] }, "displayName": { "type": "string", "enum": [ - "Viewer" + "Can view" ] }, "id": { @@ -141,13 +141,13 @@ Feature: List a sharing permissions "description": { "type": "string", "enum": [ - "Allows reading and updating file" + "View, download and edit." ] }, "displayName": { "type": "string", "enum": [ - "Editor" + "Can edit" ] }, "id": { @@ -176,13 +176,13 @@ Feature: List a sharing permissions "description": { "type": "string", "enum": [ - "Allows creating, reading, updating and deleting the shared file or folder" + "View, download, upload, edit, add and delete." ] }, "displayName": { "type": "string", "enum": [ - "Editor" + "Can edit" ] }, "id": { @@ -260,10 +260,10 @@ Feature: List a sharing permissions "const": 1 }, "description": { - "const": "Allows reading the shared space" + "const": "View and download." }, "displayName": { - "const": "Space Viewer" + "const": "Can view" }, "id": { "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" @@ -283,10 +283,10 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "Allows creating, reading, updating and deleting file or folder in the shared space" + "const": "View, download, upload, edit, add and delete." }, "displayName": { - "const": "Space Editor" + "const": "Can edit" }, "id": { "const": "58c63c02-1d89-4572-916a-870abc5a1b7d" @@ -306,10 +306,10 @@ Feature: List a sharing permissions "const": 3 }, "description": { - "const": "Grants manager permissions on a resource. Semantically equivalent to co-owner" + "const": "View, download, upload, edit, add, delete and manage members." }, "displayName": { - "const": "Manager" + "const": "Can manage" }, "id": { "const": "312c0871-5ef7-4b3a-85b6-0e4074c64049" @@ -394,10 +394,10 @@ Feature: List a sharing permissions "const": 1 }, "description": { - "const": "Allows reading the shared space" + "const": "View and download." }, "displayName": { - "const": "Space Viewer" + "const": "Can view" }, "id": { "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" @@ -417,10 +417,10 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "Allows creating, reading, updating and deleting file or folder in the shared space" + "const": "View, download, upload, edit, add and delete." }, "displayName": { - "const": "Space Editor" + "const": "Can edit" }, "id": { "const": "58c63c02-1d89-4572-916a-870abc5a1b7d" @@ -440,10 +440,10 @@ Feature: List a sharing permissions "const": 3 }, "description": { - "const": "Grants manager permissions on a resource. Semantically equivalent to co-owner" + "const": "View, download, upload, edit, add, delete and manage members." }, "displayName": { - "const": "Manager" + "const": "Can manage" }, "id": { "const": "312c0871-5ef7-4b3a-85b6-0e4074c64049" From 25b40cf7a3e33f78b6c7ca826450a2c44923fbe5 Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Wed, 27 Mar 2024 16:02:44 +0100 Subject: [PATCH 3/3] fix: make use of ResourcePermissions getters --- services/graph/pkg/unifiedrole/unifiedrole.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/services/graph/pkg/unifiedrole/unifiedrole.go b/services/graph/pkg/unifiedrole/unifiedrole.go index 000abd8d74..7438d67701 100644 --- a/services/graph/pkg/unifiedrole/unifiedrole.go +++ b/services/graph/pkg/unifiedrole/unifiedrole.go @@ -336,61 +336,61 @@ func PermissionsToCS3ResourcePermissions(unifiedRolePermissions []*libregraph.Un // CS3ResourcePermissionsToLibregraphActions converts the provided cs3 ResourcePermissions to a list of // libregraph actions func CS3ResourcePermissionsToLibregraphActions(p provider.ResourcePermissions) (actions []string) { - if p.AddGrant { + if p.GetAddGrant() { actions = append(actions, DriveItemPermissionsCreate) } - if p.CreateContainer { + if p.GetCreateContainer() { actions = append(actions, DriveItemChildrenCreate) } - if p.Delete { + if p.GetDelete() { actions = append(actions, DriveItemStandardDelete) } - if p.GetPath { + if p.GetGetPath() { actions = append(actions, DriveItemPathRead) } - if p.GetQuota { + if p.GetGetQuota() { actions = append(actions, DriveItemQuotaRead) } - if p.InitiateFileDownload { + if p.GetInitiateFileDownload() { actions = append(actions, DriveItemContentRead) } - if p.InitiateFileUpload { + if p.GetInitiateFileUpload() { actions = append(actions, DriveItemUploadCreate) } - if p.ListGrants { + if p.GetListGrants() { actions = append(actions, DriveItemPermissionsRead) } - if p.ListContainer { + if p.GetListContainer() { actions = append(actions, DriveItemChildrenRead) } - if p.ListFileVersions { + if p.GetListFileVersions() { actions = append(actions, DriveItemVersionsRead) } - if p.ListRecycle { + if p.GetListRecycle() { actions = append(actions, DriveItemDeletedRead) } - if p.Move { + if p.GetMove() { actions = append(actions, DriveItemPathUpdate) } - if p.RemoveGrant { + if p.GetRemoveGrant() { actions = append(actions, DriveItemPermissionsDelete) } - if p.PurgeRecycle { + if p.GetPurgeRecycle() { actions = append(actions, DriveItemDeletedDelete) } - if p.RestoreFileVersion { + if p.GetRestoreFileVersion() { actions = append(actions, DriveItemVersionsUpdate) } - if p.RestoreRecycleItem { + if p.GetRestoreRecycleItem() { actions = append(actions, DriveItemDeletedUpdate) } - if p.Stat { + if p.GetStat() { actions = append(actions, DriveItemBasicRead) } - if p.UpdateGrant { + if p.GetUpdateGrant() { actions = append(actions, DriveItemPermissionsUpdate) } - if p.DenyGrant { + if p.GetDenyGrant() { actions = append(actions, DriveItemPermissionsDeny) } return actions