getConfigFromShares() public static méthode

This will only sync shares that are unique to Horde (such as a SQL or Kolab sources). Any backend that supports ACLs or similar mechanism should be configured from within backends.local.php or via Horde's share_* hooks.
public static getConfigFromShares ( array $sources, boolean $owner = false ) : array
$sources array The default $cfgSources array.
$owner boolean Only return shares that the current user owns?
Résultat array The $cfgSources array.
Exemple #1
0
 /**
  * Prepare the Turba setup.
  *
  * @return NULL
  */
 public function prepareTurba()
 {
     $world =& $this->prepareBasicSetup();
     $this->assertTrue($world['auth']->authenticate('*****@*****.**', array('password' => 'none')));
     $GLOBALS['registry']->pushApp('turba', array('check_perms' => false));
     // Turba base libraries.
     require_once TURBA_BASE . '/lib/Turba.php';
     require_once TURBA_BASE . '/lib/Driver.php';
     require_once TURBA_BASE . '/lib/Object.php';
     // Turba source and attribute configuration.
     include TURBA_BASE . '/config/attributes.php';
     $cfgSources = Turba::availableSources();
     unset($cfgSources['kolab_global']);
     $this->prepareNewFolder($world['storage'], 'Contacts', 'contact', true);
     $this->prepareNewFolder($world['storage'], 'test2', 'contact');
     $GLOBALS['session']->set('turba', 'has_share', true);
     $GLOBALS['cfgSources'] = Turba::getConfigFromShares($cfgSources);
 }
Exemple #2
0
 /**
  * Global variables defined:
  *   $addSources   - TODO
  *   $attributes - (array) Attribute data from the config/attributes.php
  *                 file.
  *   $browse_source_count - TODO
  *   $cfgSources   - TODO
  *   $copymoveSources - TODO
  */
 protected function _init()
 {
     global $injector, $registry, $session;
     /* For now, autoloading the Content_* classes depend on there being a
      * registry entry for the 'content' application that contains at least
      * the fileroot entry. */
     $injector->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Content_/', $registry->get('fileroot', 'content') . '/lib/'));
     if (!class_exists('Content_Tagger')) {
         throw new Horde_Exception(_("The Content_Tagger class could not be found. Make sure the Content application is installed."));
     }
     // Turba source and attribute configuration.
     $attributes = $registry->loadConfigFile('attributes.php', 'attributes', 'turba')->config['attributes'];
     $cfgSources = Turba::availableSources();
     /* UGLY UGLY UGLY - we should NOT be using this as a global
      * variable all over the place. */
     $GLOBALS['cfgSources'] =& $cfgSources;
     // See if any of our sources are configured to use Horde_Share.
     foreach ($cfgSources as $key => $cfg) {
         if (!empty($cfg['use_shares'])) {
             // Create a share instance.
             $session->set('turba', 'has_share', true);
             $cfgSources = Turba::getConfigFromShares($cfgSources);
             break;
         }
     }
     $GLOBALS['attributes'] = $attributes;
     $cfgSources = Turba::permissionsFilter($cfgSources);
     // Build the directory sources select widget.
     if (empty(Turba::$source)) {
         if (!(Turba::$source = $session->get('turba', 'source'))) {
             Turba::$source = Turba::getDefaultAddressbook();
         }
         Turba::$source = Horde_Util::getFormData('source', Turba::$source);
     }
     $GLOBALS['browse_source_count'] = 0;
     foreach (Turba::getAddressBooks() as $key => $curSource) {
         if (!empty($curSource['browse'])) {
             $GLOBALS['browse_source_count']++;
             if (empty(Turba::$source)) {
                 Turba::$source = $key;
             }
         }
     }
     if (empty($cfgSources[Turba::$source]['browse'])) {
         Turba::$source = Turba::getDefaultAddressbook();
     }
     $session->set('turba', 'source', Turba::$source);
     $GLOBALS['addSources'] = Turba::getAddressBooks(Horde_Perms::EDIT, array('require_add' => true));
     $GLOBALS['copymoveSources'] = $GLOBALS['addSources'];
     unset($GLOBALS['copymoveSources'][Turba::$source]);
 }
Exemple #3
0
 public function testDefaultShareDeletePermission()
 {
     $turba_shares = $GLOBALS['injector']->getInstance('Turba_Shares');
     $GLOBALS['conf']['share']['auto_create'] = true;
     Turba::getConfigFromShares(array('test' => array('use_shares' => true)));
     $shares = $turba_shares->listShares('*****@*****.**');
     $default = array_pop($shares);
     $this->assertInstanceOf('Horde_Share_Object', $default);
     $this->assertTrue($default->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE));
 }