Skip to content

Commit ba6d844

Browse files
committed
feat: Add roles EditorListGrantsWithVersions, FileEditorListGrantsWithVersions
1 parent 7db0c82 commit ba6d844

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Enhancement: Add roles
2+
3+
Add EditorListGrantsWithVersions and FileEditorListGrantsWithVersions roles.
4+
5+
TODO
6+
https://github.com/owncloud/ocis/issues/10747

pkg/conversions/role.go

+24
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const (
4545
RoleEditor = "editor"
4646
// RoleEditorListGrants grants editor permission on a resource, including folders.
4747
RoleEditorListGrants = "editor-list-grants"
48+
// RoleEditorListGrantsWithVersions grants editor permission on a resource, including folders.
49+
RoleEditorListGrantsWithVersions = "editor-list-grants-with-versions"
4850
// RoleSpaceEditor grants editor permission on a space.
4951
RoleSpaceEditor = "spaceeditor"
5052
// RoleSpaceEditorWithoutVersions grants editor permission without list/restore versions on a space.
@@ -53,6 +55,8 @@ const (
5355
RoleFileEditor = "file-editor"
5456
// RoleFileEditorListGrants grants editor permission on a single file.
5557
RoleFileEditorListGrants = "file-editor-list-grants"
58+
// RoleFileEditorListGrantsWithVersions grants editor permission on a single file.
59+
RoleFileEditorListGrantsWithVersions = "file-editor-list-grants-with-versions"
5660
// RoleCoowner grants co-owner permissions on a resource.
5761
RoleCoowner = "coowner"
5862
// RoleEditorLite grants permission to upload and download to a resource.
@@ -171,12 +175,16 @@ func RoleFromName(name string) *Role {
171175
return NewEditorRole()
172176
case RoleEditorListGrants:
173177
return NewEditorListGrantsRole()
178+
case RoleEditorListGrantsWithVersions:
179+
return NewEditorListGrantsWithVersionsRole()
174180
case RoleSpaceEditor:
175181
return NewSpaceEditorRole()
176182
case RoleFileEditor:
177183
return NewFileEditorRole()
178184
case RoleFileEditorListGrants:
179185
return NewFileEditorListGrantsRole()
186+
case RoleFileEditorListGrantsWithVersions:
187+
return NewFileEditorListGrantsWithVersionsRole()
180188
case RoleUploader:
181189
return NewUploaderRole()
182190
case RoleManager:
@@ -276,6 +284,14 @@ func NewEditorListGrantsRole() *Role {
276284
return role
277285
}
278286

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+
role.cS3ResourcePermissions.RestoreFileVersion = true
292+
return role
293+
}
294+
279295
// NewSpaceEditorRole creates an editor role
280296
func NewSpaceEditorRole() *Role {
281297
return &Role{
@@ -348,6 +364,14 @@ func NewFileEditorListGrantsRole() *Role {
348364
return role
349365
}
350366

367+
// NewFileEditorListGrantsWithVersionsRole creates a file-editor role
368+
func NewFileEditorListGrantsWithVersionsRole() *Role {
369+
role := NewFileEditorListGrantsRole()
370+
role.cS3ResourcePermissions.ListFileVersions = true
371+
role.cS3ResourcePermissions.RestoreFileVersion = true
372+
return role
373+
}
374+
351375
// NewCoownerRole creates a coowner role.
352376
func NewCoownerRole() *Role {
353377
return &Role{

0 commit comments

Comments
 (0)