summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-05-22 15:09:21 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-05-31 18:55:55 +0200
commit08ad45e40b597ce82309b32e608817441dd5ff39 (patch)
treece4306d031ae9de2e2d39ebf0129c77e647168f7 /apps/dav/lib/Connector
parentcc6317f2afb4ff4022297f6611d3cec5f57011f8 (diff)
downloadnextcloud-server-08ad45e40b597ce82309b32e608817441dd5ff39.tar.gz
nextcloud-server-08ad45e40b597ce82309b32e608817441dd5ff39.zip
allow admins to override FreeBusy capabilities without modifying ShareAPI capabilities
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
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 06fb10f7e2c..b4527b9d21f 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;
}