Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bingo/go-xgettext.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
go 1.23.4

require github.com/gosexy/gettext v0.0.0-20160830220431-74466a0a0c4a // go-xgettext

require github.com/jessevdk/go-flags v1.6.1 // indirect
6 changes: 6 additions & 0 deletions .woodpecker.star
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ config = {
],
"skip": False,
},
"sharingNgAdditionalShareRole": {
"suites": [
"apiSharingNgAdditionalShareRole",
],
"skip": False,
},
"notification": {
"suites": [
"apiNotification",
Expand Down
4 changes: 4 additions & 0 deletions services/graph/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ var (
unifiedrole.UnifiedRoleSecureViewerID,
unifiedrole.UnifiedRoleSpaceViewerWithVersionsID,
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsID,
unifiedrole.UnifiedRoleSpaceEditorWithoutTrashbinID,
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID,
unifiedrole.UnifiedRoleViewerListGrantsID,
unifiedrole.UnifiedRoleEditorListGrantsID,
unifiedrole.UnifiedRoleEditorListGrantsWithVersionsID,
unifiedrole.UnifiedRoleFileEditorListGrantsID,
unifiedrole.UnifiedRoleFileEditorListGrantsWithVersionsID,
unifiedrole.UnifiedRoleViewerWithVersionsID,
unifiedrole.UnifiedRoleEditorWithVersionsID,
unifiedrole.UnifiedRoleFileEditorWithVersionsID,
Expand Down
25 changes: 25 additions & 0 deletions services/graph/pkg/l10n/locale/de/LC_MESSAGES/graph.po
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,28 @@ msgid "View, download, upload, edit, add, delete including the history."
msgstr ""
"Ansehen, herunterladen, hochladen, bearbeiten, hinzufügen, löschen - "
"inklusive des Verlaufs."

#. UnifiedRole SpaceEditorWithoutTrashbin, Role DisplayName (resolves
#. directly)
#: pkg/unifiedrole/roles.go:183
msgid "Can edit with versions"
msgstr "Kann bearbeiten mit Historie"

#. UnifiedRole EditorListGrantsWithVersions, Role Description (resolves
#. directly)
#: pkg/unifiedrole/roles.go:162
msgid ""
"View, download, upload, edit, delete, show all versions and all invited "
"people."
msgstr ""
"Ansehen, herunterladen, hochladen, bearbeiten, löschen und anzeigen aller "
"Versionen und eingeladenen Personen."

#. UnifiedRole FileEditorListGrantsWithVersions, Role Description (resolves
#. directly)
#: pkg/unifiedrole/roles.go:201
msgid ""
"View, download, upload, edit, show all versions and all invited people."
msgstr ""
"Ansehen, herunterladen, hochladen, bearbeiten und anzeigen aller Versionen "
"und eingeladenen Personen."
8 changes: 8 additions & 0 deletions services/graph/pkg/unifiedrole/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,24 @@ func cs3RoleToDisplayName(role *conversions.Role) string {
return _editorWithVersionsUnifiedRoleDisplayName
case conversions.RoleEditorListGrants:
return _editorListGrantsUnifiedRoleDisplayName
case conversions.RoleEditorListGrantsWithVersions:
return _editorListGrantsWithVersionsUnifiedRoleDisplayName
case conversions.RoleSpaceEditor:
return _spaceEditorUnifiedRoleDisplayName
case conversions.RoleSpaceEditorWithoutVersions:
return _spaceEditorWithoutVersionsUnifiedRoleDisplayName
case conversions.RoleSpaceEditorWithoutTrashbin:
return _spaceEditorWithoutTrashbinUnifiedRoleDisplayName
case conversions.RoleSpaceEditorWithoutVersionsWithoutTrashbin:
return _spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDisplayName
case conversions.RoleFileEditor:
return _fileEditorUnifiedRoleDisplayName
case conversions.RoleFileEditorWithVersions:
return _fileEditorWithVersionsUnifiedRoleDisplayName
case conversions.RoleFileEditorListGrants:
return _fileEditorListGrantsUnifiedRoleDisplayName
case conversions.RoleFileEditorListGrantsWithVersions:
return _fileEditorListGrantsWithVersionsUnifiedRoleDisplayName
case conversions.RoleEditorLite:
return _editorLiteUnifiedRoleDisplayName
case conversions.RoleManager:
Expand Down
38 changes: 21 additions & 17 deletions services/graph/pkg/unifiedrole/export_test.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package unifiedrole

var (
RoleViewer = roleViewer
RoleViewerWithVersions = roleViewerWithVersions
RoleViewerListGrants = roleViewerListGrants
RoleSpaceViewer = roleSpaceViewer
RoleSpaceViewerWithVersions = roleSpaceViewerWithVersions
RoleEditor = roleEditor
RoleEditorWithVersions = roleEditorWithVersions
RoleEditorListGrants = roleEditorListGrants
RoleSpaceEditor = roleSpaceEditor
RoleSpaceEditorWithVersions = roleSpaceEditorWithVersions
RoleFileEditor = roleFileEditor
RoleFileEditorWithVersions = roleFileEditorWithVersions
RoleFileEditorListGrants = roleFileEditorListGrants
RoleEditorLite = roleEditorLite
RoleManager = roleManager
RoleSecureViewer = roleSecureViewer
RoleDenied = roleDenied
RoleViewer = roleViewer
RoleViewerWithVersions = roleViewerWithVersions
RoleViewerListGrants = roleViewerListGrants
RoleSpaceViewer = roleSpaceViewer
RoleSpaceViewerWithVersions = roleSpaceViewerWithVersions
RoleEditor = roleEditor
RoleEditorWithVersions = roleEditorWithVersions
RoleEditorListGrants = roleEditorListGrants
RoleEditorListGrantsWithVersions = roleEditorListGrantsWithVersions
RoleSpaceEditor = roleSpaceEditor
RoleSpaceEditorWithVersions = roleSpaceEditorWithVersions
RoleSpaceEditorWithoutTrashbin = roleSpaceEditorWithoutTrashbin
RoleSpaceEditorWithoutVersionsWithoutTrashbin = roleSpaceEditorWithoutVersionsWithoutTrashbin
RoleFileEditor = roleFileEditor
RoleFileEditorWithVersions = roleFileEditorWithVersions
RoleFileEditorListGrants = roleFileEditorListGrants
RoleFileEditorListGrantsWithVersions = roleFileEditorListGrantsWithVersions
RoleEditorLite = roleEditorLite
RoleManager = roleManager
RoleSecureViewer = roleSecureViewer
RoleDenied = roleDenied

BuildInRoles = buildInRoles

Expand Down
115 changes: 115 additions & 0 deletions services/graph/pkg/unifiedrole/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,25 @@ const (
UnifiedRoleEditorWithVersionsID = "b8c6e1c9-5d2a-4f0e-9c3b-1a2b3c4d5e6f"
// UnifiedRoleEditorListGrantsID Unified role editor id.
UnifiedRoleEditorListGrantsID = "e8ea8b21-abd4-45d2-b893-8d1546378e9e"
// UnifiedRoleEditorListGrantsWithVersionsID Unified role editor with list grants and versions id.
UnifiedRoleEditorListGrantsWithVersionsID = "0911d62b-1e3f-4778-8b1b-903b7e4e8476"
// UnifiedRoleSpaceEditorID Unified role space editor id.
UnifiedRoleSpaceEditorID = "58c63c02-1d89-4572-916a-870abc5a1b7d"
// UnifiedRoleSpaceEditorWithoutVersionsID Unified role space editor without list/restore versions id.
UnifiedRoleSpaceEditorWithoutVersionsID = "3284f2d5-0070-4ad8-ac40-c247f7c1fb27"
// UnifiedRoleSpaceEditorWithoutTrashbinID Unified role space editor without list/restore resources in trashbin id.
UnifiedRoleSpaceEditorWithoutTrashbinID = "8f4701d9-c68f-4109-a482-88e22ee32805"
// UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID Unified role space editor without list/restore
// versions and without list/restore resources in trashbin id.
UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID = "a5f73816-4d4b-452d-8973-3b61c3d0bed4"
// UnifiedRoleFileEditorID Unified role file editor id.
UnifiedRoleFileEditorID = "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
// UnifiedRoleFileEditorWithVersionsID Unified role file editor id.
UnifiedRoleFileEditorWithVersionsID = "3d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
// UnifiedRoleFileEditorListGrantsID Unified role file editor id.
UnifiedRoleFileEditorListGrantsID = "c1235aea-d106-42db-8458-7d5610fb0a67"
// UnifiedRoleFileEditorListGrantsWithVersionsID Unified role file editor with list grants and versions id.
UnifiedRoleFileEditorListGrantsWithVersionsID = "b173329d-cf2e-42f0-a595-ee410645d840"
// UnifiedRoleEditorLiteID Unified role editor-lite id.
UnifiedRoleEditorLiteID = "1c996275-f1c9-4e71-abdf-a42f6495e960"
// UnifiedRoleManagerID Unified role manager id.
Expand Down Expand Up @@ -149,6 +158,12 @@ var (
// UnifiedRole EditorListGrants, Role DisplayName (resolves directly)
_editorListGrantsUnifiedRoleDisplayName = l10n.Template("Can edit")

// UnifiedRole EditorListGrantsWithVersions, Role Description (resolves directly)
_editorListGrantsWithVersionsUnifiedRoleDescription = l10n.Template("View, download, upload, edit, delete, show all versions and all invited people.")

// UnifiedRole EditorListGrantsWithVersions, Role DisplayName (resolves directly)
_editorListGrantsWithVersionsUnifiedRoleDisplayName = l10n.Template("Can edit")

// UnifiedRole SpaseEditor, Role Description (resolves directly)
_spaceEditorUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add, delete including the history.")

Expand All @@ -161,6 +176,18 @@ var (
// UnifiedRole SpaseEditorWithoutVersions, Role DisplayName (resolves directly)
_spaceEditorWithoutVersionsUnifiedRoleDisplayName = l10n.Template("Can edit without versions")

// UnifiedRole SpaceEditorWithoutTrashbin, Role Description (resolves directly)
_spaceEditorWithoutTrashbinUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add, delete including the history.")

// UnifiedRole SpaceEditorWithoutTrashbin, Role DisplayName (resolves directly)
_spaceEditorWithoutTrashbinUnifiedRoleDisplayName = l10n.Template("Can edit with versions")

// UnifiedRole SpaceEditorWithoutVersionsWithoutTrashbin, Role Description (resolves directly)
_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add and delete.")

// UnifiedRole SpaceEditorWithoutVersionsWithoutTrashbin, Role DisplayName (resolves directly)
_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDisplayName = l10n.Template("Can edit")

// UnifiedRole FileEditor, Role Description (resolves directly)
_fileEditorUnifiedRoleDescription = l10n.Template("View, download and edit.")

Expand All @@ -170,6 +197,12 @@ var (
// UnifiedRole FileEditorListGrants, Role Description (resolves directly)
_fileEditorListGrantsUnifiedRoleDescription = l10n.Template("View, download, edit and show all invited people.")

// UnifiedRole FileEditorListGrantsWithVersions, Role Description (resolves directly)
_fileEditorListGrantsWithVersionsUnifiedRoleDescription = l10n.Template("View, download, upload, edit, show all versions and all invited people.")

// UnifiedRole FileEditorListGrantsWithVersions, Role DisplayName (resolves directly)
_fileEditorListGrantsWithVersionsUnifiedRoleDisplayName = l10n.Template("Can edit")

// UnifiedRole FileEditorWithVersions, Role DisplayName (resolves directly)
_fileEditorWithVersionsUnifiedRoleDisplayName = l10n.Template("Can edit")

Expand Down Expand Up @@ -227,12 +260,16 @@ var (
roleSpaceViewerWithVersions,
roleEditor,
roleEditorListGrants,
roleEditorListGrantsWithVersions,
roleEditorWithVersions,
roleSpaceEditorWithVersions,
roleSpaceEditor,
roleSpaceEditorWithoutTrashbin,
roleSpaceEditorWithoutVersionsWithoutTrashbin,
roleFileEditor,
roleFileEditorWithVersions,
roleFileEditorListGrants,
roleFileEditorListGrantsWithVersions,
roleEditorLite,
roleManager,
roleSecureViewer,
Expand Down Expand Up @@ -432,6 +469,27 @@ var (
}
}()

// roleEditorListGrantsWithVersions creates an editor role that can also list versions.
roleEditorListGrantsWithVersions = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewEditorListGrantsWithVersionsRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleEditorListGrantsWithVersionsID),
Description: proto.String(_editorListGrantsWithVersionsUnifiedRoleDescription),
DisplayName: proto.String(cs3RoleToDisplayName(r)),
RolePermissions: []libregraph.UnifiedRolePermission{
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionFolder),
},
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionFolderFederatedUser),
},
},
LibreGraphWeight: proto.Int32(72),
}
}()

roleEditorWithVersions = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewEditorWithVersionsRole()
return &libregraph.UnifiedRoleDefinition{
Expand All @@ -448,6 +506,42 @@ var (
}
}()

// roleSpaceEditorWithoutVersionsWithoutTrashbin creates a space editor role without
// list/restore versions and without list/restore resources in the trashbin.
roleSpaceEditorWithoutVersionsWithoutTrashbin = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewSpaceEditorWithoutVersionsWithoutTrashbinRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID),
Description: proto.String(_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDescription),
DisplayName: proto.String(cs3RoleToDisplayName(r)),
RolePermissions: []libregraph.UnifiedRolePermission{
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionDrive),
},
},
LibreGraphWeight: proto.Int32(78),
}
}()

// roleSpaceEditorWithoutTrashbin creates a space editor role without list/restore
// resources in the trashbin.
roleSpaceEditorWithoutTrashbin = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewSpaceEditorWithoutTrashbinRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleSpaceEditorWithoutTrashbinID),
Description: proto.String(_spaceEditorWithoutTrashbinUnifiedRoleDescription),
DisplayName: proto.String(cs3RoleToDisplayName(r)),
RolePermissions: []libregraph.UnifiedRolePermission{
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionDrive),
},
},
LibreGraphWeight: proto.Int32(88),
}
}()

// roleSpaceEditor creates an editor without versions role
roleSpaceEditor = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewSpaceEditorWithoutVersionsRole()
Expand Down Expand Up @@ -541,6 +635,27 @@ var (
}
}()

// roleFileEditorListGrantsWithVersions creates a file-editor role that can also list versions.
roleFileEditorListGrantsWithVersions = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewFileEditorListGrantsWithVersionsRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleFileEditorListGrantsWithVersionsID),
Description: proto.String(_fileEditorListGrantsWithVersionsUnifiedRoleDescription),
DisplayName: proto.String(cs3RoleToDisplayName(r)),
RolePermissions: []libregraph.UnifiedRolePermission{
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionFile),
},
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionFileFederatedUser),
},
},
LibreGraphWeight: proto.Int32(111),
}
}()

