mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-24 21:18:19 -05:00
fix: search capabilities format (#7551)
* fix: search capabilities format * chore: bump reva
This commit is contained in:
Generated
Vendored
+1
-1
@@ -43,8 +43,8 @@ import (
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/publicshare"
|
||||
rstatus "github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
|
||||
+1
-1
@@ -35,8 +35,8 @@ import (
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
|
||||
Generated
Vendored
+30
-1
@@ -58,8 +58,37 @@ type Capabilities struct {
|
||||
Spaces *Spaces `json:"spaces,omitempty" xml:"spaces,omitempty" mapstructure:"spaces"`
|
||||
Graph *CapabilitiesGraph `json:"graph,omitempty" xml:"graph,omitempty" mapstructure:"graph"`
|
||||
PasswordPolicy *CapabilitiesPasswordPolicy `json:"password_policy,omitempty" xml:"password_policy,omitempty" mapstructure:"password_policy"`
|
||||
Search *CapabilitiesSearch `json:"search,omitempty" xml:"search,omitempty" mapstructure:"search"`
|
||||
Notifications *CapabilitiesNotifications `json:"notifications,omitempty" xml:"notifications,omitempty"`
|
||||
}
|
||||
|
||||
Notifications *CapabilitiesNotifications `json:"notifications,omitempty" xml:"notifications,omitempty"`
|
||||
// CapabilitiesSearch holds the search capabilities
|
||||
type CapabilitiesSearch struct {
|
||||
Property *CapabilitiesSearchProperties `json:"property" xml:"property" mapstructure:"property"`
|
||||
}
|
||||
|
||||
// CapabilitiesSearchProperties holds the search property capabilities
|
||||
type CapabilitiesSearchProperties struct {
|
||||
Name *CapabilitiesSearchProperty `json:"name" xml:"name" mapstructure:"name"`
|
||||
Mtime *CapabilitiesSearchPropertyMtime `json:"mtime" xml:"mtime" mapstructure:"mtime"`
|
||||
Size *CapabilitiesSearchProperty `json:"size" xml:"size" mapstructure:"size"`
|
||||
Mimetype *CapabilitiesSearchProperty `json:"mimetype" xml:"mimetype" mapstructure:"mimetype"`
|
||||
Type *CapabilitiesSearchProperty `json:"type" xml:"type" mapstructure:"type"`
|
||||
Tag *CapabilitiesSearchProperty `json:"tag" xml:"tag" mapstructure:"tag"`
|
||||
Tags *CapabilitiesSearchProperty `json:"tags" xml:"tags" mapstructure:"tags"`
|
||||
Content *CapabilitiesSearchProperty `json:"content" xml:"content" mapstructure:"content"`
|
||||
Scope *CapabilitiesSearchProperty `json:"scope" xml:"scope" mapstructure:"scope"`
|
||||
}
|
||||
|
||||
// CapabilitiesSearchProperty represents the default search property
|
||||
type CapabilitiesSearchProperty struct {
|
||||
Enabled bool `json:"enabled" xml:"enabled" mapstructure:"enabled"`
|
||||
}
|
||||
|
||||
// CapabilitiesSearchPropertyMtime represents the mtime search property
|
||||
type CapabilitiesSearchPropertyMtime struct {
|
||||
CapabilitiesSearchProperty
|
||||
Keywords []string `json:"keywords" xml:"keywords" mapstructure:"keywords"`
|
||||
}
|
||||
|
||||
// Spaces lets a service configure its advertised options related to Storage Spaces.
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -24,9 +24,9 @@ import (
|
||||
|
||||
grouppb "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1"
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -31,9 +31,9 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -26,8 +26,8 @@ import (
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
)
|
||||
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -32,9 +32,9 @@ import (
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -29,11 +29,11 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/huandu/xstrings"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -32,8 +32,8 @@ import (
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/ocm/share"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -40,6 +40,7 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/password"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/zerolog"
|
||||
@@ -48,7 +49,6 @@ import (
|
||||
|
||||
ocmv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -31,9 +31,9 @@ import (
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
registry "github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -28,9 +28,9 @@ import (
|
||||
ocmpb "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -22,8 +22,8 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
)
|
||||
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -30,9 +30,9 @@ import (
|
||||
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
cs3storage "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
|
||||
+1
-1
@@ -31,9 +31,9 @@ import (
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
providerpb "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/reqres"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/ocm/share"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/go-playground/validator/v10"
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
)
|
||||
|
||||
// DBShare stores information about user and public shares.
|
||||
|
||||
Generated
Vendored
Generated
Vendored
Generated
Vendored
+262
@@ -0,0 +1,262 @@
|
||||
package conversions
|
||||
|
||||
import (
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// UnifiedRoleViewerID Unified role viewer id.
|
||||
UnifiedRoleViewerID = "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
|
||||
// UnifiedRoleSpaceViewerID Unified role space viewer id.
|
||||
UnifiedRoleSpaceViewerID = "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
|
||||
// UnifiedRoleEditorID Unified role editor id.
|
||||
UnifiedRoleEditorID = "fb6c3e19-e378-47e5-b277-9732f9de6e21"
|
||||
// UnifiedRoleSpaceEditorID Unified role space editor id.
|
||||
UnifiedRoleSpaceEditorID = "58c63c02-1d89-4572-916a-870abc5a1b7d"
|
||||
// UnifiedRoleFileEditorID Unified role file editor id.
|
||||
UnifiedRoleFileEditorID = "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
|
||||
// UnifiedRoleCoownerID Unified role coowner id.
|
||||
UnifiedRoleCoownerID = "3a4ba8e9-6a0d-4235-9140-0e7a34007abe"
|
||||
// UnifiedRoleUploaderID Unified role uploader id.
|
||||
UnifiedRoleUploaderID = "1c996275-f1c9-4e71-abdf-a42f6495e960"
|
||||
// UnifiedRoleManagerID Unified role manager id.
|
||||
UnifiedRoleManagerID = "312c0871-5ef7-4b3a-85b6-0e4074c64049"
|
||||
|
||||
// UnifiedRoleConditionSelf TODO defines constraints
|
||||
UnifiedRoleConditionSelf = "Self: @Subject.objectId == @Resource.objectId"
|
||||
// UnifiedRoleConditionOwner defines constraints when the principal is the owner of the target resource
|
||||
UnifiedRoleConditionOwner = "Owner: @Subject.objectId Any_of @Resource.owners"
|
||||
// UnifiedRoleConditionGrantee does not exist in MS Graph, but we use it to express permissions on shared resources
|
||||
UnifiedRoleConditionGrantee = "Grantee: @Subject.objectId Any_of @Resource.grantee"
|
||||
)
|
||||
|
||||
// NewViewerUnifiedRole creates a viewer role. `sharing` indicates if sharing permission should be added
|
||||
func NewViewerUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {
|
||||
r := NewViewerRole(sharing)
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleViewerID),
|
||||
Description: proto.String("Allows reading the shared file or folder"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewSpaceViewerUnifiedRole creates a spaceviewer role
|
||||
func NewSpaceViewerUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewSpaceViewerRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleSpaceViewerID),
|
||||
Description: proto.String("Allows reading the shared space"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionOwner),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewEditorUnifiedRole creates an editor role. `sharing` indicates if sharing permission should be added
|
||||
func NewEditorUnifiedRole(sharing bool) *libregraph.UnifiedRoleDefinition {
|
||||
r := NewEditorRole(sharing)
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleEditorID),
|
||||
Description: proto.String("Allows creating, reading, updating and deleting the shared file or folder"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewSpaceEditorUnifiedRole creates an editor role
|
||||
func NewSpaceEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewSpaceEditorRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleSpaceEditorID),
|
||||
Description: proto.String("Allows creating, reading, updating and deleting file or folder in the shared space"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionOwner),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewFileEditorUnifiedRole creates a file-editor role
|
||||
func NewFileEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewFileEditorRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleFileEditorID),
|
||||
Description: proto.String("Allows reading and updating file"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewCoownerUnifiedRole creates a coowner role.
|
||||
func NewCoownerUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewCoownerRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleCoownerID),
|
||||
Description: proto.String("Grants co-owner permissions on a resource"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewUploaderUnifiedRole creates an uploader role
|
||||
func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewUploaderRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleUploaderID),
|
||||
Description: proto.String("Allows upload file or folder"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewManagerUnifiedRole creates a manager role
|
||||
func NewManagerUnifiedRole() *libregraph.UnifiedRoleDefinition {
|
||||
r := NewManagerRole()
|
||||
return &libregraph.UnifiedRoleDefinition{
|
||||
Id: proto.String(UnifiedRoleManagerID),
|
||||
Description: proto.String("Grants manager permissions on a resource. Semantically equivalent to co-owner"),
|
||||
DisplayName: displayName(r),
|
||||
RolePermissions: []libregraph.UnifiedRolePermission{
|
||||
{
|
||||
AllowedResourceActions: convert(r),
|
||||
Condition: proto.String(UnifiedRoleConditionGrantee),
|
||||
},
|
||||
},
|
||||
LibreGraphWeight: proto.Int32(0),
|
||||
}
|
||||
}
|
||||
|
||||
func displayName(role *Role) *string {
|
||||
if role == nil {
|
||||
return nil
|
||||
}
|
||||
var displayName string
|
||||
switch role.Name {
|
||||
case RoleViewer:
|
||||
displayName = "Viewer"
|
||||
case RoleSpaceViewer:
|
||||
displayName = "Space Viewer"
|
||||
case RoleEditor:
|
||||
displayName = "Editor"
|
||||
case RoleSpaceEditor:
|
||||
displayName = "Space Editor"
|
||||
case RoleFileEditor:
|
||||
displayName = "File Editor"
|
||||
case RoleCoowner:
|
||||
displayName = "Co Owner"
|
||||
case RoleUploader:
|
||||
displayName = "Uploader"
|
||||
case RoleManager:
|
||||
displayName = "Manager"
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
return proto.String(displayName)
|
||||
}
|
||||
|
||||
func convert(role *Role) []string {
|
||||
actions := make([]string, 0, 8)
|
||||
if role == nil && role.cS3ResourcePermissions == nil {
|
||||
return actions
|
||||
}
|
||||
p := role.CS3ResourcePermissions()
|
||||
if p.AddGrant {
|
||||
actions = append(actions, "libre.graph/driveItem/permissions/create")
|
||||
}
|
||||
if p.CreateContainer {
|
||||
actions = append(actions, "libre.graph/driveItem/children/create")
|
||||
}
|
||||
if p.Delete {
|
||||
actions = append(actions, "libre.graph/driveItem/standard/delete")
|
||||
}
|
||||
if p.GetPath {
|
||||
actions = append(actions, "libre.graph/driveItem/path/read")
|
||||
}
|
||||
if p.GetQuota {
|
||||
actions = append(actions, "libre.graph/driveItem/quota/read")
|
||||
}
|
||||
if p.InitiateFileDownload {
|
||||
actions = append(actions, "libre.graph/driveItem/content/read")
|
||||
}
|
||||
if p.InitiateFileUpload {
|
||||
actions = append(actions, "libre.graph/driveItem/upload/create")
|
||||
}
|
||||
if p.ListGrants {
|
||||
actions = append(actions, "libre.graph/driveItem/permissions/read")
|
||||
}
|
||||
if p.ListContainer {
|
||||
actions = append(actions, "libre.graph/driveItem/children/read")
|
||||
}
|
||||
if p.ListFileVersions {
|
||||
actions = append(actions, "libre.graph/driveItem/versions/read")
|
||||
}
|
||||
if p.ListRecycle {
|
||||
actions = append(actions, "libre.graph/driveItem/deleted/read")
|
||||
}
|
||||
if p.Move {
|
||||
actions = append(actions, "libre.graph/driveItem/path/update")
|
||||
}
|
||||
if p.RemoveGrant {
|
||||
actions = append(actions, "libre.graph/driveItem/permissions/delete")
|
||||
}
|
||||
if p.PurgeRecycle {
|
||||
actions = append(actions, "libre.graph/driveItem/deleted/delete")
|
||||
}
|
||||
if p.RestoreFileVersion {
|
||||
actions = append(actions, "libre.graph/driveItem/versions/update")
|
||||
}
|
||||
if p.RestoreRecycleItem {
|
||||
actions = append(actions, "libre.graph/driveItem/deleted/update")
|
||||
}
|
||||
if p.Stat {
|
||||
actions = append(actions, "libre.graph/driveItem/basic/read")
|
||||
}
|
||||
if p.UpdateGrant {
|
||||
actions = append(actions, "libre.graph/driveItem/permissions/update")
|
||||
}
|
||||
if p.DenyGrant {
|
||||
actions = append(actions, "libre.graph/driveItem/permissions/deny")
|
||||
}
|
||||
return actions
|
||||
}
|
||||
Generated
Vendored
+1
-1
@@ -27,7 +27,7 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/jellydator/ttlcache/v2"
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import (
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -31,7 +31,7 @@ import (
|
||||
"time"
|
||||
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
+1
-1
@@ -40,8 +40,8 @@ import (
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/grpc/services/storageprovider"
|
||||
conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
"github.com/cs3org/reva/v2/pkg/events"
|
||||
|
||||
+1
-1
@@ -31,8 +31,8 @@ import (
|
||||
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
conversions "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
"github.com/cs3org/reva/v2/pkg/logger"
|
||||
|
||||
+1
-1
@@ -34,8 +34,8 @@ import (
|
||||
v1beta11 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
ocsconv "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
ocsconv "github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
|
||||
+1
-1
@@ -40,8 +40,8 @@ import (
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/conversions"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/eosclient"
|
||||
"github.com/cs3org/reva/v2/pkg/eosclient/eosbinary"
|
||||
|
||||
Reference in New Issue
Block a user