diff options
Diffstat (limited to 'apps/dav/command/createcalendar.php')
-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, []); } } |