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


PHP Piwik\Access类代码示例

本文整理汇总了PHP中Piwik\Access的典型用法代码示例。如果您正苦于以下问题:PHP Access类的具体用法?PHP Access怎么用?PHP Access使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: assertAccessReloadedAndRestored

 private function assertAccessReloadedAndRestored($expectedTokenToBeReloaded)
 {
     $this->access->expects($this->exactly(2))->method('reloadAccess');
     // verify access reloaded
     $this->auth->expects($this->at(0))->method('setLogin')->with($this->equalTo(null));
     $this->auth->expects($this->at(1))->method('setTokenAuth')->with($this->equalTo($expectedTokenToBeReloaded));
     $this->auth->expects($this->at(2))->method('authenticate')->will($this->returnValue(new AuthResult(AuthResult::SUCCESS, 'login1', $expectedTokenToBeReloaded)));
     // verify access restored
     $this->auth->expects($this->at(3))->method('setLogin')->with($this->equalTo(null));
     $this->auth->expects($this->at(4))->method('setTokenAuth')->with($this->equalTo($tokenRestored = $this->userAuthToken));
     $this->auth->expects($this->at(5))->method('authenticate')->will($this->returnValue(new AuthResult(AuthResult::SUCCESS, 'login', $this->userAuthToken)));
 }
开发者ID:ahdinosaur,项目名称:analytics.dinosaur.is,代码行数:12,代码来源:RequestTest.php