// roleManager creates a manager role
roleManager = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewManagerRole()
Expand Down
4 changes: 4 additions & 0 deletions services/graph/pkg/unifiedrole/roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func TestGetRolesByPermissions(t *testing.T) {
unifiedrole.RoleFileEditor,
unifiedrole.RoleFileEditorWithVersions,
unifiedrole.RoleFileEditorListGrants,
unifiedrole.RoleFileEditorListGrantsWithVersions,
},
},
"BuildInRoles | folder": {
Expand All @@ -199,6 +200,7 @@ func TestGetRolesByPermissions(t *testing.T) {
unifiedrole.RoleEditor,
unifiedrole.RoleEditorListGrants,
unifiedrole.RoleEditorWithVersions,
unifiedrole.RoleEditorListGrantsWithVersions,
unifiedrole.RoleDenied,
},
},
Expand All @@ -208,7 +210,9 @@ func TestGetRolesByPermissions(t *testing.T) {
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{
unifiedrole.RoleSpaceViewer,
unifiedrole.RoleSpaceViewerWithVersions,
unifiedrole.RoleSpaceEditorWithoutVersionsWithoutTrashbin,
unifiedrole.RoleSpaceEditor,
unifiedrole.RoleSpaceEditorWithoutTrashbin,
unifiedrole.RoleSpaceEditorWithVersions,
unifiedrole.RoleManager,
},
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class GraphHelper {
'File Editor With Versions' => '3d00ce52-1fc2-4dbc-8b95-a73b73395f5a',
'File Editor List Grants' => 'c1235aea-d106-42db-8458-7d5610fb0a67',
'Denied' => '63e64e19-8d43-42ec-a738-2b6af2610efa',
'Editor List Grants With Versions' => '0911d62b-1e3f-4778-8b1b-903b7e4e8476',
'Space Editor Without Trashbin' => '8f4701d9-c68f-4109-a482-88e22ee32805',
'Space Editor Without Versions Without Trashbin' => 'a5f73816-4d4b-452d-8973-3b61c3d0bed4',
'File Editor List Grants With Versions' => 'b173329d-cf2e-42f0-a595-ee410645d840',
];

public const SHARES_SPACE_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668';
Expand Down
Loading
Loading