fix: make use of ResourcePermissions getters

This commit is contained in:
Florian Schade
2024-03-27 16:02:44 +01:00
parent 66b29dcf5b
commit 25b40cf7a3
+19 -19
View File
@@ -336,61 +336,61 @@ func PermissionsToCS3ResourcePermissions(unifiedRolePermissions []*libregraph.Un
// CS3ResourcePermissionsToLibregraphActions converts the provided cs3 ResourcePermissions to a list of
// libregraph actions
func CS3ResourcePermissionsToLibregraphActions(p provider.ResourcePermissions) (actions []string) {
if p.AddGrant {
if p.GetAddGrant() {
actions = append(actions, DriveItemPermissionsCreate)
}
if p.CreateContainer {
if p.GetCreateContainer() {
actions = append(actions, DriveItemChildrenCreate)
}
if p.Delete {
if p.GetDelete() {
actions = append(actions, DriveItemStandardDelete)
}
if p.GetPath {
if p.GetGetPath() {
actions = append(actions, DriveItemPathRead)
}
if p.GetQuota {
if p.GetGetQuota() {
actions = append(actions, DriveItemQuotaRead)
}
if p.InitiateFileDownload {
if p.GetInitiateFileDownload() {
actions = append(actions, DriveItemContentRead)
}
if p.InitiateFileUpload {
if p.GetInitiateFileUpload() {
actions = append(actions, DriveItemUploadCreate)
}
if p.ListGrants {
if p.GetListGrants() {
actions = append(actions, DriveItemPermissionsRead)
}
if p.ListContainer {
if p.GetListContainer() {
actions = append(actions, DriveItemChildrenRead)
}
if p.ListFileVersions {
if p.GetListFileVersions() {
actions = append(actions, DriveItemVersionsRead)
}
if p.ListRecycle {
if p.GetListRecycle() {
actions = append(actions, DriveItemDeletedRead)
}
if p.Move {
if p.GetMove() {
actions = append(actions, DriveItemPathUpdate)
}
if p.RemoveGrant {
if p.GetRemoveGrant() {
actions = append(actions, DriveItemPermissionsDelete)
}
if p.PurgeRecycle {
if p.GetPurgeRecycle() {
actions = append(actions, DriveItemDeletedDelete)
}
if p.RestoreFileVersion {
if p.GetRestoreFileVersion() {
actions = append(actions, DriveItemVersionsUpdate)
}
if p.RestoreRecycleItem {
if p.GetRestoreRecycleItem() {
actions = append(actions, DriveItemDeletedUpdate)
}
if p.Stat {
if p.GetStat() {
actions = append(actions, DriveItemBasicRead)
}
if p.UpdateGrant {
if p.GetUpdateGrant() {
actions = append(actions, DriveItemPermissionsUpdate)
}
if p.DenyGrant {
if p.GetDenyGrant() {
actions = append(actions, DriveItemPermissionsDeny)
}
return actions