Skip to content

Commit

Permalink
Also make other shares listen to the "Allow sharing with groups"
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and tcitworld committed Feb 15, 2021
1 parent 9929add commit f46013c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public function search(string $search = '', string $itemType = null, int $page =
$shareTypes[] = IShare::TYPE_DECK;
}
} else {
$shareTypes[] = IShare::TYPE_GROUP;
if ($this->shareManager->allowGroupSharing()) {
$shareTypes[] = IShare::TYPE_GROUP;
}
$shareTypes[] = IShare::TYPE_EMAIL;
}

Expand Down
11 changes: 11 additions & 0 deletions lib/private/Collaboration/Collaborators/GroupPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
use OCP\Share\IShare;

class GroupPlugin implements ISearchPlugin {
/** @var bool */
protected $shareeEnumeration;
/** @var bool */
protected $shareWithGroupOnly;
/** @var bool */
protected $shareeEnumerationInGroupOnly;
/** @var bool */
protected $groupSharingDisabled;

/** @var IGroupManager */
private $groupManager;
Expand All @@ -56,9 +62,14 @@ public function __construct(IConfig $config, IGroupManager $groupManager, IUserS
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
$this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
$this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes';
$this->groupSharingDisabled = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'no';
}

public function search($search, $limit, $offset, ISearchResult $searchResult) {
if ($this->groupSharingDisabled) {
return false;
}

$hasMoreResults = false;
$result = ['wide' => [], 'exact' => []];

Expand Down

0 comments on commit f46013c

Please sign in to comment.