示例2: addAnnotations

 private function addAnnotations()
 {
     // create fake access for fake username
     $access = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($access);
     // add two annotations per week for three months, starring every third annotation
     // first month in 2011, second two in 2012
     $count = 0;
     $dateStart = Date::factory('2011-12-01');
     $dateEnd = Date::factory('2012-03-01');
     while ($dateStart->getTimestamp() < $dateEnd->getTimestamp()) {
         $starred = $count % 3 == 0 ? 1 : 0;
         $site1Text = "{$count}: Site 1 annotation for " . $dateStart->toString();
         $site2Text = "{$count}: Site 2 annotation for " . $dateStart->toString();
         API::getInstance()->add($this->idSite1, $dateStart->toString(), $site1Text, $starred);
         API::getInstance()->add($this->idSite2, $dateStart->toString(), $site2Text, $starred);
         $nextDay = $dateStart->addDay(1);
         ++$count;
         $starred = $count % 3 == 0 ? 1 : 0;
         $site1Text = "{$count}: Site 1 annotation for " . $nextDay->toString();
         $site2Text = "{$count}: Site 2 annotation for " . $nextDay->toString();
         API::getInstance()->add($this->idSite1, $nextDay->toString(), $site1Text, $starred);
         API::getInstance()->add($this->idSite2, $nextDay->toString(), $site2Text, $starred);
         $dateStart = $dateStart->addPeriod(1, 'WEEK');
         ++$count;
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:28,代码来源:TwoSitesWithAnnotations.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->recreateContainerWithWebEnvironment();
     $this->initHostAndQueryString($input);
     if ($this->isTestModeEnabled()) {
         $indexFile = '/tests/PHPUnit/proxy/';
         $this->resetDatabase();
     } else {
         $indexFile = '/';
     }
     $indexFile .= 'index.php';
     if (!empty($_GET['pid'])) {
         $process = new Process($_GET['pid']);
         if ($process->hasFinished()) {
             return;
         }
         $process->startProcess();
     }
     if ($input->getOption('superuser')) {
         StaticContainer::addDefinitions(array('observers.global' => \DI\add(array(array('Environment.bootstrapped', function () {
             Access::getInstance()->setSuperUserAccess(true);
         })))));
     }
     require_once PIWIK_INCLUDE_PATH . $indexFile;
     if (!empty($process)) {
         $process->finishProcess();
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:RequestCommand.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:8,代码来源:ArchiveProcessingTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('SitesManager'));
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:9,代码来源:VisitTest.php

示例6: makeSureTestRunsInContextOfAnonymousUser

 private function makeSureTestRunsInContextOfAnonymousUser()
 {
     Piwik::postEvent('Request.initAuthenticationObject');
     $access = Access::getInstance();
     $this->hasSuperUserAccess = $access->hasSuperUserAccess();
     $access->setSuperUserAccess(false);
     $access->reloadAccess(StaticContainer::get('Piwik\\Auth'));
     Request::reloadAuthUsingTokenAuth(array('token_auth' => 'anonymous'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:APITest.php

示例7: migratePluginEmailUpdateSetting

 private function migratePluginEmailUpdateSetting()
 {
     $isEnabled = Option::get('enableUpdateCommunicationPlugins');
     Access::doAsSuperUser(function () use($isEnabled) {
         $settings = StaticContainer::get('Piwik\\Plugins\\CoreUpdater\\SystemSettings');
         $settings->sendPluginUpdateEmail->setValue(!empty($isEnabled));
         $settings->save();
     });
 }
开发者ID:piwik,项目名称:piwik,代码行数:9,代码来源:3.0.0-b1.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $access = Access::getInstance();
     $access->setSuperUserAccess(true);
     $this->idSiteAccess = APISitesManager::getInstance()->addSite("test", "http://test");
     \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('MultiSites', 'VisitsSummary', 'Actions'));
     \Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:9,代码来源:MultiSitesTest.php

示例9: testGetUnit

 /**
  * @dataProvider getUnitColumns
  * @group Core
  */
 public function testGetUnit($column, $expected)
 {
     \Piwik\Site::setSites(array(1 => array('name' => 'TestSite', 'currency' => 'EUR')));
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     $actual = Metrics::getUnit($column, 1);
     $this->assertEquals($expected, $actual);
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:13,代码来源:MetricsTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $pseudoMockAccess = new \FakeAccess();
     \FakeAccess::setSuperUserAccess(true);
     Access::setSingletonInstance($pseudoMockAccess);
     $idSite = Fixture::createWebsite('2014-01-01 00:00:00');
     $this->builder = $this->makeBuilder(array('method' => 'MultiSites_getAll', 'idSite' => $idSite));
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:9,代码来源:RssRendererTest.php

示例11: hasAccessToSameSite

 private function hasAccessToSameSite($login)
 {
     // users is allowed to see other users having view or admin access to these sites
     if (!isset($this->idSitesWithAdmin)) {
         $this->idSitesWithAdmin = $this->access->getSitesIdWithAdminAccess();
         $this->usersWithAdminAccess = $this->model->getUsersSitesFromAccess('admin');
         $this->usersWithViewAccess = $this->model->getUsersSitesFromAccess('view');
     }
     return isset($this->usersWithViewAccess[$login]) && array_intersect($this->idSitesWithAdmin, $this->usersWithViewAccess[$login]) || isset($this->usersWithAdminAccess[$login]) && array_intersect($this->idSitesWithAdmin, $this->usersWithAdminAccess[$login]);
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:10,代码来源:UserAccessFilter.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     //finally we set the user as a Super User by default
     Access::setSingletonInstance($pseudoMockAccess);
     $this->idSiteAccess = APISitesManager::getInstance()->addSite("test", "http://test");
     \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('ScheduledReports', 'MobileMessaging', 'MultiSites'));
     \Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:12,代码来源:MobileMessagingTest.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::setIdSitesView(array(1, 2));
     FakeAccess::setIdSitesAdmin(array(3, 4));
     //finally we set the user as a Super User by default
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     $this->auth = new Auth();
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:12,代码来源:LoginTest.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->api = API::getInstance();
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     $this->api->addUser('userLogin', 'password', 'userlogin@password.de');
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:12,代码来源:APITest.php

示例15: testDynamicResolverSitesCreated

 /**
  * NOTE: This test must be last since the new sites that get added are added in
  *       random order.
  */
 public function testDynamicResolverSitesCreated()
 {
     self::$fixture->logVisitsWithDynamicResolver();
     // reload access so new sites are viewable
     Access::getInstance()->setSuperUserAccess(true);
     // make sure sites aren't created twice
     $piwikDotNet = API::getInstance()->getSitesIdFromSiteUrl('http://piwik.net');
     $this->assertEquals(1, count($piwikDotNet));
     $anothersiteDotCom = API::getInstance()->getSitesIdFromSiteUrl('http://anothersite.com');
     $this->assertEquals(1, count($anothersiteDotCom));
     $whateverDotCom = API::getInstance()->getSitesIdFromSiteUrl('http://whatever.com');
     $this->assertEquals(1, count($whateverDotCom));
 }
开发者ID:ahdinosaur,项目名称:analytics.dinosaur.is,代码行数:17,代码来源:ImportLogsTest.php


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