Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
083dcbb
updated auth-backend
lduer Oct 22, 2014
371d5ff
Updated plugin- & base-config; modified route
lduer Oct 22, 2014
c81f0d6
Added principal-backend
lduer Oct 22, 2014
4dfb80e
Added CardDAV & CalDAV-Backends
lduer Oct 22, 2014
b40b1bc
removed empty parameter; simpler check for existing vars
lduer Nov 17, 2014
b573ac8
replace request_stack by request
lduer Nov 17, 2014
8a2ca23
implemented sabre-dav 2.*; optimized php-interfaces; added BasicAuth …
lduer Feb 25, 2015
b53bb0c
updated plugin-config for carddav & principal
lduer Feb 25, 2015
3343684
added acl-plugin to configure the DAVACL in the security-manager exte…
lduer Feb 25, 2015
5556c5a
added browser-plugin class
lduer Feb 25, 2015
b4a164d
updated principal membership; updated controller & parameter setting;
lduer Feb 25, 2015
970d639
updated FOSUserBundle-Version
lduer Feb 26, 2015
1bf48da
bugfix: throw exception only if principal is not found!
lduer Mar 12, 2015
1c17e62
implementation of sabre/dav 3.0 changes
lduer Oct 6, 2015
0cd24bb
improvements in php-vdocs & -code
lduer Oct 6, 2015
56f4c9f
updated code with "PHP Coding Standards Fixer"; added php_cs config
lduer Oct 6, 2015
10e12c1
Add basic config description
bartv2 Oct 15, 2015
68207c2
Replace deprecated 'pattern' in routing.xml
bartv2 Oct 16, 2015
c9d4c49
Change secotrust.sabredav.caldav_collection.class to new name
bartv2 Oct 16, 2015
d1afe0b
Update CalDavBackend to new version
bartv2 Oct 16, 2015
3e0fd51
Fix indent
bartv2 Oct 16, 2015
0cbcddf
Document using principal backend
bartv2 Oct 16, 2015
452e2fd
Use UserManager to find all users
bartv2 Oct 16, 2015
ae9ca0b
Merge pull request #1 from bartv2/master
lduer Jan 22, 2016
1203774
removed unused event-dispatcher
lduer Jan 25, 2016
5999766
updated code-style (removed tab-characters); removed unused vars
lduer Jan 25, 2016
5fff3fa
updated base_uri configuration for symfony router-base
lduer Jan 25, 2016
ef9eb3f
added client list to docs
lduer Jan 25, 2016
751cc30
updated to psr-4
lduer Jan 25, 2016
cdc21b8
updated sabre/dav version requirement
lduer Nov 29, 2016
1958b89
Update symfony framework version requirement
lduer Jan 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Controller/SabreDavController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\RouterInterface;

/**
* Class SabreDavController
Expand All @@ -33,15 +35,30 @@ class SabreDavController
*/
private $dispatcher;

/**
* @var ContainerInterface
*/
private $container;

/**
* @var RouterInterface
*/
private $router;

/**
* Constructor
*
* @param Server $dav
* @param EventDispatcherInterface $dispatcher
* @param ContainerInterface $container
* @param Router $router
*/
public function __construct(Server $dav, EventDispatcherInterface $dispatcher)
public function __construct(Server $dav, EventDispatcherInterface $dispatcher, ContainerInterface $container, RouterInterface $router)
{
$this->dav = $dav;
$this->dav->setBaseUri($router->generate('secotrust_sabre_dav'));

$this->container = $container;
$this->dispatcher = $dispatcher; // TODO needed?
}

Expand Down
26 changes: 21 additions & 5 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,42 @@ public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('secotrust_sabre_dav');

// TODO needs "little" improvement ;-)

$default_base_uri = '/app_dev.php/remote';
$rootNode
->children()
->scalarNode('root_dir')->example('%kernel.root_dir%/../web/dav')->defaultNull()->end()
->scalarNode('base_uri')->example('/app_dev.php/dav/')->isRequired()->end()
->scalarNode('root_dir')
->example('%kernel.root_dir%/../web/dav/')
->end()
->scalarNode('base_uri')
->example($default_base_uri)
->end()
->arrayNode('plugins')
->addDefaultsIfNotSet()
->children()
->booleanNode('acl')->defaultFalse()->end()
->booleanNode('auth')->defaultFalse()->end()
->booleanNode('browser')->defaultFalse()->end()
->booleanNode('caldav')->defaultFalse()->end()
->booleanNode('lock')->defaultTrue()->end()
->booleanNode('temp')->defaultTrue()->end()
->booleanNode('mount')->defaultFalse()->end()
->booleanNode('patch')->defaultFalse()->end()
->booleanNode('content_type')->defaultFalse()->end()
->booleanNode('webdav')->defaultFalse()->end()
->booleanNode('principal')->defaultFalse()->end()
->booleanNode('carddav')->defaultFalse()->end()
->booleanNode('caldav')->defaultFalse()->end()
->end()
->end()
->arrayNode('settings')
->addDefaultsIfNotSet()
->children()
->scalarNode('cards_class')->defaultValue('')->end()
->scalarNode('addressbooks_class')->defaultValue('')->end()
->scalarNode('principals_class')->defaultValue('')->end()
->end()
->end()
->end()
->end();

