@@ -27,6 +27,7 @@ import (
27
27
28
28
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
29
29
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
30
+ typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
30
31
ocmshare "github.com/cs3org/reva/v2/pkg/ocm/share"
31
32
utils "github.com/cs3org/reva/v2/pkg/utils"
32
33
)
@@ -38,7 +39,7 @@ type Protocols []Protocol
38
39
// in the OCM share.
39
40
type Protocol interface {
40
41
// ToOCMProtocol convert the protocol to a ocm Protocol struct
41
- ToOCMProtocol () * ocm.Protocol
42
+ ToOCMProtocol (* typesv1beta1. Opaque ) * ocm.Protocol
42
43
}
43
44
44
45
// protocols supported by the OCM API
@@ -51,7 +52,8 @@ type WebDAV struct {
51
52
}
52
53
53
54
// ToOCMProtocol convert the protocol to a ocm Protocol struct.
54
- func (w * WebDAV ) ToOCMProtocol () * ocm.Protocol {
55
+ func (w * WebDAV ) ToOCMProtocol (o * typesv1beta1.Opaque ) * ocm.Protocol {
56
+ resourceType := utils .ReadPlainFromOpaque (o , "resourceType" )
55
57
perms := & ocm.SharePermissions {
56
58
Permissions : & providerv1beta1.ResourcePermissions {},
57
59
}
@@ -67,9 +69,11 @@ func (w *WebDAV) ToOCMProtocol() *ocm.Protocol {
67
69
case "write" :
68
70
perms .Permissions .InitiateFileUpload = true
69
71
perms .Permissions .RestoreRecycleItem = true
70
- perms .Permissions .CreateContainer = true
71
- perms .Permissions .Delete = true
72
- perms .Permissions .Move = true
72
+ if resourceType == "folder" {
73
+ perms .Permissions .Move = true
74
+ perms .Permissions .CreateContainer = true
75
+ perms .Permissions .Delete = true
76
+ }
73
77
}
74
78
}
75
79
@@ -83,7 +87,7 @@ type Webapp struct {
83
87
}
84
88
85
89
// ToOCMProtocol convert the protocol to a ocm Protocol struct.
86
- func (w * Webapp ) ToOCMProtocol () * ocm.Protocol {
90
+ func (w * Webapp ) ToOCMProtocol (_ * typesv1beta1. Opaque ) * ocm.Protocol {
87
91
return ocmshare .NewWebappProtocol (w .URITemplate , utils .GetAppViewMode (w .ViewMode ))
88
92
}
89
93
@@ -95,7 +99,7 @@ type Datatx struct {
95
99
}
96
100
97
101
// ToOCMProtocol convert the protocol to a ocm Protocol struct.
98
- func (w * Datatx ) ToOCMProtocol () * ocm.Protocol {
102
+ func (w * Datatx ) ToOCMProtocol (_ * typesv1beta1. Opaque ) * ocm.Protocol {
99
103
return ocmshare .NewTransferProtocol (w .SourceURI , w .SharedSecret , w .Size )
100
104
}
101
105
0 commit comments