當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。