Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__)
;

return Symfony\CS\Config\Config::create()
->fixers(array('-psr0'))
->finder($finder)
;
20 changes: 8 additions & 12 deletions Controller/SabreDavController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
use Sabre\DAV\Server;
use Secotrust\Bundle\SabreDavBundle\SabreDav\HttpRequest;
use Secotrust\Bundle\SabreDavBundle\SabreDav\HttpResponse;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\RouterInterface;

/**
* Class SabreDavController
* Class SabreDavController.
*/
class SabreDavController
{
Expand All @@ -29,20 +29,16 @@ class SabreDavController
private $dav;

/**
* @var EventDispatcherInterface
*/
private $dispatcher;

/**
* Constructor
* Constructor.
*
* @param Server $dav
* @param EventDispatcherInterface $dispatcher
* @param Server $dav
* @param RouterInterface $router
*/
public function __construct(Server $dav, EventDispatcherInterface $dispatcher)
public function __construct(Server $dav, RouterInterface $router, $base_uri = '')
{
$router->getContext()->setBaseUrl($router->getContext()->getBaseUrl() . $base_uri);
$this->dav = $dav;
$this->dispatcher = $dispatcher; // TODO needed?
$this->dav->setBaseUri($router->generate('secotrust_sabre_dav', array()));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/CollectionPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\Reference;

/**
* Class CollectionPass
* Class CollectionPass.
*/
class CollectionPass implements CompilerPassInterface
{
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/PluginPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\Filesystem\Filesystem;

/**
* Class PluginPass
* Class PluginPass.
*/
class PluginPass implements CompilerPassInterface
{
Expand Down
43 changes: 37 additions & 6 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,67 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* Class Configuration
* Class Configuration.
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
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('browser_logo')
->example('%kernel.root_dir%/../web/logo/sabredav.png')
->defaultValue('')
->end()
->scalarNode('favicon')
->example('%kernel.root_dir%/../web/logo/favicon.ico')
->defaultValue('')
->end()
->scalarNode('security_service')
->example('sabredav.security_service')
->defaultValue('')
->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('calendarobjects_class')->defaultValue('')->end()
->scalarNode('calendar_class')->defaultValue('')->end()
->scalarNode('principals_class')->defaultValue('')->end()
->scalarNode('principalgroups_class')->defaultValue('')->end()
->end()
->end()
->end()
->end();
Expand Down
38 changes: 29 additions & 9 deletions DependencyInjection/SecotrustSabreDavExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
use Symfony\Component\DependencyInjection\Loader;

/**
* Class SecotrustSabreDavExtension
* Class SecotrustSabreDavExtension.
*/
class SecotrustSabreDavExtension extends Extension
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
Expand All @@ -32,20 +32,40 @@ 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']));
$container->setParameter('secotrust.sabredav.base_uri', $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 (!empty($config['root_dir']) && $config['plugins']['webdav']) {
//replace argument
$container->getDefinition('secotrust.sabredav_root')->replaceArgument(0, $config['root_dir']);
}

// add logo to browser-plugin
if ($config['plugins']['browser']) {
$container->setParameter('secotrust.sabredav.browser_plugin.logo', $config['browser_logo']);
$container->setParameter('secotrust.sabredav.browser_plugin.favicon', $config['favicon']);
}

// add security-service-class
if ($config['security_service']) {
$container->setParameter('secotrust.sabredav.acl.securityService', $config['security_service']);
Copy link

Choose a reason for hiding this comment

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

Where is this used? Can't find the param usage

}

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

namespace Secotrust\Bundle\SabreDavBundle\Entity;

/**
* Class AddressbookInterface.
*
* @author lduer
*/
interface AddressbookInterface
{
/**
* Get id.
*
* @return int
*/
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 $description
*
* @return $this
*/
public function setDescription($description);

/**
* Get the synctoken of the current CTag.
*
* @return string
*/
public function getSynctoken();

/**
* updates the synctoken of the current Group.
*
* @return $this
*/
public function updateSynctoken();

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

/**
* Get all Cars for current Addressbook.
*
* @return array
*/
public function getCards();

/**
* Search Card by URI in current Addressbook.
*
* @param string $uri
*/
public function findCard($uri);

/**
* Adds the given card to the current Addressbook.
*
* @param \Secotrust\Bundle\SabreDavBundle\Entity\CardInterface $card
*/
public function addCard(CardInterface $card);

/**
* Remove the given card from the current Addressbook.
*
* Caution: Check the field-configuration & your field-connections<br>
* and use the desired setting, if you want to delete the cards <br>
* - either only from the current Addressbook <br>
* - or from the cards-table too
*
* @param \Secotrust\Bundle\SabreDavBundle\Entity\CardInterface $card
*
* @return bool
*/
public function removeCard(CardInterface $card);

/**
* Remove all Cards from current Addressbook.
*
* Possible solution: use <code>$cards = $this->getCards()</code> and
* <code>$this->removeCard($card)</code> to remove all cards
*/
public function removeAllCards();
}
Loading