Merge pull request #10015 from owncloud/fix-roles-wording

fix: improve some wordings and cli table
This commit is contained in:
Michael Barz
2024-09-13 15:17:38 +02:00
committed by GitHub
5 changed files with 30 additions and 12 deletions
@@ -37,5 +37,6 @@ The output of this command includes the following information for each role:
- Description: A short description of the role.
- Enabled: Whether the role is enabled or not.
https://github.com/owncloud/ocis/pull/10013
https://github.com/owncloud/ocis/pull/9727
https://github.com/owncloud/ocis/issues/9698
+21 -4
View File
@@ -14,6 +14,23 @@ import (
"github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole"
)
var (
unifiedRolesNames = map[string]string{
unifiedrole.UnifiedRoleViewerID: "Viewer",
unifiedrole.UnifiedRoleViewerListGrantsID: "ViewerListGrants",
unifiedrole.UnifiedRoleSpaceViewerID: "SpaceViewer",
unifiedrole.UnifiedRoleEditorID: "Editor",
unifiedrole.UnifiedRoleEditorListGrantsID: "EditorListGrants",
unifiedrole.UnifiedRoleSpaceEditorID: "SpaceEditor",
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsID: "SpaceEditorWithoutVersions",
unifiedrole.UnifiedRoleFileEditorID: "FileEditor",
unifiedrole.UnifiedRoleFileEditorListGrantsID: "FileEditorListGrants",
unifiedrole.UnifiedRoleEditorLiteID: "EditorLite",
unifiedrole.UnifiedRoleManagerID: "SpaceManager",
unifiedrole.UnifiedRoleSecureViewerID: "SecureViewer",
}
)
// UnifiedRoles bundles available commands for unified roles
func UnifiedRoles(cfg *config.Config) cli.Commands {
cmds := cli.Commands{
@@ -41,7 +58,7 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command {
tbl.SetRowLine(true)
tbl.SetAutoMergeCellsByColumnIndex([]int{0}) // rowspan should only affect the first column
headers := []string{"UID", "Enabled", "Description", "Condition", "Allowed resource actions"}
headers := []string{"Name", "UID", "Enabled", "Description", "Condition", "Allowed resource actions"}
tbl.SetHeader(headers)
for _, definition := range unifiedrole.GetRoles(unifiedrole.RoleFilterAll()) {
@@ -49,10 +66,10 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command {
const disabled = "disabled"
rows := [][]string{
{definition.GetId(), disabled, definition.GetDescription()},
{unifiedRolesNames[definition.GetId()], definition.GetId(), disabled, definition.GetDescription()},
}
if slices.Contains(cfg.UnifiedRoles.AvailableRoles, definition.GetId()) {
rows[0][1] = enabled
rows[0][2] = enabled
}
for i, rolePermission := range definition.GetRolePermissions() {
@@ -62,7 +79,7 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command {
case 0:
rows[0] = append(rows[0], row...)
default:
rows = append(rows, append(slices.Clone(rows[0][:len(rows[0])-len(row)]), row...))
rows[0][4] = rows[0][4] + "\n" + rolePermission.GetCondition()
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ var (
_editorListGrantsUnifiedRoleDisplayName = l10n.Template("Can edit")
// UnifiedRole SpaseEditor, Role Description (resolves directly)
_spaceEditorUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add and delete.")
_spaceEditorUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add, delete including the history.")
// UnifiedRole SpaseEditor, Role DisplayName (resolves directly)
_spaceEditorUnifiedRoleDisplayName = l10n.Template("Can edit")
@@ -296,7 +296,7 @@ Feature: permissions role definitions
"const": 0
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -283,7 +283,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -416,7 +416,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -1104,7 +1104,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -1226,7 +1226,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -1508,7 +1508,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"
@@ -1846,7 +1846,7 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download, upload, edit, add and delete."
"const": "View, download, upload, edit, add, delete including the history."
},
"displayName": {
"const": "Can edit"