当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::getDataboxes方法代码示例

本文整理汇总了PHP中Alchemy\Phrasea\Application::getDataboxes方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getDataboxes方法的具体用法?PHP Application::getDataboxes怎么用?PHP Application::getDataboxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Alchemy\Phrasea\Application的用法示例。


在下文中一共展示了Application::getDataboxes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUnvalidated

 private static function getUnvalidated(Application $app, $home = false)
 {
     $terms = [];
     foreach ($app->getDataboxes() as $databox) {
         try {
             $cgus = $databox->get_cgus();
             if (!isset($cgus[$app['locale']])) {
                 throw new Exception('No CGus for this locale');
             }
             $name = $databox->get_label($app['locale']);
             $update = $cgus[$app['locale']]['updated_on'];
             $value = $cgus[$app['locale']]['value'];
             $userValidation = true;
             if (!$home) {
                 if (!$app->getAclForUser($app->getAuthenticatedUser())->has_access_to_sbas($databox->get_sbas_id())) {
                     continue;
                 }
                 $userValidation = $app['settings']->getUserSetting($app->getAuthenticatedUser(), 'terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '';
             }
             if ($userValidation) {
                 $terms[$name] = ['sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update];
             }
         } catch (\Exception $e) {
         }
     }
     return $terms;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:27,代码来源:cgu.php

示例2: get_granted_base

 /**
  * Return an array of base_id which are granted, with
  * optionnal filter by rights
  *
  * @param  array      $rights
  * @param  array|null $sbas_ids Optionnal sbas_id to restrict the query on
  * @return collection[] An array of collection
  */
 public function get_granted_base(array $rights = [], array $sbas_ids = null)
 {
     $this->load_rights_bas();
     $ret = [];
     foreach ($this->app->getDataboxes() as $databox) {
         if ($sbas_ids && !in_array($databox->get_sbas_id(), $sbas_ids)) {
             continue;
         }
         foreach ($databox->get_collections() as $collection) {
             $continue = false;
             if (!array_key_exists($collection->get_base_id(), $this->_rights_bas)) {
                 continue;
             }
             $base_id = $collection->get_base_id();
             foreach ($rights as $right) {
                 if (!$this->has_right_on_base($base_id, $right)) {
                     $continue = true;
                     break;
                 }
             }
             if ($continue || $this->is_limited($base_id)) {
                 continue;
             }
             try {
                 $ret[$base_id] = collection::get_from_base_id($this->app, $base_id);
             } catch (\Exception $e) {
             }
         }
     }
     return $ret;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:39,代码来源:ACL.php

示例3: testInstall

 public function testInstall()
 {
     $app = new Application(Application::ENV_TEST);
     \phrasea::reset_sbasDatas($app['phraseanet.appbox']);
     \phrasea::reset_baseDatas($app['phraseanet.appbox']);
     $app->bindRoutes();
     $parser = new Parser();
     $config = $parser->parse(file_get_contents(__DIR__ . '/../../../../../config/configuration.yml'));
     $credentials = $config['main']['database'];
     $configFile = __DIR__ . '/configuration.yml';
     $compiledFile = __DIR__ . '/configuration.yml.php';
     @unlink($configFile);
     @unlink($compiledFile);
     $app['configuration.store'] = $app->share(function () use($configFile, $compiledFile) {
         return new Configuration(new Yaml(), new Compiler(), $configFile, $compiledFile, true);
     });
     $app['conf'] = $app->share(function () use($app) {
         return new PropertyAccess($app['configuration.store']);
     });
     $app['phraseanet.appbox'] = $app->share(function () use($app) {
         return new \appbox($app);
     });
     $abInfo = ['host' => $credentials['host'], 'port' => $credentials['port'], 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'ab_setup_test'];
     $abConn = $app['dbal.provider']($abInfo);
     $dbConn = $app['dbal.provider'](['host' => $credentials['host'], 'port' => $credentials['port'], 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'db_setup_test']);
     $key = $app['orm.add']($abInfo);
     $app['orm.ems.default'] = $key;
     $dataPath = __DIR__ . '/../../../../../datas/';
     $installer = new Installer($app);
     $installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, 'en');
     $this->assertTrue($app['configuration.store']->isSetup());
     $this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate());
     $databox = current($app->getDataboxes());
     $this->assertContains('<path>' . realpath($dataPath) . '/db_setup_test/subdefs</path>', $databox->get_structure());
     $conf = $app['configuration.store']->getConfig();
     $this->assertArrayHasKey('main', $conf);
     $this->assertArrayHasKey('key', $conf['main']);
     $this->assertGreaterThan(10, strlen($conf['main']['key']));
     @unlink($configFile);
     @unlink($compiledFile);
     $app['connection.pool.manager']->closeAll();
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:42,代码来源:InstallerTest.php

示例4: bas_labels

 public static function bas_labels($base_id, Application $app)
 {
     if (!self::$_bas_labels) {
         try {
             self::$_bas_labels = $app->getApplicationBox()->get_data_from_cache(self::CACHE_BAS_LABELS);
         } catch (\Exception $e) {
             foreach ($app->getDataboxes() as $databox) {
                 foreach ($databox->get_collections() as $collection) {
                     self::$_bas_labels[$collection->get_base_id()] = ['fr' => $collection->get_label('fr'), 'en' => $collection->get_label('en'), 'de' => $collection->get_label('de'), 'nl' => $collection->get_label('nl')];
                 }
             }
             $app->getApplicationBox()->set_data_to_cache(self::$_bas_labels, self::CACHE_BAS_LABELS);
         }
     }
     if (isset(self::$_bas_labels[$base_id]) && isset(self::$_bas_labels[$base_id][$app['locale']])) {
         return self::$_bas_labels[$base_id][$app['locale']];
     }
     return 'Unknown collection';
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:19,代码来源:phrasea.php

示例5: giveRightsToUser

 /**
  * Gives Bases Rights to User.
  *
  * @param User $user
  */
 public static function giveRightsToUser(Application $app, User $user, $base_ids = null, $force = false)
 {
     $app->getAclForUser($user)->delete_data_from_cache(\ACL::CACHE_GLOBAL_RIGHTS);
     $app->getAclForUser($user)->delete_data_from_cache(databox::CACHE_COLLECTIONS);
     $app->getAclForUser($user)->give_access_to_sbas(array_keys($app->getDataboxes()));
     foreach ($app->getDataboxes() as $databox) {
         $app->getAclForUser($user)->delete_data_from_cache(\ACL::CACHE_RIGHTS_SBAS);
         $rights = ['bas_manage' => '1', 'bas_modify_struct' => '1', 'bas_modif_th' => '1', 'bas_chupub' => '1'];
         $app->getAclForUser($user)->update_rights_to_sbas($databox->get_sbas_id(), $rights);
         foreach ($databox->get_collections() as $collection) {
             if (null !== $base_ids && !in_array($collection->get_base_id(), (array) $base_ids, true)) {
                 continue;
             }
             $base_id = $collection->get_base_id();
             if ($app->getAclForUser($user)->has_access_to_base($base_id) && false === $force) {
                 continue;
             }
             $app->getAclForUser($user)->delete_data_from_cache(\ACL::CACHE_RIGHTS_BAS);
             $app->getAclForUser($user)->give_access_to_base([$base_id]);
             $app->getAclForUser($user)->update_rights_to_base($base_id, ['order_master' => true]);
             $rights = ['canputinalbum' => '1', 'candwnldhd' => '1', 'candwnldsubdef' => '1', 'nowatermark' => '1', 'candwnldpreview' => '1', 'cancmd' => '1', 'canadmin' => '1', 'canreport' => '1', 'canpush' => '1', 'creationdate' => '1', 'canaddrecord' => '1', 'canmodifrecord' => '1', 'candeleterecord' => '1', 'chgstatus' => '1', 'imgtools' => '1', 'manage' => '1', 'modify_struct' => '1', 'bas_modify_struct' => '1'];
             $app->getAclForUser($user)->update_rights_to_base($collection->get_base_id(), $rights);
         }
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:30,代码来源:PhraseanetTestCase.php


注:本文中的Alchemy\Phrasea\Application::getDataboxes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。