Merge pull request #8743 from owncloud/adjust-sharing-ng-role-names

refactor: adjust sharing ng role names and descriptions
This commit is contained in:
Jannik Stehle
2024-03-27 18:09:42 +01:00
committed by GitHub
3 changed files with 58 additions and 53 deletions

View File

@@ -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

View File

@@ -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{
{
@@ -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
@@ -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
}

View File

@@ -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"