Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d24907b1c |
No files matched your search
@@ -368,3 +368,5 @@ replace go-micro.dev/v4 => github.com/kobergj/go-micro/v4 v4.0.0-20250610135441-
|
|||||||
// exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3
|
// exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3
|
||||||
// see https://github.com/mattn/go-sqlite3/issues/965 for more details
|
// see https://github.com/mattn/go-sqlite3/issues/965 for more details
|
||||||
exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||||
|
|
||||||
|
replace github.com/owncloud/reva/v2 => github.com/kobergj/reva/v2 v2.26.3-0.20260122145036-d6e50a1a1b8c
|
||||||
@@ -592,6 +592,8 @@ github.com/kobergj/icap-client v0.0.0-20250116172800-8eaa5022532b h1:NBKEgFtIukC
|
|||||||
github.com/kobergj/icap-client v0.0.0-20250116172800-8eaa5022532b/go.mod h1:HpntrRsQA6RKNXy2Nbr4kVj+NO3OYWpAQUVxeya+3sU=
|
github.com/kobergj/icap-client v0.0.0-20250116172800-8eaa5022532b/go.mod h1:HpntrRsQA6RKNXy2Nbr4kVj+NO3OYWpAQUVxeya+3sU=
|
||||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 h1:pfI8Z5yavO6fU6vDGlWhZ4BgDlvj8c6xB7J57HfTPwA=
|
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 h1:pfI8Z5yavO6fU6vDGlWhZ4BgDlvj8c6xB7J57HfTPwA=
|
||||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY=
|
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY=
|
||||||
|
github.com/kobergj/reva/v2 v2.26.3-0.20260122145036-d6e50a1a1b8c h1:fY6NPkp7mrLXBOGZ4WgWg/bQfCurX70hgv58QrZ/ptQ=
|
||||||
|
github.com/kobergj/reva/v2 v2.26.3-0.20260122145036-d6e50a1a1b8c/go.mod h1:Itza4SSsgKrDfoXXFIjdZaz8dVSkC0orJl+w5tW23PY=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/kovidgoyal/go-parallel v1.1.1 h1:1OzpNjtrUkBPq3UaqrnvOoB2F9RttSt811uiUXyI7ok=
|
github.com/kovidgoyal/go-parallel v1.1.1 h1:1OzpNjtrUkBPq3UaqrnvOoB2F9RttSt811uiUXyI7ok=
|
||||||
@@ -742,8 +744,6 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
|||||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64 h1:z9djjzd+leAy6QZpi8dLy3OVjc/um+1XAGk1SJEvwE8=
|
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64 h1:z9djjzd+leAy6QZpi8dLy3OVjc/um+1XAGk1SJEvwE8=
|
||||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||||
github.com/owncloud/reva/v2 v2.0.0-20260116122933-81e6e21256eb h1:G4YhVvtdJDEE0fhV0sWMUDpcpV5WqQNdfLw9xNMfkFI=
|
|
||||||
github.com/owncloud/reva/v2 v2.0.0-20260116122933-81e6e21256eb/go.mod h1:nDBXQivlwd4Vf5UD/oDT0RakSXy0GJPI1LsyHMm5IpI=
|
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||||
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
||||||
|
|||||||
@@ -200,10 +200,11 @@ func TestGetRolesByPermissions(t *testing.T) {
|
|||||||
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{},
|
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{},
|
||||||
},
|
},
|
||||||
"RoleEditorLite and custom | folder": {
|
"RoleEditorLite and custom | folder": {
|
||||||
givenActions: append(getRoleActions(unifiedrole.RoleEditorLite()), unifiedrole.DriveItemQuotaRead),
|
givenActions: getRoleActions(unifiedrole.RoleEditorLite()),
|
||||||
constraints: unifiedrole.UnifiedRoleConditionFolder,
|
constraints: unifiedrole.UnifiedRoleConditionFolder,
|
||||||
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{
|
unifiedRoleDefinition: []*libregraph.UnifiedRoleDefinition{
|
||||||
unifiedrole.RoleSecureViewer(),
|
unifiedrole.RoleSecureViewer(),
|
||||||
|
unifiedrole.RoleViewer(),
|
||||||
unifiedrole.RoleEditorLite(),
|
unifiedrole.RoleEditorLite(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+129
-214
@@ -209,6 +209,40 @@ func NewUnknownRole() *Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sharing Viewer (Files + Folders)
|
||||||
|
|
||||||
|
// NewSecureViewerRole creates a secure viewer role
|
||||||
|
func NewSecureViewerRole() *Role {
|
||||||
|
return &Role{
|
||||||
|
Name: RoleSecureViewer,
|
||||||
|
cS3ResourcePermissions: &provider.ResourcePermissions{
|
||||||
|
GetPath: true,
|
||||||
|
ListContainer: true,
|
||||||
|
Stat: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewViewerRole creates a viewer role.
|
||||||
|
func NewViewerRole() *Role {
|
||||||
|
r := NewSecureViewerRole()
|
||||||
|
r.Name = RoleViewer
|
||||||
|
r.ocsPermissions = PermissionRead
|
||||||
|
r.cS3ResourcePermissions.GetQuota = true
|
||||||
|
r.cS3ResourcePermissions.InitiateFileDownload = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewViewerListGrantsRole creates a viewer role.
|
||||||
|
func NewViewerListGrantsRole() *Role {
|
||||||
|
r := NewViewerRole()
|
||||||
|
r.Name = RoleViewerListGrants
|
||||||
|
r.cS3ResourcePermissions.ListGrants = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sharing Folder
|
||||||
|
|
||||||
// NewDeniedRole creates a fully denied role
|
// NewDeniedRole creates a fully denied role
|
||||||
func NewDeniedRole() *Role {
|
func NewDeniedRole() *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
@@ -218,185 +252,126 @@ func NewDeniedRole() *Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewViewerRole creates a viewer role. `sharing` indicates if sharing permission should be added
|
// NewEditorLiteRole creates an editor-lite role
|
||||||
func NewViewerRole() *Role {
|
func NewEditorLiteRole() *Role {
|
||||||
p := PermissionRead
|
r := NewViewerRole()
|
||||||
return &Role{
|
r.Name = RoleEditorLite
|
||||||
Name: RoleViewer,
|
r.ocsPermissions = PermissionCreate
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
r.cS3ResourcePermissions.CreateContainer = true
|
||||||
GetPath: true,
|
r.cS3ResourcePermissions.InitiateFileUpload = true
|
||||||
GetQuota: true,
|
r.cS3ResourcePermissions.Move = true
|
||||||
InitiateFileDownload: true,
|
return r
|
||||||
ListContainer: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: p,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewViewerListGrantsRole creates a viewer role. `sharing` indicates if sharing permission should be added
|
// NewEditorRole creates an editor role.
|
||||||
func NewViewerListGrantsRole() *Role {
|
|
||||||
role := NewViewerRole()
|
|
||||||
role.cS3ResourcePermissions.ListGrants = true
|
|
||||||
return role
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSpaceViewerRole creates a spaceviewer role
|
|
||||||
func NewSpaceViewerRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleSpaceViewer,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListGrants: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionRead,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewEditorRole creates an editor role. `sharing` indicates if sharing permission should be added
|
|
||||||
func NewEditorRole() *Role {
|
func NewEditorRole() *Role {
|
||||||
p := PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete
|
r := NewEditorLiteRole()
|
||||||
return &Role{
|
r.Name = RoleEditor
|
||||||
Name: RoleEditor,
|
r.ocsPermissions = PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
r.cS3ResourcePermissions.Delete = true
|
||||||
CreateContainer: true,
|
r.cS3ResourcePermissions.RestoreRecycleItem = true
|
||||||
Delete: true,
|
return r
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Move: true,
|
|
||||||
RestoreRecycleItem: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: p,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEditorListGrantsRole creates an editor role. `sharing` indicates if sharing permission should be added
|
// NewEditorListGrantsRole creates an editor role.
|
||||||
func NewEditorListGrantsRole() *Role {
|
func NewEditorListGrantsRole() *Role {
|
||||||
role := NewEditorRole()
|
r := NewEditorRole()
|
||||||
role.cS3ResourcePermissions.ListGrants = true
|
r.Name = RoleEditorListGrants
|
||||||
return role
|
r.cS3ResourcePermissions.ListGrants = true
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEditorListGrantsWithVersionsRole creates an editor role. `sharing` indicates if sharing permission should be added
|
// NewEditorListGrantsWithVersionsRole creates an editor role.
|
||||||
func NewEditorListGrantsWithVersionsRole() *Role {
|
func NewEditorListGrantsWithVersionsRole() *Role {
|
||||||
role := NewEditorListGrantsRole()
|
r := NewEditorListGrantsRole()
|
||||||
role.cS3ResourcePermissions.ListFileVersions = true
|
r.Name = RoleEditorListGrantsWithVersions
|
||||||
return role
|
r.cS3ResourcePermissions.ListFileVersions = true
|
||||||
|
r.cS3ResourcePermissions.RestoreFileVersion = true
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSpaceEditorRole creates an editor role
|
// Sharing File
|
||||||
func NewSpaceEditorRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleSpaceEditor,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
CreateContainer: true,
|
|
||||||
Delete: true,
|
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListFileVersions: true,
|
|
||||||
ListGrants: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Move: true,
|
|
||||||
RestoreFileVersion: true,
|
|
||||||
RestoreRecycleItem: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSpaceEditorWithoutVersionsRole creates an editor without list/restore versions role
|
|
||||||
func NewSpaceEditorWithoutVersionsRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleSpaceEditorWithoutVersions,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
CreateContainer: true,
|
|
||||||
Delete: true,
|
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListGrants: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Move: true,
|
|
||||||
RestoreRecycleItem: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSpaceEditorWithoutTrashbinRole creates an editor role without list/restore resources in trashbin on a space.
|
|
||||||
func NewSpaceEditorWithoutTrashbinRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleSpaceEditorWithoutTrashbin,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
CreateContainer: true,
|
|
||||||
Delete: true,
|
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListFileVersions: true,
|
|
||||||
ListGrants: true,
|
|
||||||
Move: true,
|
|
||||||
RestoreFileVersion: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFileEditorRole creates a file-editor role
|
// NewFileEditorRole creates a file-editor role
|
||||||
func NewFileEditorRole() *Role {
|
func NewFileEditorRole() *Role {
|
||||||
p := PermissionRead | PermissionWrite
|
r := NewViewerRole()
|
||||||
return &Role{
|
r.Name = RoleFileEditor
|
||||||
Name: RoleEditor,
|
r.ocsPermissions = PermissionRead | PermissionWrite
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
r.cS3ResourcePermissions.InitiateFileUpload = true
|
||||||
GetPath: true,
|
return r
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Stat: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
RestoreRecycleItem: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: p,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFileEditorListGrantsRole creates a file-editor role
|
// NewFileEditorListGrantsRole creates a file-editor role
|
||||||
func NewFileEditorListGrantsRole() *Role {
|
func NewFileEditorListGrantsRole() *Role {
|
||||||
role := NewFileEditorRole()
|
r := NewFileEditorRole()
|
||||||
role.cS3ResourcePermissions.ListGrants = true
|
r.Name = RoleFileEditorListGrants
|
||||||
return role
|
r.cS3ResourcePermissions.ListGrants = true
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFileEditorListGrantsWithVersionsRole creates a file-editor role
|
// NewFileEditorListGrantsWithVersionsRole creates a file-editor role
|
||||||
func NewFileEditorListGrantsWithVersionsRole() *Role {
|
func NewFileEditorListGrantsWithVersionsRole() *Role {
|
||||||
role := NewFileEditorListGrantsRole()
|
role := NewFileEditorListGrantsRole()
|
||||||
role.cS3ResourcePermissions.ListFileVersions = true
|
role.cS3ResourcePermissions.ListFileVersions = true
|
||||||
|
role.cS3ResourcePermissions.RestoreFileVersion = true
|
||||||
return role
|
return role
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCoownerRole creates a coowner role.
|
// Space Membership
|
||||||
|
|
||||||
|
// NewSpaceViewerRole creates a spaceviewer role
|
||||||
|
// FIXME: Same as ViewerListGrants
|
||||||
|
func NewSpaceViewerRole() *Role {
|
||||||
|
r := NewViewerRole()
|
||||||
|
r.Name = RoleSpaceViewer
|
||||||
|
r.cS3ResourcePermissions.ListGrants = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSpaceEditorWithoutVersionsRole creates an editor without list/restore versions role
|
||||||
|
func NewSpaceEditorWithoutVersionsRole() *Role {
|
||||||
|
r := NewSpaceViewerRole()
|
||||||
|
r.Name = RoleSpaceEditorWithoutVersions
|
||||||
|
r.cS3ResourcePermissions.CreateContainer = true
|
||||||
|
r.cS3ResourcePermissions.InitiateFileUpload = true
|
||||||
|
r.cS3ResourcePermissions.Move = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSpaceEditorWithoutTrashbinRole creates an editor role without list/restore resources in trashbin on a space.
|
||||||
|
func NewSpaceEditorWithoutTrashbinRole() *Role {
|
||||||
|
r := NewSpaceEditorWithoutVersionsRole()
|
||||||
|
r.Name = RoleSpaceEditorWithoutTrashbin
|
||||||
|
r.ocsPermissions = PermissionRead | PermissionCreate | PermissionWrite | PermissionDelete
|
||||||
|
r.cS3ResourcePermissions.ListFileVersions = true
|
||||||
|
r.cS3ResourcePermissions.RestoreFileVersion = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSpaceEditorRole creates an editor role
|
||||||
|
func NewSpaceEditorRole() *Role {
|
||||||
|
r := NewSpaceEditorWithoutTrashbinRole()
|
||||||
|
r.Name = RoleSpaceEditor
|
||||||
|
r.cS3ResourcePermissions.ListRecycle = true
|
||||||
|
r.cS3ResourcePermissions.Delete = true
|
||||||
|
r.cS3ResourcePermissions.RestoreRecycleItem = true
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewManagerRole creates an manager role
|
||||||
|
func NewManagerRole() *Role {
|
||||||
|
r := NewSpaceEditorRole()
|
||||||
|
r.Name = RoleManager
|
||||||
|
r.ocsPermissions = PermissionAll
|
||||||
|
r.cS3ResourcePermissions.PurgeRecycle = true
|
||||||
|
r.cS3ResourcePermissions.AddGrant = true // managers can add users to the space
|
||||||
|
r.cS3ResourcePermissions.RemoveGrant = true // managers can remove users from the space
|
||||||
|
r.cS3ResourcePermissions.UpdateGrant = true // managers can update user roles
|
||||||
|
r.cS3ResourcePermissions.DenyGrant = true // managers can deny access to sub folders
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCoownerRole creates a coowner role. NOT USED BY OCIS
|
||||||
func NewCoownerRole() *Role {
|
func NewCoownerRole() *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
Name: RoleCoowner,
|
Name: RoleCoowner,
|
||||||
@@ -424,24 +399,7 @@ func NewCoownerRole() *Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEditorLiteRole creates an editor-lite role
|
// NewUploaderRole creates an uploader role with no download permissions. NOT USED BY OCIS
|
||||||
func NewEditorLiteRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleEditorLite,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
Stat: true,
|
|
||||||
GetPath: true,
|
|
||||||
CreateContainer: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
ListContainer: true,
|
|
||||||
Move: true,
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionCreate,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewUploaderRole creates an uploader role with no download permissions
|
|
||||||
func NewUploaderRole() *Role {
|
func NewUploaderRole() *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
Name: RoleUploader,
|
Name: RoleUploader,
|
||||||
@@ -455,7 +413,7 @@ func NewUploaderRole() *Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNoneRole creates a role with no permissions
|
// NewNoneRole creates a role with no permissions NOT USED BY OCIS
|
||||||
func NewNoneRole() *Role {
|
func NewNoneRole() *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
Name: "none",
|
Name: "none",
|
||||||
@@ -464,49 +422,6 @@ func NewNoneRole() *Role {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManagerRole creates an manager role
|
|
||||||
func NewManagerRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleManager,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
GetPath: true,
|
|
||||||
GetQuota: true,
|
|
||||||
InitiateFileDownload: true,
|
|
||||||
ListGrants: true,
|
|
||||||
ListContainer: true,
|
|
||||||
ListFileVersions: true,
|
|
||||||
ListRecycle: true,
|
|
||||||
Stat: true,
|
|
||||||
InitiateFileUpload: true,
|
|
||||||
RestoreFileVersion: true,
|
|
||||||
RestoreRecycleItem: true,
|
|
||||||
Move: true,
|
|
||||||
CreateContainer: true,
|
|
||||||
Delete: true,
|
|
||||||
PurgeRecycle: true,
|
|
||||||
|
|
||||||
// these permissions only make sense to enforce them in the root of the storage space.
|
|
||||||
AddGrant: true, // managers can add users to the space
|
|
||||||
RemoveGrant: true, // managers can remove users from the space
|
|
||||||
UpdateGrant: true,
|
|
||||||
DenyGrant: true, // managers can deny access to sub folders
|
|
||||||
},
|
|
||||||
ocsPermissions: PermissionAll,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSecureViewerRole creates a secure viewer role
|
|
||||||
func NewSecureViewerRole() *Role {
|
|
||||||
return &Role{
|
|
||||||
Name: RoleSecureViewer,
|
|
||||||
cS3ResourcePermissions: &provider.ResourcePermissions{
|
|
||||||
GetPath: true,
|
|
||||||
ListContainer: true,
|
|
||||||
Stat: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// RoleFromOCSPermissions tries to map ocs permissions to a role
|
// RoleFromOCSPermissions tries to map ocs permissions to a role
|
||||||
// TODO: rethink using this. ocs permissions cannot be assigned 1:1 to roles
|
// TODO: rethink using this. ocs permissions cannot be assigned 1:1 to roles
|
||||||
func RoleFromOCSPermissions(p Permissions, ri *provider.ResourceInfo) *Role {
|
func RoleFromOCSPermissions(p Permissions, ri *provider.ResourceInfo) *Role {
|
||||||
|
|||||||
Generated
Vendored
+4
-1
@@ -27,10 +27,10 @@ import (
|
|||||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||||
|
"github.com/jellydator/ttlcache/v2"
|
||||||
"github.com/owncloud/reva/v2/pkg/conversions"
|
"github.com/owncloud/reva/v2/pkg/conversions"
|
||||||
"github.com/owncloud/reva/v2/pkg/rgrpc/status"
|
"github.com/owncloud/reva/v2/pkg/rgrpc/status"
|
||||||
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
|
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
|
||||||
"github.com/jellydator/ttlcache/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DBShare stores information about user and public shares.
|
// DBShare stores information about user and public shares.
|
||||||
@@ -157,6 +157,9 @@ func sharePermToInt(p *provider.ResourcePermissions) int {
|
|||||||
func intTosharePerm(p int) (*provider.ResourcePermissions, error) {
|
func intTosharePerm(p int) (*provider.ResourcePermissions, error) {
|
||||||
perms, err := conversions.NewPermissions(p)
|
perms, err := conversions.NewPermissions(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == conversions.ErrZeroPermission {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-1
@@ -1313,7 +1313,7 @@ github.com/orcaman/concurrent-map
|
|||||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
|
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/owncloud/libre-graph-api-go
|
github.com/owncloud/libre-graph-api-go
|
||||||
# github.com/owncloud/reva/v2 v2.0.0-20260116122933-81e6e21256eb
|
# github.com/owncloud/reva/v2 v2.0.0-20260116122933-81e6e21256eb => github.com/kobergj/reva/v2 v2.26.3-0.20260122145036-d6e50a1a1b8c
|
||||||
## explicit; go 1.24.0
|
## explicit; go 1.24.0
|
||||||
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
||||||
github.com/owncloud/reva/v2/cmd/revad/runtime
|
github.com/owncloud/reva/v2/cmd/revad/runtime
|
||||||
@@ -2557,3 +2557,4 @@ stash.kopano.io/kgol/rndm
|
|||||||
# github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c
|
# github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c
|
||||||
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90
|
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90
|
||||||
# go-micro.dev/v4 => github.com/kobergj/go-micro/v4 v4.0.0-20250610135441-d0b187215699
|
# go-micro.dev/v4 => github.com/kobergj/go-micro/v4 v4.0.0-20250610135441-d0b187215699
|
||||||
|
# github.com/owncloud/reva/v2 => github.com/kobergj/reva/v2 v2.26.3-0.20260122145036-d6e50a1a1b8c
|
||||||
Reference in new issue
Block a user