Skip to content

Commit 82393f7

Browse files
committed
feat(graph): [OCISDEV-807] add SpaceEditorWithoutVersionsWithoutTrashbin role
Adds a new space membership role "Can edit" that allows creating, uploading, downloading, editing, moving and deleting on a space without access to file versions or the trashbin. Also bumps reva to include the corresponding role constructor. Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
1 parent 3b36d53 commit 82393f7

10 files changed

Lines changed: 73 additions & 48 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Enhancement: Add SpaceEditorWithoutVersionsWithoutTrashbin space membership role
2+
3+
Added a new space membership role "Can edit" (SpaceEditorWithoutVersionsWithoutTrashbin)
4+
that grants full editor permissions (create, upload, download, edit, move, delete) on a
5+
space without access to file versions or the trashbin.
6+
7+
https://github.com/owncloud/ocis/pull/12245

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ require (
6464
github.com/open-policy-agent/opa v1.12.3
6565
github.com/orcaman/concurrent-map v1.0.0
6666
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
67-
github.com/owncloud/reva/v2 v2.0.0-20260305165853-c9204c730c66
67+
github.com/owncloud/reva/v2 v2.0.0-20260422094911-a697030257f5
6868
github.com/pkg/errors v0.9.1
6969
github.com/pkg/xattr v0.4.12
7070
github.com/prometheus/client_golang v1.23.2

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64 h1:z
744744
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
745745
github.com/owncloud/reva/v2 v2.0.0-20260305165853-c9204c730c66 h1:Krzzphe3EkE09Enxy6s5eIFPNF6Kodw/H8EcHo+jT+E=
746746
github.com/owncloud/reva/v2 v2.0.0-20260305165853-c9204c730c66/go.mod h1:eHbT6pmVlcjdiBeVEYw7exlfJmemMzKBh4R+HFgx9Cc=
747+
github.com/owncloud/reva/v2 v2.0.0-20260422074541-76ccb5a8a681 h1:OQggVr2fg23feOlcm/qgAUAgZjNDkYnJT7CKNwKyet8=
748+
github.com/owncloud/reva/v2 v2.0.0-20260422074541-76ccb5a8a681/go.mod h1:eHbT6pmVlcjdiBeVEYw7exlfJmemMzKBh4R+HFgx9Cc=
749+
github.com/owncloud/reva/v2 v2.0.0-20260422094911-a697030257f5 h1:G0klmj4V7z7U1nYm0GzgEN+G4C/g5yajnG5FQdsF6ec=
750+
github.com/owncloud/reva/v2 v2.0.0-20260422094911-a697030257f5/go.mod h1:eHbT6pmVlcjdiBeVEYw7exlfJmemMzKBh4R+HFgx9Cc=
747751
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
748752
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
749753
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=

services/graph/pkg/config/defaults/defaultconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var (
1919
unifiedrole.UnifiedRoleSecureViewerID,
2020
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsID,
2121
unifiedrole.UnifiedRoleSpaceEditorWithoutTrashbinID,
22+
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID,
2223
unifiedrole.UnifiedRoleViewerListGrantsID,
2324
unifiedrole.UnifiedRoleEditorListGrantsID,
2425
unifiedrole.UnifiedRoleEditorListGrantsWithVersionsID,

services/graph/pkg/unifiedrole/export_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ var (
88
RoleEditorListGrants = roleEditorListGrants
99
RoleEditorListGrantsWithVersions = roleEditorListGrantsWithVersions
1010
RoleSpaceEditor = roleSpaceEditor
11-
RoleSpaceEditorWithoutVersions = roleSpaceEditorWithoutVersions
12-
RoleSpaceEditorWithoutTrashbin = roleSpaceEditorWithoutTrashbin
11+
RoleSpaceEditorWithoutVersions = roleSpaceEditorWithoutVersions
12+
RoleSpaceEditorWithoutVersionsWithoutTrashbin = roleSpaceEditorWithoutVersionsWithoutTrashbin
13+
RoleSpaceEditorWithoutTrashbin = roleSpaceEditorWithoutTrashbin
1314
RoleFileEditor = roleFileEditor
1415
RoleFileEditorListGrants = roleFileEditorListGrants
1516
RoleFileEditorListGrantsWithVersions = roleFileEditorListGrantsWithVersions

services/graph/pkg/unifiedrole/filter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func buildInRoles() []*libregraph.UnifiedRoleDefinition {
5353
roleEditorListGrantsWithVersions(),
5454
roleSpaceEditor(),
5555
roleSpaceEditorWithoutVersions(),
56+
roleSpaceEditorWithoutVersionsWithoutTrashbin(),
5657
roleSpaceEditorWithoutTrashbin(),
5758
roleFileEditor(),
5859
roleFileEditorListGrants(),

services/graph/pkg/unifiedrole/roles.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const (
3232
UnifiedRoleSpaceEditorWithoutVersionsID = "3284f2d5-0070-4ad8-ac40-c247f7c1fb27"
3333
// UnifiedRoleSpaceEditorWithoutTrashbinID Unified role space editor without list/restore resources in trashbin id.
3434
UnifiedRoleSpaceEditorWithoutTrashbinID = "8f4701d9-c68f-4109-a482-88e22ee32805"
35+
// UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID Unified role space editor without list/restore versions and without list/restore resources in trashbin id.
36+
UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID = "a5f73816-4d4b-452d-8973-3b61c3d0bed4"
3537
// UnifiedRoleFileEditorID Unified role file editor id.
3638
UnifiedRoleFileEditorID = "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
3739
// UnifiedRoleFileEditorListGrantsID Unified role file editor id.
@@ -217,6 +219,14 @@ var (
217219
// UnifiedRole SpaceEditorWithoutTrashbin, Permissions
218220
_spaceEditorWithoutTrashbinRole = conversions.NewSpaceEditorWithoutTrashbinRole()
219221

222+
// Editor without Versions without Trashbin
223+
// UnifiedRole SpaceEditorWithoutVersionsWithoutTrashbin, Role DisplayName (resolves directly)
224+
_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDisplayName = l10n.Template("Can edit")
225+
// UnifiedRole SpaceEditorWithoutVersionsWithoutTrashbin, Role Description (resolves directly)
226+
_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDescription = l10n.Template("View, download, upload, edit, add and delete.")
227+
// UnifiedRole SpaceEditorWithoutVersionsWithoutTrashbin, Permissions
228+
_spaceEditorWithoutVersionsWithoutTrashbinRole = conversions.NewSpaceEditorWithoutVersionsWithoutTrashbinRole()
229+
220230
// Editor
221231
// UnifiedRole SpaceEditor, Role DisplayName (resolves directly)
222232
_spaceEditorUnifiedRoleDisplayName = l10n.Template("Can edit with versions and trashbin")
@@ -243,7 +253,8 @@ var (
243253
UnifiedRoleEditorListGrantsWithVersionsID: "EditorListGrantsWithVersions",
244254
UnifiedRoleSpaceEditorID: "SpaceEditor",
245255
UnifiedRoleSpaceEditorWithoutVersionsID: "SpaceEditorWithoutVersions",
246-
UnifiedRoleSpaceEditorWithoutTrashbinID: "SpaceEditorWithoutTrashbin",
256+
UnifiedRoleSpaceEditorWithoutTrashbinID: "SpaceEditorWithoutTrashbin",
257+
UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID: "SpaceEditorWithoutVersionsWithoutTrashbin",
247258
UnifiedRoleFileEditorID: "FileEditor",
248259
UnifiedRoleFileEditorListGrantsID: "FileEditorListGrants",
249260
UnifiedRoleFileEditorListGrantsWithVersionsID: "FileEditorListGrantsWithVersions",
@@ -511,6 +522,22 @@ var (
511522
}
512523
}
513524

525+
// roleSpaceEditorWithoutVersionsWithoutTrashbin creates an editor without versions and without trashbin role
526+
roleSpaceEditorWithoutVersionsWithoutTrashbin = func() *libregraph.UnifiedRoleDefinition {
527+
return &libregraph.UnifiedRoleDefinition{
528+
Id: proto.String(UnifiedRoleSpaceEditorWithoutVersionsWithoutTrashbinID),
529+
DisplayName: proto.String(_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDisplayName),
530+
Description: proto.String(_spaceEditorWithoutVersionsWithoutTrashbinUnifiedRoleDescription),
531+
RolePermissions: []libregraph.UnifiedRolePermission{
532+
{
533+
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(_spaceEditorWithoutVersionsWithoutTrashbinRole.CS3ResourcePermissions()),
534+
Condition: proto.String(UnifiedRoleConditionDrive),
535+
},
536+
},
537+
LibreGraphWeight: proto.Int32(0),
538+
}
539+
}
540+
514541
// roleSpaceEditorWithoutTrashbin creates an editor without trashbin role
515542
roleSpaceEditorWithoutTrashbin = func() *libregraph.UnifiedRoleDefinition {
516543
return &libregraph.UnifiedRoleDefinition{

services/graph/pkg/unifiedrole/roles_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ func TestGetRolesByPermissions(t *testing.T) {
188188
constraints: unifiedrole.UnifiedRoleConditionDrive,
189189
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{
190190
unifiedrole.RoleSpaceViewer(),
191+
unifiedrole.RoleSpaceEditorWithoutVersionsWithoutTrashbin(),
191192
unifiedrole.RoleSpaceEditorWithoutVersions(),
192193
unifiedrole.RoleSpaceEditorWithoutTrashbin(),
193194
unifiedrole.RoleSpaceEditor(),

vendor/github.com/owncloud/reva/v2/pkg/conversions/role.go

Lines changed: 26 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ github.com/orcaman/concurrent-map
13131313
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
13141314
## explicit; go 1.18
13151315
github.com/owncloud/libre-graph-api-go
1316-
# github.com/owncloud/reva/v2 v2.0.0-20260305165853-c9204c730c66
1316+
# github.com/owncloud/reva/v2 v2.0.0-20260422094911-a697030257f5
13171317
## explicit; go 1.24.0
13181318
github.com/owncloud/reva/v2/cmd/revad/internal/grace
13191319
github.com/owncloud/reva/v2/cmd/revad/runtime

0 commit comments

Comments
 (0)