return $treeBuilder;
Expand Down
23 changes: 14 additions & 9 deletions DependencyInjection/SecotrustSabreDavExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,26 @@ public function load(array $configs, ContainerBuilder $container)

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services/services.xml');

if ($config['base_uri']) {
if (isset($config['base_uri'])) {
$container->getDefinition('secotrust.sabredav.server')->addMethodCall('setBaseUri', array($config['base_uri']));
}

if ($config['root_dir']) {
$container->getDefinition('secotrust.sabredav_root')->replaceArgument(0, $config['root_dir']);
} else {
$container->getDefinition('secotrust.sabredav_root')->clearTag('secotrust.sabredav.collection');
}


// load all plugins
foreach ($config['plugins'] as $plugin => $enabled) {
if ($enabled) {
$loader->load(sprintf('services/plugins/%s.xml', $plugin));
}
}

// no root dir is set, but webdav plugin is active: throw exception
if (array_key_exists('root_dir', $config) && $config['root_dir'] !== '' && $config['plugins']['webdav'] === true ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be changed to if (!empty($config['root_dir']) && $config['plugins']['webdav']) {.

//replace argument
$container->getDefinition('secotrust.sabredav_root')->replaceArgument(0, $config['root_dir']);
}

$container->setParameter('secotrust.cards_class', $config['settings']['cards_class']);
$container->setParameter('secotrust.addressbooks_class', $config['settings']['addressbooks_class']);
$container->setParameter('secotrust.principals_class', $config['settings']['principals_class']);
}
}
80 changes: 80 additions & 0 deletions Entity/AddressbookInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace Secotrust\Bundle\SabreDavBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Description of AddressbookInterface
*
* @author lduer
*/
interface AddressbookInterface {

/**
* Get id
*
* @return integer
*/
public function getId();

/**
* Get label
*
* @return string
*/
public function getLabel();

/**
* Set label
*
* @param string $label
* @return $this
*/
public function setLabel($label);

/**
* Get description
*
* @return string
*/
public function getDescription();

/**
* Set description
*
* @param string $label
* @return $this
*/
public function setDescription($description);

/**
* Get the value of the current CTag
*
* @return string
*/
public function getCtag();

/**
* updates the cTag of the current Group
*
* @return $this
*/
public function updateCTag();

/**
* get the Uri
*
* @return type
*/
public function getUri();


/**
* Get all Contacts for current Addressbook
*
* @return array
*/
public function getContactList();

}
90 changes: 90 additions & 0 deletions Entity/CardInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace Secotrust\Bundle\SabreDavBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Description of CardInterface
*
* Interface for single Contact-Entity in CardDAV
*
* use prePersist()-Action (Doctrine-Call) to call "updateCTag()" and "updateLastmodified()" actions automatically
*
* @author lduer
*/
interface CardInterface {

/**
* Get id
*
* @return integer
*/
public function getId();

/**
* Get vCardUid
*
* @return string
*/
public function getVCardUid();

/**
* Set vCardUid
*
* @param string $vCardUid
* @return Contact
*/
public function setVCardUid($vCardUid);

/**
* get the vCard
*
* @return string
*/
public function getVCard();

/**
* updates the current vCard
*
* @return $this
*/
public function setVCard($vCard);

/**
* get lastmodified-date of the current card
*
* @return \DateTime()
*/
public function getLastmodified();

/**
* updates the lastmodified-date of the current Card
*
* @return $this
*/
public function updateLastmodified();

/**
* Get the value of the current CTag
*
* @return string
*/
public function getCTag();

/**
* updates the cTag of the current Card
*
* @return $this
*/
public function updateCTag();

/**
* get ETag of current Card
*
* possible method: return md5-checksum of vCard-String
* return md5($this->getVCard());
*/
public function getETag();

}
41 changes: 41 additions & 0 deletions Entity/PrincipalInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Secotrust\Bundle\SabreDavBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Description of PrincipalInterface
*
* @author lduer
*/
interface PrincipalInterface {

/**
* Get id
*
* @return integer
*/
public function getId();

/**
* get username
*
* @return string
*/
public function getUsername();

/**
* get Email
*
* @return string
*/
public function getEmail();

/**
* requried to define me-card as a property on the users' addressbook'
*
* @return string
*/
public function getVCardUrl();
}
20 changes: 20 additions & 0 deletions Entity/Repository/AddressbookRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Secotrust\Bundle\SabreDavBundle\Entity\Repository;

/**
* Description of AddressbookRepositoryInterface
*
* @author lduer
*/
interface AddressbookRepositoryInterface {

/**
* get all Addressbooks for submitted principal
*
* @param type $principalUri
* @return array
*/
public function findAllPrincipalAddressbooks($principalUri);

}
25 changes: 25 additions & 0 deletions Entity/Repository/CardRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Secotrust\Bundle\SabreDavBundle\Entity\Repository;

/**
* Description of CardRepositoryInterface
*
* @author lduer
*/
interface CardRepositoryInterface {

/**
* Find one Card By vCard UID
*
* @param type $uid
*/
public function findSingleCardByUid($uid=null);

/**
* delete Card by cardUri
*
* @param type $cardUri
*/
public function deleteCard($cardUri);
}
Loading