Skip to content
Open
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: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ require (
github.com/open-policy-agent/opa v1.17.1
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260615073558-209c2cd3b52b
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260617101222-64667a51e1ee
github.com/opensearch-project/opensearch-go/v4 v4.6.0
github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,8 @@ github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+l
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89/go.mod h1:vigJkNss1N2QEceCuNw/ullDehncuJNFB6mEnzfq9UI=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d h1:JcqGDiyrcaQwVyV861TUyQgO7uEmsjkhfm7aQd84dOw=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260615073558-209c2cd3b52b h1:ejmGkLVlWauUkcnXYbSr7dY1a59dUdkKHOvzeGpwwgE=
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260615073558-209c2cd3b52b/go.mod h1:RoFQt+u7edxwzHr1IZ2Y6VaDinMiRPQupAvMBy3WVmE=
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260617101222-64667a51e1ee h1:9FxUPKO9Mowt24yr1vaG8OjhBNYcfeFoGdhJerKbpEU=
github.com/opencloud-eu/reva/v2 v2.46.4-0.20260617101222-64667a51e1ee/go.mod h1:z3cZwP9nHkvyyZgrG56MvxSUkqTF7DTlcGJzJfkyNlI=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down
1 change: 1 addition & 0 deletions services/graph/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
// but can be enabled by the user.
_disabledByDefaultUnifiedRoleRoleIDs = []string{
unifiedrole.UnifiedRoleSecureViewerID,
unifiedrole.UnifiedRoleSpaceViewerWithVersionsID,
unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsID,
unifiedrole.UnifiedRoleViewerListGrantsID,
unifiedrole.UnifiedRoleEditorListGrantsID,
Expand Down
3 changes: 3 additions & 0 deletions services/graph/pkg/unifiedrole/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
libregraph "github.com/opencloud-eu/libre-graph-api-go"

"github.com/opencloud-eu/reva/v2/pkg/conversions"
)

Expand Down Expand Up @@ -210,6 +211,8 @@ func cs3RoleToDisplayName(role *conversions.Role) string {
return _viewerListGrantsUnifiedRoleDisplayName
case conversions.RoleSpaceViewer:
return _spaceViewerUnifiedRoleDisplayName
case conversions.RoleSpaceViewerWithVersions:
return _spaceViewerWithVersionsUnifiedRoleDisplayName
case conversions.RoleEditor:
return _editorUnifiedRoleDisplayName
case conversions.RoleEditorWithVersions:
Expand Down
1 change: 1 addition & 0 deletions services/graph/pkg/unifiedrole/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var (
RoleViewerWithVersions = roleViewerWithVersions
RoleViewerListGrants = roleViewerListGrants
RoleSpaceViewer = roleSpaceViewer
RoleSpaceViewerWithVersions = roleSpaceViewerWithVersions
RoleEditor = roleEditor
RoleEditorWithVersions = roleEditorWithVersions
RoleEditorListGrants = roleEditorListGrants
Expand Down
29 changes: 28 additions & 1 deletion services/graph/pkg/unifiedrole/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"strings"

libregraph "github.com/opencloud-eu/libre-graph-api-go"
"github.com/opencloud-eu/reva/v2/pkg/conversions"
"google.golang.org/protobuf/proto"

"github.com/opencloud-eu/reva/v2/pkg/conversions"

"github.com/opencloud-eu/opencloud/pkg/l10n"
graphl10n "github.com/opencloud-eu/opencloud/services/graph/pkg/l10n"
)
Expand All @@ -22,6 +23,8 @@ const (
UnifiedRoleViewerListGrantsID = "d5041006-ebb3-4b4a-b6a4-7c180ecfb17d"
// UnifiedRoleSpaceViewerID Unified role space viewer id.
UnifiedRoleSpaceViewerID = "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
// UnifiedRoleSpaceViewerWithVersionsID
UnifiedRoleSpaceViewerWithVersionsID = "3de465fc-6e17-4839-8b8a-a77cc497878b"
// UnifiedRoleEditorID Unified role editor id.
UnifiedRoleEditorID = "fb6c3e19-e378-47e5-b277-9732f9de6e21"
// UnifiedRoleEditorWithVersionsID
Expand Down Expand Up @@ -121,6 +124,12 @@ var (
// UnifiedRole SpaseViewer, Role DisplayName (resolves directly)
_spaceViewerUnifiedRoleDisplayName = l10n.Template("Can view")

// UnifiedRole SpaceViewer, Role Description (resolves directly)
_spaceViewerWithVersionsUnifiedRoleDescription = l10n.Template("View and download including the history.")

// UnifiedRole SpaseViewer, Role DisplayName (resolves directly)
_spaceViewerWithVersionsUnifiedRoleDisplayName = l10n.Template("Can view")

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

Expand Down Expand Up @@ -214,6 +223,7 @@ var (
roleViewerWithVersions,
roleViewerListGrants,
roleSpaceViewer,
roleSpaceViewerWithVersions,
roleEditor,
roleEditorListGrants,
roleEditorWithVersions,
Expand Down Expand Up @@ -345,6 +355,23 @@ var (
}
}()

// roleSpaceViewer creates a spaceviewer role
roleSpaceViewerWithVersions = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewSpaceViewerWithVersionsRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleSpaceViewerWithVersionsID),
Description: proto.String(_spaceViewerWithVersionsUnifiedRoleDescription),
DisplayName: proto.String(cs3RoleToDisplayName(r)),
RolePermissions: []libregraph.UnifiedRolePermission{
{
AllowedResourceActions: CS3ResourcePermissionsToLibregraphActions(r.CS3ResourcePermissions()),
Condition: proto.String(UnifiedRoleConditionDrive),
},
},
LibreGraphWeight: proto.Int32(40),
}
}()

// roleEditorLite creates an editor-lite role
roleEditorLite = func() *libregraph.UnifiedRoleDefinition {
r := conversions.NewEditorLiteRole()
Expand Down
5 changes: 5 additions & 0 deletions services/graph/pkg/unifiedrole/roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func TestGetDefinition(t *testing.T) {
ids: []string{unifiedrole.UnifiedRoleFileEditorWithVersionsID},
unifiedRoleDefinition: unifiedrole.RoleFileEditorWithVersions,
},
"pass space-viewer-with-versions": {
ids: []string{unifiedrole.UnifiedRoleSpaceViewerWithVersionsID},
unifiedRoleDefinition: unifiedrole.RoleSpaceViewerWithVersions,
},
"fail unknown": {
ids: []string{"unknown"},
expectError: unifiedrole.ErrUnknownRole,
Expand Down Expand Up @@ -203,6 +207,7 @@ func TestGetRolesByPermissions(t *testing.T) {
constraints: unifiedrole.UnifiedRoleConditionDrive,
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{
unifiedrole.RoleSpaceViewer,
unifiedrole.RoleSpaceViewerWithVersions,
unifiedrole.RoleSpaceEditorWithoutVersions,
unifiedrole.RoleSpaceEditor,
unifiedrole.RoleManager,
Expand Down
4 changes: 4 additions & 0 deletions services/web/pkg/theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ var themeDefaults = KV{
"label": "UnifiedRoleSpaceViewer",
"iconName": "eye",
},
unifiedrole.UnifiedRoleSpaceViewerWithVersionsID: KV{
"label": "UnifiedRoleSpaceViewerWithVersions",
"iconName": "eye",
},
unifiedrole.UnifiedRoleFileEditorID: KV{
"label": "UnifiedRoleFileEditor",
"iconName": "pencil",
Expand Down
13 changes: 13 additions & 0 deletions vendor/github.com/opencloud-eu/reva/v2/pkg/conversions/role.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading