Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
only determine is sharing is disabled for a user once
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Aug 16, 2018
commit 720b27d60b330a4752366327ec2ee42e2899b3ec
4 changes: 3 additions & 1 deletion apps/files_sharing/lib/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
$mounts = [];
$view = new View('/' . $user->getUID() . '/files');
$ownerViews = [];
$sharingDisabledForUser = $this->shareManager->sharingDisabledForUser($user->getUID());
foreach ($superShares as $share) {
try {
/** @var \OCP\Share\IShare $parentShare */
Expand All @@ -104,7 +105,8 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
'superShare' => $parentShare,
// children/component of the superShare
'groupedShares' => $share[1],
'ownerView' => $ownerViews[$owner]
'ownerView' => $ownerViews[$owner],
'sharingDisabledForUser' => $sharingDisabledForUser
],
$storageFactory,
$view
Expand Down
10 changes: 9 additions & 1 deletion apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto

private $options;

/** @var boolean */
private $sharingDisabledForUser;

public function __construct($arguments) {
$this->ownerView = $arguments['ownerView'];
$this->logger = \OC::$server->getLogger();
Expand All @@ -87,6 +90,11 @@ public function __construct($arguments) {
$this->groupedShares = $arguments['groupedShares'];

$this->user = $arguments['user'];
if (isset($arguments['sharingDisabledForUser'])) {
$this->sharingDisabledForUser = $arguments['sharingDisabledForUser'];
} else {
$this->sharingDisabledForUser = false;
}

parent::__construct([
'storage' => null,
Expand Down Expand Up @@ -193,7 +201,7 @@ public function getPermissions($target = '') {
$permissions |= \OCP\Constants::PERMISSION_DELETE;
}

if (\OCP\Util::isSharingDisabledForUser()) {
if ($this->sharingDisabledForUser) {
$permissions &= ~\OCP\Constants::PERMISSION_SHARE;
}

Expand Down