Revert "Explicitly add the current principal to the acl in case of group sharing"
This reverts commit 52f4acf23d
.
This commit is contained in:
parent
cfe0a6450e
commit
b6fb3148c2
|
@ -27,7 +27,6 @@ use OCA\DAV\CardDAV\CardDavBackend;
|
||||||
use OCA\DAV\CardDAV\ContactsManager;
|
use OCA\DAV\CardDAV\ContactsManager;
|
||||||
use OCA\DAV\CardDAV\SyncJob;
|
use OCA\DAV\CardDAV\SyncJob;
|
||||||
use OCA\DAV\CardDAV\SyncService;
|
use OCA\DAV\CardDAV\SyncService;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCA\DAV\HookManager;
|
use OCA\DAV\HookManager;
|
||||||
use OCA\Dav\Migration\AddressBookAdapter;
|
use OCA\Dav\Migration\AddressBookAdapter;
|
||||||
use OCA\Dav\Migration\CalendarAdapter;
|
use OCA\Dav\Migration\CalendarAdapter;
|
||||||
|
@ -84,8 +83,7 @@ class Application extends App {
|
||||||
$c->getServer()->getUserManager(),
|
$c->getServer()->getUserManager(),
|
||||||
$c->getServer()->getGroupManager()
|
$c->getServer()->getGroupManager()
|
||||||
);
|
);
|
||||||
$groupPrincipal = new GroupPrincipalBackend($c->getServer()->getGroupManager());
|
return new CardDavBackend($db, $principal, $dispatcher);
|
||||||
return new CardDavBackend($db, $principal, $groupPrincipal, $dispatcher);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('CalDavBackend', function($c) {
|
$container->registerService('CalDavBackend', function($c) {
|
||||||
|
@ -95,8 +93,7 @@ class Application extends App {
|
||||||
$c->getServer()->getUserManager(),
|
$c->getServer()->getUserManager(),
|
||||||
$c->getServer()->getGroupManager()
|
$c->getServer()->getGroupManager()
|
||||||
);
|
);
|
||||||
$groupPrincipal = new GroupPrincipalBackend($c->getServer()->getGroupManager());
|
return new CalDavBackend($db, $principal);
|
||||||
return new CalDavBackend($db, $principal, $groupPrincipal);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('MigrateAddressbooks', function($c) {
|
$container->registerService('MigrateAddressbooks', function($c) {
|
||||||
|
@ -220,7 +217,7 @@ class Application extends App {
|
||||||
$migration = $this->getContainer()->query('BirthdayService');
|
$migration = $this->getContainer()->query('BirthdayService');
|
||||||
$userManager = $this->getContainer()->getServer()->getUserManager();
|
$userManager = $this->getContainer()->getServer()->getUserManager();
|
||||||
|
|
||||||
$userManager->callForAllUsers(function ($user) use ($migration) {
|
$userManager->callForAllUsers(function($user) use($migration) {
|
||||||
/** @var IUser $user */
|
/** @var IUser $user */
|
||||||
$migration->syncUser($user->getUID());
|
$migration->syncUser($user->getUID());
|
||||||
});
|
});
|
||||||
|
@ -228,11 +225,4 @@ class Application extends App {
|
||||||
$this->getContainer()->getServer()->getLogger()->logException($ex);
|
$this->getContainer()->getServer()->getLogger()->logException($ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return CardDavBackend
|
|
||||||
*/
|
|
||||||
public function getCardDavBackend() {
|
|
||||||
return $this->getContainer()->query('CardDavBackend');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ $app = new Application();
|
||||||
|
|
||||||
/** @var Symfony\Component\Console\Application $application */
|
/** @var Symfony\Component\Console\Application $application */
|
||||||
$application->add(new CreateCalendar($userManager, $groupManager, $dbConnection));
|
$application->add(new CreateCalendar($userManager, $groupManager, $dbConnection));
|
||||||
$application->add(new CreateAddressBook($userManager, $app->getCardDavBackend()));
|
$application->add(new CreateAddressBook($userManager, $app->getContainer()->query('CardDavBackend')));
|
||||||
$application->add(new SyncSystemAddressBook($app->getSyncService()));
|
$application->add(new SyncSystemAddressBook($app->getSyncService()));
|
||||||
$application->add(new SyncBirthdayCalendar($userManager, $app->getContainer()->query('BirthdayService')));
|
$application->add(new SyncBirthdayCalendar($userManager, $app->getContainer()->query('BirthdayService')));
|
||||||
$application->add(new MigrateAddressbooks($userManager, $app->getContainer()->query('MigrateAddressbooks')));
|
$application->add(new MigrateAddressbooks($userManager, $app->getContainer()->query('MigrateAddressbooks')));
|
||||||
|
|
|
@ -29,7 +29,6 @@ use OCA\DAV\Connector\Sabre\Auth;
|
||||||
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
|
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
|
||||||
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
|
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
|
|
||||||
$authBackend = new Auth(
|
$authBackend = new Auth(
|
||||||
\OC::$server->getSession(),
|
\OC::$server->getSession(),
|
||||||
|
@ -43,8 +42,7 @@ $principalBackend = new Principal(
|
||||||
'principals/'
|
'principals/'
|
||||||
);
|
);
|
||||||
$db = \OC::$server->getDatabaseConnection();
|
$db = \OC::$server->getDatabaseConnection();
|
||||||
$groupPrincipal = new GroupPrincipalBackend(\OC::$server->getGroupManager());
|
$calDavBackend = new CalDavBackend($db, $principalBackend);
|
||||||
$calDavBackend = new CalDavBackend($db, $principalBackend, $groupPrincipal);
|
|
||||||
|
|
||||||
// Root nodes
|
// Root nodes
|
||||||
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
|
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
|
||||||
|
|
|
@ -42,14 +42,14 @@ $principalBackend = new Principal(
|
||||||
'principals/'
|
'principals/'
|
||||||
);
|
);
|
||||||
$db = \OC::$server->getDatabaseConnection();
|
$db = \OC::$server->getDatabaseConnection();
|
||||||
$app = new \OCA\Dav\AppInfo\Application();
|
$cardDavBackend = new CardDavBackend($db, $principalBackend);
|
||||||
|
|
||||||
// Root nodes
|
// Root nodes
|
||||||
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
|
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
|
||||||
$principalCollection->disableListing = true; // Disable listing
|
$principalCollection->disableListing = true; // Disable listing
|
||||||
|
|
||||||
$addressBookRoot = new AddressBookRoot($principalBackend, $app->getCardDavBackend());
|
$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend);
|
||||||
$addressBookRoot->disableListing = false; // Disable listing
|
$addressBookRoot->disableListing = true; // Disable listing
|
||||||
|
|
||||||
$nodes = array(
|
$nodes = array(
|
||||||
$principalCollection,
|
$principalCollection,
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace OCA\DAV\Command;
|
||||||
|
|
||||||
use OCA\DAV\CalDAV\CalDavBackend;
|
use OCA\DAV\CalDAV\CalDavBackend;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
@ -74,10 +73,9 @@ class CreateCalendar extends Command {
|
||||||
$this->userManager,
|
$this->userManager,
|
||||||
$this->groupManager
|
$this->groupManager
|
||||||
);
|
);
|
||||||
$groupPrincipal = new GroupPrincipalBackend($this->groupManager);
|
|
||||||
|
|
||||||
$name = $input->getArgument('name');
|
$name = $input->getArgument('name');
|
||||||
$caldav = new CalDavBackend($this->dbConnection, $principalBackend, $groupPrincipal);
|
$caldav = new CalDavBackend($this->dbConnection, $principalBackend);
|
||||||
$caldav->createCalendar("principals/users/$user", $name, []);
|
$caldav->createCalendar("principals/users/$user", $name, []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
namespace OCA\DAV\CalDAV;
|
namespace OCA\DAV\CalDAV;
|
||||||
|
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCA\DAV\DAV\Sharing\IShareable;
|
use OCA\DAV\DAV\Sharing\IShareable;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
|
@ -36,9 +35,7 @@ use Sabre\CalDAV\Plugin;
|
||||||
use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
|
use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
|
||||||
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
|
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
|
||||||
use Sabre\DAV;
|
use Sabre\DAV;
|
||||||
use Sabre\DAV\Exception\BadRequest;
|
|
||||||
use Sabre\DAV\Exception\Forbidden;
|
use Sabre\DAV\Exception\Forbidden;
|
||||||
use Sabre\DAV\PropPatch;
|
|
||||||
use Sabre\HTTP\URLUtil;
|
use Sabre\HTTP\URLUtil;
|
||||||
use Sabre\VObject\DateTimeParser;
|
use Sabre\VObject\DateTimeParser;
|
||||||
use Sabre\VObject\Reader;
|
use Sabre\VObject\Reader;
|
||||||
|
@ -107,13 +104,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* CalDavBackend constructor.
|
* CalDavBackend constructor.
|
||||||
*
|
*
|
||||||
* @param IDBConnection $db
|
* @param IDBConnection $db
|
||||||
* @param $userPrincipalBackend
|
* @param Principal $principalBackend
|
||||||
* @param GroupPrincipalBackend $groupPrincipalBackend
|
|
||||||
*/
|
*/
|
||||||
public function __construct(IDBConnection $db, $userPrincipalBackend, GroupPrincipalBackend $groupPrincipalBackend) {
|
public function __construct(IDBConnection $db, Principal $principalBackend) {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->principalBackend = $userPrincipalBackend;
|
$this->principalBackend = $principalBackend;
|
||||||
$this->sharingBackend = new Backend($this->db, $userPrincipalBackend, $groupPrincipalBackend, 'calendar');
|
$this->sharingBackend = new Backend($this->db, $principalBackend, 'calendar');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -347,7 +343,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $calendarUri
|
* @param string $calendarUri
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @return int
|
* @return int
|
||||||
* @throws DAV\Exception
|
|
||||||
*/
|
*/
|
||||||
function createCalendar($principalUri, $calendarUri, array $properties) {
|
function createCalendar($principalUri, $calendarUri, array $properties) {
|
||||||
$values = [
|
$values = [
|
||||||
|
@ -399,10 +394,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
*
|
*
|
||||||
* Read the PropPatch documentation for more info and examples.
|
* Read the PropPatch documentation for more info and examples.
|
||||||
*
|
*
|
||||||
* @param int $calendarId
|
* @param \Sabre\DAV\PropPatch $propPatch
|
||||||
* @param PropPatch $propPatch
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateCalendar($calendarId, PropPatch $propPatch) {
|
function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) {
|
||||||
$supportedProperties = array_keys($this->propertyMap);
|
$supportedProperties = array_keys($this->propertyMap);
|
||||||
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
|
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
|
||||||
|
|
||||||
|
@ -1042,7 +1037,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Forbidden
|
|
||||||
*/
|
*/
|
||||||
function createSubscription($principalUri, $uri, array $properties) {
|
function createSubscription($principalUri, $uri, array $properties) {
|
||||||
|
|
||||||
|
@ -1091,10 +1085,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* Read the PropPatch documentation for more info and examples.
|
* Read the PropPatch documentation for more info and examples.
|
||||||
*
|
*
|
||||||
* @param mixed $subscriptionId
|
* @param mixed $subscriptionId
|
||||||
* @param PropPatch $propPatch
|
* @param \Sabre\DAV\PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateSubscription($subscriptionId, PropPatch $propPatch) {
|
function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) {
|
||||||
$supportedProperties = array_keys($this->subscriptionPropertyMap);
|
$supportedProperties = array_keys($this->subscriptionPropertyMap);
|
||||||
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
|
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
|
||||||
|
|
||||||
|
@ -1284,7 +1278,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
*
|
*
|
||||||
* @param string $calendarData
|
* @param string $calendarData
|
||||||
* @return array
|
* @return array
|
||||||
* @throws BadRequest
|
|
||||||
*/
|
*/
|
||||||
protected function getDenormalizedData($calendarData) {
|
protected function getDenormalizedData($calendarData) {
|
||||||
|
|
||||||
|
@ -1302,7 +1295,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$componentType) {
|
if (!$componentType) {
|
||||||
throw new BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
|
throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
|
||||||
}
|
}
|
||||||
if ($componentType === 'VEVENT' && $component->DTSTART) {
|
if ($componentType === 'VEVENT' && $component->DTSTART) {
|
||||||
$firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
|
$firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
|
||||||
|
@ -1369,21 +1362,19 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $resourceId
|
* @param int $resourceId
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getShares($resourceId, $currentPrincipal) {
|
public function getShares($resourceId) {
|
||||||
return $this->sharingBackend->getShares($resourceId, $currentPrincipal);
|
return $this->sharingBackend->getShares($resourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $resourceId
|
* @param int $resourceId
|
||||||
* @param array $acl
|
* @param array $acl
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function applyShareAcl($resourceId, $acl, $currentPrincipal) {
|
public function applyShareAcl($resourceId, $acl) {
|
||||||
return $this->sharingBackend->applyShareAcl($resourceId, $acl, $currentPrincipal);
|
return $this->sharingBackend->applyShareAcl($resourceId, $acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function convertPrincipal($principalUri, $toV2) {
|
private function convertPrincipal($principalUri, $toV2) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
||||||
function getShares() {
|
function getShares() {
|
||||||
/** @var CalDavBackend $calDavBackend */
|
/** @var CalDavBackend $calDavBackend */
|
||||||
$calDavBackend = $this->caldavBackend;
|
$calDavBackend = $this->caldavBackend;
|
||||||
return $calDavBackend->getShares($this->getResourceId(), parent::getOwner());
|
return $calDavBackend->getShares($this->getResourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,7 +114,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
||||||
|
|
||||||
/** @var CalDavBackend $calDavBackend */
|
/** @var CalDavBackend $calDavBackend */
|
||||||
$calDavBackend = $this->caldavBackend;
|
$calDavBackend = $this->caldavBackend;
|
||||||
return $calDavBackend->applyShareAcl($this->getResourceId(), $acl, parent::getOwner());
|
return $calDavBackend->applyShareAcl($this->getResourceId(), $acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildACL() {
|
function getChildACL() {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
||||||
function getShares() {
|
function getShares() {
|
||||||
/** @var CardDavBackend $carddavBackend */
|
/** @var CardDavBackend $carddavBackend */
|
||||||
$carddavBackend = $this->carddavBackend;
|
$carddavBackend = $this->carddavBackend;
|
||||||
return $carddavBackend->getShares($this->getResourceId(), $this->getOwner());
|
return $carddavBackend->getShares($this->getResourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getACL() {
|
function getACL() {
|
||||||
|
@ -106,7 +106,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
||||||
|
|
||||||
/** @var CardDavBackend $carddavBackend */
|
/** @var CardDavBackend $carddavBackend */
|
||||||
$carddavBackend = $this->carddavBackend;
|
$carddavBackend = $this->carddavBackend;
|
||||||
return $carddavBackend->applyShareAcl($this->getResourceId(), $acl, parent::getOwner());
|
return $carddavBackend->applyShareAcl($this->getResourceId(), $acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildACL() {
|
function getChildACL() {
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
namespace OCA\DAV\CardDAV;
|
namespace OCA\DAV\CardDAV;
|
||||||
|
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCA\DAV\DAV\Sharing\Backend;
|
use OCA\DAV\DAV\Sharing\Backend;
|
||||||
use OCA\DAV\DAV\Sharing\IShareable;
|
use OCA\DAV\DAV\Sharing\IShareable;
|
||||||
|
@ -35,7 +34,6 @@ use Sabre\CardDAV\Backend\BackendInterface;
|
||||||
use Sabre\CardDAV\Backend\SyncSupport;
|
use Sabre\CardDAV\Backend\SyncSupport;
|
||||||
use Sabre\CardDAV\Plugin;
|
use Sabre\CardDAV\Plugin;
|
||||||
use Sabre\DAV\Exception\BadRequest;
|
use Sabre\DAV\Exception\BadRequest;
|
||||||
use Sabre\DAV\PropPatch;
|
|
||||||
use Sabre\HTTP\URLUtil;
|
use Sabre\HTTP\URLUtil;
|
||||||
use Sabre\VObject\Component\VCard;
|
use Sabre\VObject\Component\VCard;
|
||||||
use Sabre\VObject\Reader;
|
use Sabre\VObject\Reader;
|
||||||
|
@ -71,18 +69,16 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* CardDavBackend constructor.
|
* CardDavBackend constructor.
|
||||||
*
|
*
|
||||||
* @param IDBConnection $db
|
* @param IDBConnection $db
|
||||||
* @param Principal $userPrincipalBackend
|
* @param Principal $principalBackend
|
||||||
* @param GroupPrincipalBackend $groupPrincipalBackend
|
|
||||||
* @param EventDispatcherInterface $dispatcher
|
* @param EventDispatcherInterface $dispatcher
|
||||||
*/
|
*/
|
||||||
public function __construct(IDBConnection $db,
|
public function __construct(IDBConnection $db,
|
||||||
Principal $userPrincipalBackend,
|
Principal $principalBackend,
|
||||||
GroupPrincipalBackend $groupPrincipalBackend,
|
|
||||||
EventDispatcherInterface $dispatcher = null) {
|
EventDispatcherInterface $dispatcher = null) {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->principalBackend = $userPrincipalBackend;
|
$this->principalBackend = $principalBackend;
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
$this->sharingBackend = new Backend($this->db, $userPrincipalBackend, $groupPrincipalBackend, 'addressbook');
|
$this->sharingBackend = new Backend($this->db, $principalBackend, 'addressbook');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +161,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $addressBookId
|
* @param int $addressBookId
|
||||||
* @return array|null
|
|
||||||
*/
|
*/
|
||||||
public function getAddressBookById($addressBookId) {
|
public function getAddressBookById($addressBookId) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
@ -192,8 +187,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $principal
|
* @param $addressBookUri
|
||||||
* @param string $addressBookUri
|
|
||||||
* @return array|null
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
public function getAddressBooksByUri($principal, $addressBookUri) {
|
public function getAddressBooksByUri($principal, $addressBookUri) {
|
||||||
|
@ -235,10 +229,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* Read the PropPatch documentation for more info and examples.
|
* Read the PropPatch documentation for more info and examples.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param PropPatch $propPatch
|
* @param \Sabre\DAV\PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateAddressBook($addressBookId, PropPatch $propPatch) {
|
function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
|
||||||
$supportedProperties = [
|
$supportedProperties = [
|
||||||
'{DAV:}displayname',
|
'{DAV:}displayname',
|
||||||
'{' . Plugin::NS_CARDDAV . '}addressbook-description',
|
'{' . Plugin::NS_CARDDAV . '}addressbook-description',
|
||||||
|
@ -873,12 +867,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* * readOnly - boolean
|
* * readOnly - boolean
|
||||||
* * summary - Optional, a description for the share
|
* * summary - Optional, a description for the share
|
||||||
*
|
*
|
||||||
* @param $addressBookId
|
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getShares($addressBookId, $currentPrincipal) {
|
public function getShares($addressBookId) {
|
||||||
return $this->sharingBackend->getShares($addressBookId, $currentPrincipal);
|
return $this->sharingBackend->getShares($addressBookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -976,11 +968,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* For shared address books the sharee is set in the ACL of the address book
|
* For shared address books the sharee is set in the ACL of the address book
|
||||||
* @param $addressBookId
|
* @param $addressBookId
|
||||||
* @param $acl
|
* @param $acl
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function applyShareAcl($addressBookId, $acl, $currentPrincipal) {
|
public function applyShareAcl($addressBookId, $acl) {
|
||||||
return $this->sharingBackend->applyShareAcl($addressBookId, $acl, $currentPrincipal);
|
return $this->sharingBackend->applyShareAcl($addressBookId, $acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function convertPrincipal($principalUri, $toV2) {
|
private function convertPrincipal($principalUri, $toV2) {
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
namespace OCA\DAV\DAV\Sharing;
|
namespace OCA\DAV\DAV\Sharing;
|
||||||
|
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
class Backend {
|
class Backend {
|
||||||
|
@ -31,9 +30,7 @@ class Backend {
|
||||||
/** @var IDBConnection */
|
/** @var IDBConnection */
|
||||||
private $db;
|
private $db;
|
||||||
/** @var Principal */
|
/** @var Principal */
|
||||||
private $userPrincipalBackend;
|
private $principalBackend;
|
||||||
/** @var GroupPrincipalBackend */
|
|
||||||
private $groupPrincipalBackend;
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $resourceType;
|
private $resourceType;
|
||||||
|
|
||||||
|
@ -43,14 +40,12 @@ class Backend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IDBConnection $db
|
* @param IDBConnection $db
|
||||||
* @param Principal $userPrincipalBackend
|
* @param Principal $principalBackend
|
||||||
* @param GroupPrincipalBackend $groupPrincipalBackend
|
|
||||||
* @param string $resourceType
|
* @param string $resourceType
|
||||||
*/
|
*/
|
||||||
public function __construct(IDBConnection $db, Principal $userPrincipalBackend, GroupPrincipalBackend $groupPrincipalBackend, $resourceType) {
|
public function __construct(IDBConnection $db, Principal $principalBackend, $resourceType) {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->userPrincipalBackend = $userPrincipalBackend;
|
$this->principalBackend = $principalBackend;
|
||||||
$this->groupPrincipalBackend = $groupPrincipalBackend;
|
|
||||||
$this->resourceType = $resourceType;
|
$this->resourceType = $resourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,10 +143,9 @@ class Backend {
|
||||||
* * summary - Optional, a description for the share
|
* * summary - Optional, a description for the share
|
||||||
*
|
*
|
||||||
* @param int $resourceId
|
* @param int $resourceId
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getShares($resourceId, $currentPrincipal) {
|
public function getShares($resourceId) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$result = $query->select(['principaluri', 'access'])
|
$result = $query->select(['principaluri', 'access'])
|
||||||
->from('dav_shares')
|
->from('dav_shares')
|
||||||
|
@ -161,31 +155,13 @@ class Backend {
|
||||||
|
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while($row = $result->fetch()) {
|
while($row = $result->fetch()) {
|
||||||
$p = $this->userPrincipalBackend->getPrincipalByPath($row['principaluri']);
|
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
|
||||||
if (is_null($p)) {
|
|
||||||
$p = $this->groupPrincipalBackend->getPrincipalByPath($row['principaluri']);
|
|
||||||
if (is_null($p)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// also add the current user if it is member of the group
|
|
||||||
$groups = $this->userPrincipalBackend->getGroupMembership($currentPrincipal);
|
|
||||||
if (in_array($row['principaluri'], $groups)) {
|
|
||||||
$ownerPrincipal = $this->userPrincipalBackend->getPrincipalByPath($currentPrincipal);
|
|
||||||
$shares[]= [
|
|
||||||
'href' => "principal:$currentPrincipal",
|
|
||||||
'commonName' => isset($ownerPrincipal['{DAV:}displayname']) ? $ownerPrincipal['{DAV:}displayname'] : '',
|
|
||||||
'status' => 1,
|
|
||||||
'readOnly' => ($row['access'] == self::ACCESS_READ),
|
|
||||||
'{http://owncloud.org/ns}principal' => $currentPrincipal
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$shares[]= [
|
$shares[]= [
|
||||||
'href' => "principal:${row['principaluri']}",
|
'href' => "principal:${row['principaluri']}",
|
||||||
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
|
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'readOnly' => ($row['access'] == self::ACCESS_READ),
|
'readOnly' => ($row['access'] == self::ACCESS_READ),
|
||||||
'{http://owncloud.org/ns}principal' => $row['principaluri']
|
'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal' => $row['principaluri']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,12 +173,11 @@ class Backend {
|
||||||
*
|
*
|
||||||
* @param int $resourceId
|
* @param int $resourceId
|
||||||
* @param array $acl
|
* @param array $acl
|
||||||
* @param string $currentPrincipal
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function applyShareAcl($resourceId, $acl, $currentPrincipal) {
|
public function applyShareAcl($resourceId, $acl) {
|
||||||
|
|
||||||
$shares = $this->getShares($resourceId, $currentPrincipal);
|
$shares = $this->getShares($resourceId);
|
||||||
foreach ($shares as $share) {
|
foreach ($shares as $share) {
|
||||||
$acl[] = [
|
$acl[] = [
|
||||||
'privilege' => '{DAV:}read',
|
'privilege' => '{DAV:}read',
|
||||||
|
|
|
@ -57,7 +57,7 @@ class RootCollection extends SimpleCollection {
|
||||||
$systemPrincipals->disableListing = $disableListing;
|
$systemPrincipals->disableListing = $disableListing;
|
||||||
$filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users');
|
$filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users');
|
||||||
$filesCollection->disableListing = $disableListing;
|
$filesCollection->disableListing = $disableListing;
|
||||||
$caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $groupPrincipalBackend);
|
$caldavBackend = new CalDavBackend($db, $userPrincipalBackend);
|
||||||
$calendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users');
|
$calendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users');
|
||||||
$calendarRoot->disableListing = $disableListing;
|
$calendarRoot->disableListing = $disableListing;
|
||||||
|
|
||||||
|
@ -80,13 +80,12 @@ class RootCollection extends SimpleCollection {
|
||||||
\OC::$server->getRootFolder(),
|
\OC::$server->getRootFolder(),
|
||||||
\OC::$server->getLogger()
|
\OC::$server->getLogger()
|
||||||
);
|
);
|
||||||
$groupPrincipal = new GroupPrincipalBackend(\OC::$server->getGroupManager());
|
|
||||||
|
|
||||||
$usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $groupPrincipal, $dispatcher);
|
$usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $dispatcher);
|
||||||
$usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, 'principals/users');
|
$usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, 'principals/users');
|
||||||
$usersAddressBookRoot->disableListing = $disableListing;
|
$usersAddressBookRoot->disableListing = $disableListing;
|
||||||
|
|
||||||
$systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $groupPrincipal, $dispatcher);
|
$systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $dispatcher);
|
||||||
$systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, 'principals/system');
|
$systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, 'principals/system');
|
||||||
$systemAddressBookRoot->disableListing = $disableListing;
|
$systemAddressBookRoot->disableListing = $disableListing;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ use DateTimeZone;
|
||||||
use OCA\DAV\CalDAV\CalDavBackend;
|
use OCA\DAV\CalDAV\CalDavBackend;
|
||||||
use OCA\DAV\CalDAV\Calendar;
|
use OCA\DAV\CalDAV\Calendar;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
|
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
|
||||||
use Sabre\DAV\PropPatch;
|
use Sabre\DAV\PropPatch;
|
||||||
use Sabre\DAV\Xml\Property\Href;
|
use Sabre\DAV\Xml\Property\Href;
|
||||||
|
@ -47,9 +46,6 @@ class CalDavBackendTest extends TestCase {
|
||||||
/** @var Principal | \PHPUnit_Framework_MockObject_MockObject */
|
/** @var Principal | \PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $principal;
|
private $principal;
|
||||||
|
|
||||||
/** @var GroupPrincipalBackend | \PHPUnit_Framework_MockObject_MockObject */
|
|
||||||
private $groupPrincipal;
|
|
||||||
|
|
||||||
const UNIT_TEST_USER = 'principals/users/caldav-unit-test';
|
const UNIT_TEST_USER = 'principals/users/caldav-unit-test';
|
||||||
const UNIT_TEST_USER1 = 'principals/users/caldav-unit-test1';
|
const UNIT_TEST_USER1 = 'principals/users/caldav-unit-test1';
|
||||||
const UNIT_TEST_GROUP = 'principals/groups/caldav-unit-test-group';
|
const UNIT_TEST_GROUP = 'principals/groups/caldav-unit-test-group';
|
||||||
|
@ -68,13 +64,9 @@ class CalDavBackendTest extends TestCase {
|
||||||
$this->principal->expects($this->any())->method('getGroupMembership')
|
$this->principal->expects($this->any())->method('getGroupMembership')
|
||||||
->withAnyParameters()
|
->withAnyParameters()
|
||||||
->willReturn([self::UNIT_TEST_GROUP]);
|
->willReturn([self::UNIT_TEST_GROUP]);
|
||||||
$this->groupPrincipal = $this->getMockBuilder('OCA\DAV\DAV\GroupPrincipalBackend')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$db = \OC::$server->getDatabaseConnection();
|
$db = \OC::$server->getDatabaseConnection();
|
||||||
$this->backend = new CalDavBackend($db, $this->principal, $this->groupPrincipal);
|
$this->backend = new CalDavBackend($db, $this->principal);
|
||||||
|
|
||||||
$this->tearDown();
|
$this->tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ use InvalidArgumentException;
|
||||||
use OCA\DAV\CardDAV\AddressBook;
|
use OCA\DAV\CardDAV\AddressBook;
|
||||||
use OCA\DAV\CardDAV\CardDavBackend;
|
use OCA\DAV\CardDAV\CardDavBackend;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
use OCA\DAV\Connector\Sabre\Principal;
|
||||||
use OCA\DAV\DAV\GroupPrincipalBackend;
|
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use Sabre\DAV\PropPatch;
|
use Sabre\DAV\PropPatch;
|
||||||
|
@ -59,9 +58,6 @@ class CardDavBackendTest extends TestCase {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $dbCardsPropertiesTable = 'cards_properties';
|
private $dbCardsPropertiesTable = 'cards_properties';
|
||||||
|
|
||||||
/** @var GroupPrincipalBackend */
|
|
||||||
private $groupPrincipal;
|
|
||||||
|
|
||||||
const UNIT_TEST_USER = 'principals/users/carddav-unit-test';
|
const UNIT_TEST_USER = 'principals/users/carddav-unit-test';
|
||||||
const UNIT_TEST_USER1 = 'principals/users/carddav-unit-test1';
|
const UNIT_TEST_USER1 = 'principals/users/carddav-unit-test1';
|
||||||
const UNIT_TEST_GROUP = 'principals/groups/carddav-unit-test-group';
|
const UNIT_TEST_GROUP = 'principals/groups/carddav-unit-test-group';
|
||||||
|
@ -73,21 +69,17 @@ class CardDavBackendTest extends TestCase {
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
|
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->principal->expects($this->any())->method('getPrincipalByPath')
|
$this->principal->method('getPrincipalByPath')
|
||||||
->willReturn([
|
->willReturn([
|
||||||
'uri' => 'principals/best-friend'
|
'uri' => 'principals/best-friend'
|
||||||
]);
|
]);
|
||||||
$this->principal->expects($this->any())->method('getGroupMembership')
|
$this->principal->method('getGroupMembership')
|
||||||
->withAnyParameters()
|
->withAnyParameters()
|
||||||
->willReturn([self::UNIT_TEST_GROUP]);
|
->willReturn([self::UNIT_TEST_GROUP]);
|
||||||
$this->groupPrincipal = $this->getMockBuilder('OCA\DAV\DAV\GroupPrincipalBackend')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$this->db = \OC::$server->getDatabaseConnection();
|
$this->db = \OC::$server->getDatabaseConnection();
|
||||||
|
|
||||||
$this->backend = new CardDavBackend($this->db, $this->principal, $this->groupPrincipal, null);
|
$this->backend = new CardDavBackend($this->db, $this->principal, null);
|
||||||
|
|
||||||
// start every test with a empty cards_properties and cards table
|
// start every test with a empty cards_properties and cards table
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
@ -165,7 +157,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
|
|
||||||
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backend */
|
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backend */
|
||||||
$backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
$backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
||||||
->setConstructorArgs([$this->db, $this->principal, $this->groupPrincipal, null])
|
->setConstructorArgs([$this->db, $this->principal, null])
|
||||||
->setMethods(['updateProperties', 'purgeProperties'])->getMock();
|
->setMethods(['updateProperties', 'purgeProperties'])->getMock();
|
||||||
|
|
||||||
// create a new address book
|
// create a new address book
|
||||||
|
@ -211,7 +203,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
public function testMultiCard() {
|
public function testMultiCard() {
|
||||||
|
|
||||||
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
||||||
->setConstructorArgs([$this->db, $this->principal, $this->groupPrincipal, null])
|
->setConstructorArgs([$this->db, $this->principal, null])
|
||||||
->setMethods(['updateProperties'])->getMock();
|
->setMethods(['updateProperties'])->getMock();
|
||||||
|
|
||||||
// create a new address book
|
// create a new address book
|
||||||
|
@ -256,8 +248,9 @@ class CardDavBackendTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteWithoutCard() {
|
public function testDeleteWithoutCard() {
|
||||||
|
|
||||||
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
||||||
->setConstructorArgs([$this->db, $this->principal, $this->groupPrincipal, null])
|
->setConstructorArgs([$this->db, $this->principal, null])
|
||||||
->setMethods([
|
->setMethods([
|
||||||
'getCardId',
|
'getCardId',
|
||||||
'addChange',
|
'addChange',
|
||||||
|
@ -296,8 +289,9 @@ class CardDavBackendTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSyncSupport() {
|
public function testSyncSupport() {
|
||||||
|
|
||||||
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
$this->backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
||||||
->setConstructorArgs([$this->db, $this->principal, $this->groupPrincipal, null])
|
->setConstructorArgs([$this->db, $this->principal, null])
|
||||||
->setMethods(['updateProperties'])->getMock();
|
->setMethods(['updateProperties'])->getMock();
|
||||||
|
|
||||||
// create a new address book
|
// create a new address book
|
||||||
|
@ -327,13 +321,13 @@ class CardDavBackendTest extends TestCase {
|
||||||
$exampleBook = new AddressBook($this->backend, $books[0]);
|
$exampleBook = new AddressBook($this->backend, $books[0]);
|
||||||
$this->backend->updateShares($exampleBook, [['href' => 'principal:principals/best-friend']], []);
|
$this->backend->updateShares($exampleBook, [['href' => 'principal:principals/best-friend']], []);
|
||||||
|
|
||||||
$shares = $this->backend->getShares($exampleBook->getResourceId(), null);
|
$shares = $this->backend->getShares($exampleBook->getResourceId());
|
||||||
$this->assertEquals(1, count($shares));
|
$this->assertEquals(1, count($shares));
|
||||||
|
|
||||||
// adding the same sharee again has no effect
|
// adding the same sharee again has no effect
|
||||||
$this->backend->updateShares($exampleBook, [['href' => 'principal:principals/best-friend']], []);
|
$this->backend->updateShares($exampleBook, [['href' => 'principal:principals/best-friend']], []);
|
||||||
|
|
||||||
$shares = $this->backend->getShares($exampleBook->getResourceId(), null);
|
$shares = $this->backend->getShares($exampleBook->getResourceId());
|
||||||
$this->assertEquals(1, count($shares));
|
$this->assertEquals(1, count($shares));
|
||||||
|
|
||||||
$books = $this->backend->getAddressBooksForUser('principals/best-friend');
|
$books = $this->backend->getAddressBooksForUser('principals/best-friend');
|
||||||
|
@ -341,7 +335,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
|
|
||||||
$this->backend->updateShares($exampleBook, [], ['principal:principals/best-friend']);
|
$this->backend->updateShares($exampleBook, [], ['principal:principals/best-friend']);
|
||||||
|
|
||||||
$shares = $this->backend->getShares($exampleBook->getResourceId(), null);
|
$shares = $this->backend->getShares($exampleBook->getResourceId());
|
||||||
$this->assertEquals(0, count($shares));
|
$this->assertEquals(0, count($shares));
|
||||||
|
|
||||||
$books = $this->backend->getAddressBooksForUser('principals/best-friend');
|
$books = $this->backend->getAddressBooksForUser('principals/best-friend');
|
||||||
|
@ -355,7 +349,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
$cardId = 2;
|
$cardId = 2;
|
||||||
|
|
||||||
$backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
$backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
|
||||||
->setConstructorArgs([$this->db, $this->principal, $this->groupPrincipal, null])
|
->setConstructorArgs([$this->db, $this->principal, null])
|
||||||
->setMethods(['getCardId'])->getMock();
|
->setMethods(['getCardId'])->getMock();
|
||||||
|
|
||||||
$backend->expects($this->any())->method('getCardId')->willReturn($cardId);
|
$backend->expects($this->any())->method('getCardId')->willReturn($cardId);
|
||||||
|
|
Loading…
Reference in New Issue