@@ -45,6 +45,8 @@ const (
45
45
RoleEditor = "editor"
46
46
// RoleEditorListGrants grants editor permission on a resource, including folders.
47
47
RoleEditorListGrants = "editor-list-grants"
48
+ // RoleEditorListGrantsWithVersions grants editor permission on a resource, including folders.
49
+ RoleEditorListGrantsWithVersions = "editor-list-grants-with-versions"
48
50
// RoleSpaceEditor grants editor permission on a space.
49
51
RoleSpaceEditor = "spaceeditor"
50
52
// RoleSpaceEditorWithoutVersions grants editor permission without list/restore versions on a space.
@@ -53,6 +55,8 @@ const (
53
55
RoleFileEditor = "file-editor"
54
56
// RoleFileEditorListGrants grants editor permission on a single file.
55
57
RoleFileEditorListGrants = "file-editor-list-grants"
58
+ // RoleFileEditorListGrantsWithVersions grants editor permission on a single file.
59
+ RoleFileEditorListGrantsWithVersions = "file-editor-list-grants-with-versions"
56
60
// RoleCoowner grants co-owner permissions on a resource.
57
61
RoleCoowner = "coowner"
58
62
// RoleEditorLite grants permission to upload and download to a resource.
@@ -171,12 +175,16 @@ func RoleFromName(name string) *Role {
171
175
return NewEditorRole ()
172
176
case RoleEditorListGrants :
173
177
return NewEditorListGrantsRole ()
178
+ case RoleEditorListGrantsWithVersions :
179
+ return NewEditorListGrantsWithVersionsRole ()
174
180
case RoleSpaceEditor :
175
181
return NewSpaceEditorRole ()
176
182
case RoleFileEditor :
177
183
return NewFileEditorRole ()
178
184
case RoleFileEditorListGrants :
179
185
return NewFileEditorListGrantsRole ()
186
+ case RoleFileEditorListGrantsWithVersions :
187
+ return NewFileEditorListGrantsWithVersionsRole ()
180
188
case RoleUploader :
181
189
return NewUploaderRole ()
182
190
case RoleManager :
@@ -276,6 +284,13 @@ func NewEditorListGrantsRole() *Role {
276
284
return role
277
285
}
278
286
287
+ // NewEditorListGrantsWithVersionsRole creates an editor role. `sharing` indicates if sharing permission should be added
288
+ func NewEditorListGrantsWithVersionsRole () * Role {
289
+ role := NewEditorListGrantsRole ()
290
+ role .cS3ResourcePermissions .ListFileVersions = true
291
+ return role
292
+ }
293
+
279
294
// NewSpaceEditorRole creates an editor role
280
295
func NewSpaceEditorRole () * Role {
281
296
return & Role {
@@ -348,6 +363,13 @@ func NewFileEditorListGrantsRole() *Role {
348
363
return role
349
364
}
350
365
366
+ // NewFileEditorListGrantsWithVersionsRole creates a file-editor role
367
+ func NewFileEditorListGrantsWithVersionsRole () * Role {
368
+ role := NewFileEditorListGrantsRole ()
369
+ role .cS3ResourcePermissions .ListFileVersions = true
370
+ return role
371
+ }
372
+
351
373
// NewCoownerRole creates a coowner role.
352
374
func NewCoownerRole () * Role {
353
375
return & Role {
@@ -595,6 +617,9 @@ func RoleFromResourcePermissions(rp *provider.ResourcePermissions, islink bool)
595
617
if rp .ListGrants {
596
618
r .Name = RoleEditorListGrants
597
619
}
620
+ if rp .RemoveGrant && rp .ListFileVersions {
621
+ r .Name = RoleEditorListGrantsWithVersions
622
+ }
598
623
if rp .RemoveGrant {
599
624
r .Name = RoleManager
600
625
}
0 commit comments