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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-11-02 01:18:44 +0300
committerMorris Jobke <hey@morrisjobke.de>2018-11-02 12:49:42 +0300
commit248d95339d67f05cc0d05d9963750edc2af65f66 (patch)
tree61774ce203bf5fe3b91aa2830a6d4634a69e3065
parent35e3d40e803653e2fdfcd775eefc2d8a9a183d80 (diff)
Cleanup some unused sharing methods from the old sharing code
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--lib/private/Settings/Admin/Sharing.php9
-rw-r--r--lib/private/Share/Share.php20
-rw-r--r--tests/lib/Settings/Admin/SharingTest.php7
3 files changed, 14 insertions, 22 deletions
diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php
index dfc0b11478b..ee6a64c85bf 100644
--- a/lib/private/Settings/Admin/Sharing.php
+++ b/lib/private/Settings/Admin/Sharing.php
@@ -32,6 +32,7 @@ use OCP\Constants;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Settings\ISettings;
+use OCP\Share\IManager;
use OCP\Util;
class Sharing implements ISettings {
@@ -41,12 +42,16 @@ class Sharing implements ISettings {
/** @var IL10N */
private $l;
+ /** @var IManager */
+ private $shareManager;
+
/**
* @param IConfig $config
*/
- public function __construct(IConfig $config, IL10N $l) {
+ public function __construct(IConfig $config, IL10N $l, IManager $shareManager) {
$this->config = $config;
$this->l = $l;
+ $this->shareManager = $shareManager;
}
/**
@@ -65,7 +70,7 @@ class Sharing implements ISettings {
'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
'enforceLinkPassword' => Util::isPublicLinkPasswordRequired(),
- 'onlyShareWithGroupMembers' => Share::shareWithGroupMembersOnly(),
+ 'onlyShareWithGroupMembers' => $this->shareManager->shareWithGroupMembersOnly(),
'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'),
'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'),
'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'),
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 36912dcafe3..76a6a1baeca 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -341,7 +341,7 @@ class Share extends Constants {
}
$uidOwner = \OC_User::getUser();
- $shareWithinGroupOnly = self::shareWithGroupMembersOnly();
+ $shareWithinGroupOnly = \OC::$server->getConfig()->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
if (is_null($itemSourceName)) {
$itemSourceName = $itemSource;
@@ -2055,15 +2055,6 @@ class Share extends Constants {
}
/**
- * check if user can only share with group members
- * @return bool
- */
- public static function shareWithGroupMembersOnly() {
- $value = \OC::$server->getConfig()->getAppValue('core', 'shareapi_only_share_with_group_members', 'no');
- return $value === 'yes';
- }
-
- /**
* @return bool
*/
public static function isDefaultExpireDateEnabled() {
@@ -2104,15 +2095,6 @@ class Share extends Constants {
}
/**
- * @param IConfig $config
- * @return bool
- */
- public static function enforcePassword(IConfig $config) {
- $enforcePassword = $config->getAppValue('core', 'shareapi_enforce_links_password', 'no');
- return $enforcePassword === 'yes';
- }
-
- /**
* @param string $password
* @throws \Exception
*/
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php
index 79065fb8d21..c97f22e54b6 100644
--- a/tests/lib/Settings/Admin/SharingTest.php
+++ b/tests/lib/Settings/Admin/SharingTest.php
@@ -28,6 +28,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\Constants;
use OCP\IConfig;
use OCP\IL10N;
+use OCP\Share\IManager;
use Test\TestCase;
class SharingTest extends TestCase {
@@ -37,15 +38,19 @@ class SharingTest extends TestCase {
private $config;
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
private $l10n;
+ /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
+ private $shareManager;
public function setUp() {
parent::setUp();
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
$this->admin = new Sharing(
$this->config,
- $this->l10n
+ $this->l10n,
+ $this->shareManager
);
}