Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Storch <henrik.storch@nextcloud.com>2022-03-29 15:49:36 +0300
committerHenrik Storch <henrik.storch@nextcloud.com>2022-04-28 08:14:35 +0300
commit6df4786156546b4464840099de153f1b80e8e117 (patch)
tree5a884d49215e777cc61fbefa89dbd7d702f02973
parenta427bceb85713c713634f839113693497216f47d (diff)
Fix share permission with restricted reshare permissions
- Don't allow creating shares if reshaping is disabled Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
-rw-r--r--iOSClient/Menu/NCShare+Menu.swift2
-rw-r--r--iOSClient/Share/Advanced/NCShareAdvancePermission.swift6
-rw-r--r--iOSClient/Share/NCShare.storyboard4
-rw-r--r--iOSClient/Share/NCShare.swift17
-rw-r--r--iOSClient/Supporting Files/en.lproj/Localizable.strings3
5 files changed, 24 insertions, 8 deletions
diff --git a/iOSClient/Menu/NCShare+Menu.swift b/iOSClient/Menu/NCShare+Menu.swift
index 5aeaade22..15a6193af 100644
--- a/iOSClient/Menu/NCShare+Menu.swift
+++ b/iOSClient/Menu/NCShare+Menu.swift
@@ -28,7 +28,7 @@ extension NCShare {
var actions = [NCMenuAction]()
- if share.shareType == 3 {
+ if share.shareType == 3, canReshare {
actions.append(
NCMenuAction(
title: NSLocalizedString("_share_add_sharelink_", comment: ""),
diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift
index daed73048..d9cba692d 100644
--- a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift
+++ b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift
@@ -99,7 +99,9 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
- return shareConfig.parentPermission != 31 ? shareConfig.permissions.count + 1 : shareConfig.permissions.count
+ // check reshare permission, if restricted add note
+ let maxPermission = metadata.directory ? NCGlobal.shared.permissionMaxFolderShare : NCGlobal.shared.permissionMaxFileShare
+ return shareConfig.parentPermission != maxPermission ? shareConfig.permissions.count + 1 : shareConfig.permissions.count
} else if section == 1 {
return shareConfig.advanced.count
} else { return 0 }
@@ -108,7 +110,7 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = shareConfig.cellFor(indexPath: indexPath) else {
let noteCell = UITableViewCell(style: .subtitle, reuseIdentifier: "noteCell")
- noteCell.detailTextLabel?.text = "Reshare permissions restricted"
+ noteCell.detailTextLabel?.text = NSLocalizedString("_share_reshare_restricted_", comment: "")
noteCell.detailTextLabel?.isEnabled = false
noteCell.isUserInteractionEnabled = false
return noteCell
diff --git a/iOSClient/Share/NCShare.storyboard b/iOSClient/Share/NCShare.storyboard
index d7829400c..f2bb0836d 100644
--- a/iOSClient/Share/NCShare.storyboard
+++ b/iOSClient/Share/NCShare.storyboard
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
<device id="retina5_5" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
diff --git a/iOSClient/Share/NCShare.swift b/iOSClient/Share/NCShare.swift
index d5b9aee1b..f32d04a02 100644
--- a/iOSClient/Share/NCShare.swift
+++ b/iOSClient/Share/NCShare.swift
@@ -49,6 +49,11 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
public var sharingEnabled = true
public var height: CGFloat = 0
+ var canReshare: Bool {
+ guard let metadata = metadata else { return true }
+ return ((metadata.sharePermissionsCollaborationServices & NCGlobal.shared.permissionShareShare) != 0)
+ }
+
var shares: (firstShareLink: tableShare?, share: [tableShare]?) = (nil, nil)
private var dropDown = DropDown()
@@ -111,13 +116,18 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
func checkSharedWithYou() {
guard let appDelegate = self.appDelegate, let metadata = metadata, !metadata.ownerId.isEmpty, metadata.ownerId != appDelegate.userId else { return }
+ if !canReshare {
+ searchField.isEnabled = false
+ searchField.placeholder = NSLocalizedString("_share_reshare_disabled_", comment: "")
+ }
+
searchFieldTopConstraint.constant = 65
sharedWithYouByView.isHidden = false
sharedWithYouByLabel.text = NSLocalizedString("_shared_with_you_by_", comment: "") + " " + metadata.ownerDisplayName
sharedWithYouByImage.image = NCUtility.shared.loadUserImage(
for: metadata.ownerId,
- displayName: metadata.ownerDisplayName,
- userBaseUrl: appDelegate)
+ displayName: metadata.ownerDisplayName,
+ userBaseUrl: appDelegate)
let shareAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))
sharedWithYouByImage.addGestureRecognizer(shareAction)
let shareLabelAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))
@@ -289,7 +299,8 @@ extension NCShare: UITableViewDataSource {
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- guard section != 0 else { return 2 }
+ // don't allow link creation if reshare is disabled
+ guard section != 0 else { return shares.firstShareLink != nil || canReshare ? 2 : 1 }
return shares.share?.count ?? 0
}
diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings
index 9bd2fd3cc..b9d96955c 100644
--- a/iOSClient/Supporting Files/en.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings
@@ -611,6 +611,9 @@
"_share_unshare_" = "Unshare";
"_share_internal_link_" = "Internal link";
"_share_internal_link_des_" = "Only works for users with access to this folder";
+"_share_reshare_disabled_" = "You are not allowed to reshare this file / folder";
+"_share_reshare_restricted_" = "Note: You only have limited prmission to reshare this file / folder";
+
"_no_transfer_" = "No transfers yet";
"_no_transfer_sub_" = "Uploads and downloads from this device will show up here";
"_no_activity_" = "No activity yet";