summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-01 12:01:43 +0200
committerGitHub <noreply@github.com>2018-06-01 12:01:43 +0200
commit5c92da22694805cf36842f5dbfebbaf09308354d (patch)
treedff183e7fe371b46fdfec33b668d5542f66f8711 /apps/dav/lib/Connector
parent3595aa68b93150d9aac4a450c4fd0635c1db66dd (diff)
parent08ad45e40b597ce82309b32e608817441dd5ff39 (diff)
downloadnextcloud-server-5c92da22694805cf36842f5dbfebbaf09308354d.tar.gz
nextcloud-server-5c92da22694805cf36842f5dbfebbaf09308354d.zip
Merge pull request #9707 from nextcloud/bugfix-stable13/noid/override_freebusy_sharing_rules
[stable13] allow admins to override FreeBusy capabilities without modifying ShareAPI capabilities
Diffstat (limited to 'apps/dav/lib/Connector')
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 250d67aafd1..18893c9cbe5 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -30,6 +30,7 @@
namespace OCA\DAV\Connector\Sabre;
+use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
@@ -55,6 +56,9 @@ class Principal implements BackendInterface {
/** @var IUserSession */
private $userSession;
+ /** @var IConfig */
+ private $config;
+
/** @var string */
private $principalPrefix;
@@ -66,17 +70,20 @@ class Principal implements BackendInterface {
* @param IGroupManager $groupManager
* @param IShareManager $shareManager
* @param IUserSession $userSession
+ * @param IConfig $config
* @param string $principalPrefix
*/
public function __construct(IUserManager $userManager,
IGroupManager $groupManager,
IShareManager $shareManager,
IUserSession $userSession,
+ IConfig $config,
$principalPrefix = 'principals/users/') {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->shareManager = $shareManager;
$this->userSession = $userSession;
+ $this->config = $config;
$this->principalPrefix = trim($principalPrefix, '/');
$this->hasGroups = ($principalPrefix === 'principals/users/');
}
@@ -206,8 +213,10 @@ class Principal implements BackendInterface {
protected function searchUserPrincipals(array $searchProperties, $test = 'allof') {
$results = [];
- // If sharing is disabled, return the empty array
- if (!$this->shareManager->shareApiEnabled()) {
+ // If sharing is disabled (or FreeBusy was disabled on purpose), return the empty array
+ $shareAPIEnabled = $this->shareManager->shareApiEnabled();
+ $disableFreeBusy = $this->config->getAppValue('dav', 'disableFreeBusy', $shareAPIEnabled ? 'no' : 'yes');
+ if ($disableFreeBusy === 'yes') {
return [];
}
@@ -290,8 +299,10 @@ class Principal implements BackendInterface {
* @return string
*/
function findByUri($uri, $principalPrefix) {
- // If sharing is disabled, return null as in user not found
- if (!$this->shareManager->shareApiEnabled()) {
+ // If sharing is disabled (or FreeBusy was disabled on purpose), return the empty array
+ $shareAPIEnabled = $this->shareManager->shareApiEnabled();
+ $disableFreeBusy = $this->config->getAppValue('dav', 'disableFreeBusy', $shareAPIEnabled ? 'no' : 'yes');
+ if ($disableFreeBusy === 'yes') {
return null;
}