diff options
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Command/CreateCalendar.php | 3 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 19 | ||||
-rw-r--r-- | apps/dav/lib/RootCollection.php | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php index 1cbd7b60944..45dd9ba941a 100644 --- a/apps/dav/lib/Command/CreateCalendar.php +++ b/apps/dav/lib/Command/CreateCalendar.php @@ -77,7 +77,8 @@ class CreateCalendar extends Command { $this->userManager, $this->groupManager, \OC::$server->getShareManager(), - \OC::$server->getUserSession() + \OC::$server->getUserSession(), + \OC::$server->getConfig() ); $random = \OC::$server->getSecureRandom(); $logger = \OC::$server->getLogger(); diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index b2f57cf715c..92b3bccb69f 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; @@ -54,6 +55,9 @@ class Principal implements BackendInterface { /** @var IUserSession */ private $userSession; + /** @var IConfig */ + private $config; + /** @var string */ private $principalPrefix; @@ -65,17 +69,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/'); } @@ -205,8 +212,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 []; } @@ -289,8 +298,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; } diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index a39b8716110..b9f381b4b92 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -51,7 +51,8 @@ class RootCollection extends SimpleCollection { $userManager, $groupManager, $shareManager, - \OC::$server->getUserSession() + \OC::$server->getUserSession(), + $config ); $groupPrincipalBackend = new GroupPrincipalBackend($groupManager); // as soon as debug mode is enabled we allow listing of principals |