Skip to content

Commit

Permalink
Fix applying individual permissions on address books.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Sep 8, 2014
1 parent d915d50 commit 91ce536
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions turba/lib/Application.php
Expand Up @@ -335,13 +335,13 @@ public function removeUserData($user)
{
/* We need a clean copy of the $cfgSources array here.*/
$cfgSources = Turba::availableSources();
foreach ($cfgSources as $source) {
foreach ($cfgSources as $sourceId => $source) {
if (empty($source['use_shares'])) {
// Shares not enabled for this source
try {
$driver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($source);
->create($source, $sourceId);
} catch (Turba_Exception $e) {
Horde::log($e, 'ERR');
}
Expand Down Expand Up @@ -373,7 +373,7 @@ public function removeUserData($user)
try {
$driver = $GLOBALS['injector']
->getInstance('Turba_Factory_Driver')
->create($config);
->create($config, $share->getName());
} catch (Turba_Exception $e) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion turba/lib/Driver/Share.php
Expand Up @@ -44,7 +44,7 @@ public function __construct($name = '', array $params = array())
{
parent::__construct($name, $params);
$this->_share = $this->_params['config']['params']['share'];
$this->_driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($this->_params['config']);
$this->_driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($this->_params['config'], $name);
$this->_driver->setContactOwner($this->_getContactOwner());
$this->_driver->setSourceName($name);
}
Expand Down
11 changes: 7 additions & 4 deletions turba/lib/Factory/Driver.php
Expand Up @@ -37,18 +37,21 @@ class Turba_Factory_Driver extends Horde_Core_Factory_Base
/**
* Return the Turba_Driver:: instance.
*
* @param mixed $name Either a string containing the internal name of this
* source, or a config array describing the source.
* @param mixed $name Either a string containing the internal name of
* this source, or a config array describing the
* source.
* @param string $name2 The internal name of this source if $name is an
* array.
*
* @return Turba_Driver The singleton instance.
* @throws Turba_Exception
*/
public function create($name)
public function create($name, $name2 = '')
{
if (is_array($name)) {
ksort($name);
$key = md5(serialize($name));
$srcName = '';
$srcName = $name2;
$srcConfig = $name;
} else {
$key = $name;
Expand Down
2 changes: 1 addition & 1 deletion turba/lib/Turba.php
Expand Up @@ -431,7 +431,7 @@ static public function permissionsFilter(array $in,

foreach ($in as $sourceId => $source) {
try {
$driver = $factory->create($source);
$driver = $factory->create($source, $sourceId);
if ($driver->hasPermission($permission) &&
(empty($options['require_add']) || $driver->canAdd())) {
$out[$sourceId] = $source;
Expand Down

0 comments on commit 91ce536

Please sign in to comment.