Also make other shares listen to the "Allow sharing with groups"
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
8fcc0e8d8c
commit
064b8a0c08
|
@ -198,7 +198,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
||||||
}
|
}
|
||||||
// If sharing is disabled, return the empty array
|
// If sharing is disabled, return the empty array
|
||||||
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
||||||
if (!$shareAPIEnabled) {
|
if (!$shareAPIEnabled || !$this->shareManager->allowGroupSharing()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
||||||
public function findByUri($uri, $principalPrefix) {
|
public function findByUri($uri, $principalPrefix) {
|
||||||
// If sharing is disabled, return the empty array
|
// If sharing is disabled, return the empty array
|
||||||
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
||||||
if (!$shareAPIEnabled) {
|
if (!$shareAPIEnabled || !$this->shareManager->allowGroupSharing()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,9 @@ class ShareesAPIController extends OCSController {
|
||||||
$shareTypes[] = IShare::TYPE_DECK;
|
$shareTypes[] = IShare::TYPE_DECK;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$shareTypes[] = IShare::TYPE_GROUP;
|
if ($this->shareManager->allowGroupSharing()) {
|
||||||
|
$shareTypes[] = IShare::TYPE_GROUP;
|
||||||
|
}
|
||||||
$shareTypes[] = IShare::TYPE_EMAIL;
|
$shareTypes[] = IShare::TYPE_EMAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,14 @@ use OCP\IUserSession;
|
||||||
use OCP\Share\IShare;
|
use OCP\Share\IShare;
|
||||||
|
|
||||||
class GroupPlugin implements ISearchPlugin {
|
class GroupPlugin implements ISearchPlugin {
|
||||||
|
/** @var bool */
|
||||||
protected $shareeEnumeration;
|
protected $shareeEnumeration;
|
||||||
|
/** @var bool */
|
||||||
protected $shareWithGroupOnly;
|
protected $shareWithGroupOnly;
|
||||||
|
/** @var bool */
|
||||||
|
protected $shareeEnumerationInGroupOnly;
|
||||||
|
/** @var bool */
|
||||||
|
protected $groupSharingDisabled;
|
||||||
|
|
||||||
/** @var IGroupManager */
|
/** @var IGroupManager */
|
||||||
private $groupManager;
|
private $groupManager;
|
||||||
|
@ -56,9 +62,14 @@ class GroupPlugin implements ISearchPlugin {
|
||||||
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
|
$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->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->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) {
|
public function search($search, $limit, $offset, ISearchResult $searchResult) {
|
||||||
|
if ($this->groupSharingDisabled) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$hasMoreResults = false;
|
$hasMoreResults = false;
|
||||||
$result = ['wide' => [], 'exact' => []];
|
$result = ['wide' => [], 'exact' => []];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue