Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
Signed-off-by: Marino Faggiana <[email protected]>
  • Loading branch information
marinofaggiana committed Jun 5, 2024
1 parent b9c8fdb commit dacd936
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions iOSClient/Menu/NCShare+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extension NCShare {
on: false,
action: { _ in
let canShare = permissions.isPermissionToCanShare(tableShare.permissions)
let permissions = permissions.getPermission(canEdit: false, canCreate: false, canChange: false, canDelete: false, canShare: canShare, isFolder: isDirectory)
let permissions = permissions.getPermission(canEdit: false, canCreate: false, canChange: false, canDelete: false, canShare: canShare, isDirectory: isDirectory)
self.updateSharePermissions(share: tableShare, permissions: permissions)
}
)
Expand All @@ -112,7 +112,7 @@ extension NCShare {
on: false,
action: { _ in
let canShare = permissions.isPermissionToCanShare(tableShare.permissions)
let permissions = permissions.getPermission(canEdit: true, canCreate: true, canChange: true, canDelete: true, canShare: canShare, isFolder: isDirectory)
let permissions = permissions.getPermission(canEdit: true, canCreate: true, canChange: true, canDelete: true, canShare: canShare, isDirectory: isDirectory)
self.updateSharePermissions(share: tableShare, permissions: permissions)
}
)
Expand Down
6 changes: 3 additions & 3 deletions iOSClient/Share/Advanced/NCShareCells.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ enum NCLinkPermission: NCPermission {
canChange: true,
canDelete: true,
canShare: false,
isFolder: false)
isDirectory: false)
case .viewOnly:
return NCPermissions().getPermission(
canEdit: false,
Expand All @@ -141,15 +141,15 @@ enum NCLinkPermission: NCPermission {
// not possible to create "read-only" shares without reshare option
// https://github.com/nextcloud/server/blame/f99876997a9119518fe5f7ad3a3a51d33459d4cc/apps/files_sharing/lib/Controller/ShareAPIController.php#L1104-L1107
canShare: true,
isFolder: true)
isDirectory: true)
case .uploadEdit:
return NCPermissions().getPermission(
canEdit: true,
canCreate: true,
canChange: true,
canDelete: true,
canShare: false,
isFolder: true)
isDirectory: true)
case .fileDrop:
return NCPermissions().permissionCreateShare
case .secureFileDrop:
Expand Down
10 changes: 5 additions & 5 deletions iOSClient/Share/NCPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ class NCPermissions: NSObject {
let canChange = isPermissionToCanChange(permission)
return canCreate && canChange && canRead
}
func getPermission(canEdit: Bool, canCreate: Bool, canChange: Bool, canDelete: Bool, canShare: Bool, isFolder: Bool) -> Int {
func getPermission(canEdit: Bool, canCreate: Bool, canChange: Bool, canDelete: Bool, canShare: Bool, isDirectory: Bool) -> Int {
var permission = permissionReadShare

if canEdit && !isFolder {
if canEdit && !isDirectory {
permission = permission + permissionUpdateShare
}
if canCreate && isFolder {
if canCreate && isDirectory {
permission = permission + permissionCreateShare
}
if canChange && isFolder {
if canChange && isDirectory {
permission = permission + permissionUpdateShare
}
if canDelete && isFolder {
if canDelete && isDirectory {
permission = permission + permissionDeleteShare
}
if canShare {
Expand Down

0 comments on commit dacd936

Please sign in to comment.