diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-26 12:06:02 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-03 17:18:22 +0100 |
commit | 91065956080b02407625cd78796064e45a6d0236 (patch) | |
tree | 14d462ae2062ad6bc8e257167c36c0d04dd68c48 /apps/dav/command | |
parent | dfeb6ea49117654842157f66798ecea6367a7626 (diff) | |
download | nextcloud-server-91065956080b02407625cd78796064e45a6d0236.tar.gz nextcloud-server-91065956080b02407625cd78796064e45a6d0236.zip |
Add calendar sharing
Diffstat (limited to 'apps/dav/command')
-rw-r--r-- | apps/dav/command/createcalendar.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/dav/command/createcalendar.php b/apps/dav/command/createcalendar.php index 34bc061c45b..d7f82dd0e52 100644 --- a/apps/dav/command/createcalendar.php +++ b/apps/dav/command/createcalendar.php @@ -21,7 +21,9 @@ namespace OCA\DAV\Command; use OCA\DAV\CalDAV\CalDavBackend; +use OCA\DAV\Connector\Sabre\Principal; use OCP\IDBConnection; +use OCP\IGroupManager; use OCP\IUserManager; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -33,6 +35,9 @@ class CreateCalendar extends Command { /** @var IUserManager */ protected $userManager; + /** @var IGroupManager $groupManager */ + private $groupManager; + /** @var \OCP\IDBConnection */ protected $dbConnection; @@ -40,9 +45,10 @@ class CreateCalendar extends Command { * @param IUserManager $userManager * @param IDBConnection $dbConnection */ - function __construct(IUserManager $userManager, IDBConnection $dbConnection) { + function __construct(IUserManager $userManager, IGroupManager $groupManager, IDBConnection $dbConnection) { parent::__construct(); $this->userManager = $userManager; + $this->groupManager = $groupManager; $this->dbConnection = $dbConnection; } @@ -63,8 +69,13 @@ class CreateCalendar extends Command { if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException("User <$user> in unknown."); } + $principalBackend = new Principal( + $this->userManager, + $this->groupManager + ); + $name = $input->getArgument('name'); - $caldav = new CalDavBackend($this->dbConnection); + $caldav = new CalDavBackend($this->dbConnection, $principalBackend); $caldav->createCalendar("principals/users/$user", $name, []); } } |