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


PHP Piwik::isUserHasSomeAdminAccess方法代码示例

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


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

示例1: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $menu->addManageItem('UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), $order = 2);
         $menu->addManageItem('UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), $order = 3);
     }
 }
开发者ID:emersonmatsumoto,项目名称:piwik,代码行数:7,代码来源:Menu.php

示例2: demo

 public function demo()
 {
     if (!Development::isEnabled() || !Piwik::isUserHasSomeAdminAccess()) {
         return;
     }
     return $this->renderTemplate('demo');
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:Controller.php

示例3: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $menu->addManageItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 2);
         $menu->addManageItem('UsersManager_MenuUserSettings', $this->urlForAction('userSettings'), $order = 3);
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:7,代码来源:Menu.php

示例4: configureUserMenu

 public function configureUserMenu(MenuUser $menu)
 {
     $menu->registerMenuIcon('UsersManager_MenuPersonal', 'icon-user-personal');
     $menu->registerMenuIcon('CoreAdminHome_MenuManage', 'icon-user-manage');
     $menu->registerMenuIcon('CorePluginsAdmin_MenuPlatform', 'icon-user-platform');
     if (Development::isEnabled() && Piwik::isUserHasSomeAdminAccess()) {
         $menu->addPlatformItem('UI Demo', $this->urlForAction('demo'), $order = 15);
     }
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:9,代码来源:Menu.php

示例5: addMenu

 function addMenu()
 {
     MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1);
     MenuAdmin::getInstance()->add('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 10);
     MenuAdmin::getInstance()->add('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5);
     MenuAdmin::getInstance()->add('General_Settings', 'CoreAdminHome_MenuGeneralSettings', array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), Piwik::isUserHasSomeAdminAccess(), $order = 6);
     MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'CoreAdminHome_TrackingCode', array('module' => 'CoreAdminHome', 'action' => 'trackingCodeGenerator'), Piwik::isUserHasSomeAdminAccess(), $order = 4);
     MenuAdmin::getInstance()->add('General_Settings', 'CoreAdminHome_PluginSettings', array('module' => 'CoreAdminHome', 'action' => 'pluginSettings'), SettingsManager::hasPluginsSettingsForCurrentUser(), $order = 7);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:9,代码来源:CoreAdminHome.php

示例6: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $menu->addManageItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 2);
     }
     if (Piwik::hasUserSuperUserAccess() && API::getInstance()->getSitesAccessFromUser('anonymous')) {
         $menu->addSettingsItem('UsersManager_AnonymousUser', $this->urlForAction('anonymousSettings'), $order = 20);
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:Menu.php

示例7: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     $hasAdminAccess = Piwik::isUserHasSomeAdminAccess();
     $menu->add('CoreAdminHome_MenuManage', null, "", $hasAdminAccess, $order = 1);
     $menu->add('CoreAdminHome_MenuDiagnostic', null, "", $hasAdminAccess, $order = 10);
     $menu->add('General_Settings', null, "", $hasAdminAccess, $order = 5);
     $menu->add('General_Settings', 'CoreAdminHome_MenuGeneralSettings', array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), $hasAdminAccess, $order = 6);
     $menu->add('CoreAdminHome_MenuManage', 'CoreAdminHome_TrackingCode', array('module' => 'CoreAdminHome', 'action' => 'trackingCodeGenerator'), $hasAdminAccess, $order = 4);
     $menu->add('General_Settings', 'CoreAdminHome_PluginSettings', array('module' => 'CoreAdminHome', 'action' => 'pluginSettings'), SettingsManager::hasPluginsSettingsForCurrentUser(), $order = 7);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:10,代码来源:Menu.php

示例8: configureTopMenu

 public function configureTopMenu(MenuTop $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $url = $this->urlForModuleAction('SitesManager', 'index');
         if (Piwik::hasUserSuperUserAccess()) {
             $url = $this->urlForAction('generalSettings');
         }
         $menu->addItem('CoreAdminHome_Administration', null, $url, 10);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:10,代码来源:Menu.php

示例9: index

 /**
  * The "Manage Users and Permissions" Admin UI screen
  */
 function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@UsersManager/index');
     $IdSitesAdmin = APISitesManager::getInstance()->getSitesIdWithAdminAccess();
     $idSiteSelected = 1;
     if (count($IdSitesAdmin) > 0) {
         $defaultWebsiteId = $IdSitesAdmin[0];
         $idSiteSelected = Common::getRequestVar('idSite', $defaultWebsiteId);
     }
     if ($idSiteSelected === 'all') {
         $usersAccessByWebsite = array();
         $defaultReportSiteName = Piwik::translate('UsersManager_ApplyToAllWebsites');
     } else {
         $usersAccessByWebsite = APIUsersManager::getInstance()->getUsersAccessFromSite($idSiteSelected);
         $defaultReportSiteName = Site::getNameFor($idSiteSelected);
     }
     // we dont want to display the user currently logged so that the user can't change his settings from admin to view...
     $currentlyLogged = Piwik::getCurrentUserLogin();
     $usersLogin = APIUsersManager::getInstance()->getUsersLogin();
     foreach ($usersLogin as $login) {
         if (!isset($usersAccessByWebsite[$login])) {
             $usersAccessByWebsite[$login] = 'noaccess';
         }
     }
     unset($usersAccessByWebsite[$currentlyLogged]);
     // $usersAccessByWebsite is not supposed to contain unexistant logins, but it does when upgrading from some old Piwik version
     foreach ($usersAccessByWebsite as $login => $access) {
         if (!in_array($login, $usersLogin)) {
             unset($usersAccessByWebsite[$login]);
             continue;
         }
     }
     ksort($usersAccessByWebsite);
     $users = array();
     $usersAliasByLogin = array();
     if (Piwik::isUserHasSomeAdminAccess()) {
         $users = APIUsersManager::getInstance()->getUsers();
         foreach ($users as $user) {
             $usersAliasByLogin[$user['login']] = $user['alias'];
         }
     }
     $view->anonymousHasViewAccess = $this->hasAnonymousUserViewAccess($usersAccessByWebsite);
     $view->idSiteSelected = $idSiteSelected;
     $view->defaultReportSiteName = $defaultReportSiteName;
     $view->users = $users;
     $view->usersAliasByLogin = $usersAliasByLogin;
     $view->usersCount = count($users) - 1;
     $view->usersAccessByWebsite = $usersAccessByWebsite;
     $websites = APISitesManager::getInstance()->getSitesWithAdminAccess();
     uasort($websites, array('Piwik\\Plugins\\UsersManager\\Controller', 'orderByName'));
     $view->websites = $websites;
     $this->setBasicVariablesView($view);
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:58,代码来源:Controller.php

示例10: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $type = $this->getFirstTypeIfOnlyOneIsInUse();
         $menuName = 'General_Measurables';
         if ($type) {
             $menuName = $type->getNamePlural();
         }
         $menu->addManageItem($menuName, $this->urlForAction('index'), $order = 1);
     }
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:11,代码来源:Menu.php

示例11: configureAdminMenu

 public function configureAdminMenu(MenuAdmin $menu)
 {
     if (Piwik::isUserHasSomeAdminAccess()) {
         $menu->addSystemItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 15);
     }
     if (Piwik::hasUserSuperUserAccess() && API::getInstance()->getSitesAccessFromUser('anonymous')) {
         $menu->addSystemItem('UsersManager_AnonymousUser', $this->urlForAction('anonymousSettings'), $order = 16);
     }
     if (!Piwik::isUserIsAnonymous()) {
         $menu->addItem('UsersManager_MenuPersonal', 'General_Settings', $this->urlForAction('userSettings'), 0);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:12,代码来源:Menu.php

示例12: notifyAnyInvalidLicense

 private static function notifyAnyInvalidLicense()
 {
     if (!Marketplace::isMarketplaceEnabled()) {
         return;
     }
     if (Piwik::isUserIsAnonymous()) {
         return;
     }
     if (!Piwik::isUserHasSomeAdminAccess()) {
         return;
     }
     $expired = StaticContainer::get('Piwik\\Plugins\\Marketplace\\Plugins\\InvalidLicenses');
     $messageLicenseMissing = $expired->getMessageNoLicense();
     if (!empty($messageLicenseMissing)) {
         $notification = new Notification($messageLicenseMissing);
         $notification->raw = true;
         $notification->context = Notification::CONTEXT_ERROR;
         $notification->title = Piwik::translate('Marketplace_LicenseMissing');
         Notification\Manager::notify('ControllerAdmin_LicenseMissingWarning', $notification);
     }
     $messageExceeded = $expired->getMessageExceededLicenses();
     if (!empty($messageExceeded)) {
         $notification = new Notification($messageExceeded);
         $notification->raw = true;
         $notification->context = Notification::CONTEXT_WARNING;
         $notification->title = Piwik::translate('Marketplace_LicenseExceeded');
         Notification\Manager::notify('ControllerAdmin_LicenseExceededWarning', $notification);
     }
     $messageExpired = $expired->getMessageExpiredLicenses();
     if (!empty($messageExpired)) {
         $notification = new Notification($messageExpired);
         $notification->raw = true;
         $notification->context = Notification::CONTEXT_WARNING;
         $notification->title = Piwik::translate('Marketplace_LicenseExpired');
         Notification\Manager::notify('ControllerAdmin_LicenseExpiredWarning', $notification);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:37,代码来源:ControllerAdmin.php

示例13: setBasicVariablesView

 /**
  * Assigns a set of generally useful variables to a {@link Piwik\View} instance.
  * 
  * The following variables assigned:
  * 
  * **enableMeasurePiwikForSiteId** - The value of the `[Debug] enable_measure_piwik_usage_in_idsite`
  *                                     INI config option.
  * **isSuperUser** - True if the current user is the Super User, false if otherwise.
  * **hasSomeAdminAccess** - True if the current user has admin access to at least one site,
  *                          false if otherwise.
  * **isCustomLogo** - The value of the `branding_use_custom_logo` option.
  * **logoHeader** - The header logo URL to use.
  * **logoLarge** - The large logo URL to use.
  * **logoSVG** - The SVG logo URL to use.
  * **hasSVGLogo** - True if there is a SVG logo, false if otherwise.
  * **enableFrames** - The value of the `[General] enable_framed_pages` INI config option. If
  *                    true, {@link Piwik\View::setXFrameOptions()} is called on the view.
  * 
  * Also calls {@link setHostValidationVariablesView()}.
  *
  * @param View $view
  * @api
  */
 protected function setBasicVariablesView($view)
 {
     $view->clientSideConfig = PiwikConfig::getInstance()->getClientSideOptions();
     $view->enableMeasurePiwikForSiteId = PiwikConfig::getInstance()->Debug['enable_measure_piwik_usage_in_idsite'];
     $view->isSuperUser = Access::getInstance()->hasSuperUserAccess();
     $view->hasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
     $view->hasSomeViewAccess = Piwik::isUserHasSomeViewAccess();
     $view->isUserIsAnonymous = Piwik::isUserIsAnonymous();
     $view->hasSuperUserAccess = Piwik::hasUserSuperUserAccess();
     $this->addCustomLogoInfo($view);
     $view->logoHeader = \Piwik\Plugins\API\API::getInstance()->getHeaderLogoUrl();
     $view->logoLarge = \Piwik\Plugins\API\API::getInstance()->getLogoUrl();
     $view->logoSVG = \Piwik\Plugins\API\API::getInstance()->getSVGLogoUrl();
     $view->hasSVGLogo = \Piwik\Plugins\API\API::getInstance()->hasSVGLogo();
     $view->superUserEmails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
     $general = PiwikConfig::getInstance()->General;
     $view->enableFrames = $general['enable_framed_pages'] || isset($general['enable_framed_logins']) && $general['enable_framed_logins'];
     if (!$view->enableFrames) {
         $view->setXFrameOptions('sameorigin');
     }
     self::setHostValidationVariablesView($view);
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:45,代码来源:Controller.php

示例14: index

 /**
  * The "Manage Users and Permissions" Admin UI screen
  */
 function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@UsersManager/index');
     $IdSitesAdmin = APISitesManager::getInstance()->getSitesIdWithAdminAccess();
     $idSiteSelected = 1;
     if (count($IdSitesAdmin) > 0) {
         $defaultWebsiteId = $IdSitesAdmin[0];
         $idSiteSelected = Common::getRequestVar('idSite', $defaultWebsiteId);
     }
     if ($idSiteSelected === 'all') {
         $usersAccessByWebsite = array();
         $defaultReportSiteName = $this->translator->translate('UsersManager_ApplyToAllWebsites');
     } else {
         $defaultReportSiteName = Site::getNameFor($idSiteSelected);
         try {
             $usersAccessByWebsite = Request::processRequest('UsersManager.getUsersAccessFromSite', array('idSite' => $idSiteSelected));
         } catch (NoAccessException $e) {
             return $this->noAdminAccessToWebsite($idSiteSelected, $defaultReportSiteName, $e->getMessage());
         }
     }
     // we dont want to display the user currently logged so that the user can't change his settings from admin to view...
     $currentlyLogged = Piwik::getCurrentUserLogin();
     $usersLogin = APIUsersManager::getInstance()->getUsersLogin();
     foreach ($usersLogin as $login) {
         if (!isset($usersAccessByWebsite[$login])) {
             $usersAccessByWebsite[$login] = 'noaccess';
         }
     }
     unset($usersAccessByWebsite[$currentlyLogged]);
     // $usersAccessByWebsite is not supposed to contain unexistant logins, but it does when upgrading from some old Piwik version
     foreach ($usersAccessByWebsite as $login => $access) {
         if (!in_array($login, $usersLogin)) {
             unset($usersAccessByWebsite[$login]);
             continue;
         }
     }
     ksort($usersAccessByWebsite);
     $users = array();
     $superUsers = array();
     $usersAliasByLogin = array();
     $formatter = new Formatter();
     if (Piwik::isUserHasSomeAdminAccess()) {
         $view->showLastSeen = true;
         $users = APIUsersManager::getInstance()->getUsers();
         foreach ($users as $index => $user) {
             $usersAliasByLogin[$user['login']] = $user['alias'];
             $lastSeen = LastSeenTimeLogger::getLastSeenTimeForUser($user['login']);
             $users[$index]['last_seen'] = $lastSeen == 0 ? false : $formatter->getPrettyTimeFromSeconds(time() - $lastSeen);
         }
         if (Piwik::hasUserSuperUserAccess()) {
             foreach ($users as $user) {
                 if ($user['superuser_access']) {
                     $superUsers[] = $user['login'];
                 }
             }
         }
     }
     $view->anonymousHasViewAccess = $this->hasAnonymousUserViewAccess($usersAccessByWebsite);
     $view->idSiteSelected = $idSiteSelected;
     $view->defaultReportSiteName = $defaultReportSiteName;
     $view->users = $users;
     $view->superUserLogins = $superUsers;
     $view->usersAliasByLogin = $usersAliasByLogin;
     $view->usersCount = count($users) - 1;
     $view->usersAccessByWebsite = $usersAccessByWebsite;
     $websites = APISitesManager::getInstance()->getSitesWithAdminAccess();
     uasort($websites, array('Piwik\\Plugins\\UsersManager\\Controller', 'orderByName'));
     $view->websites = $websites;
     $this->setBasicVariablesView($view);
     return $view->render();
 }
开发者ID:Joey3000,项目名称:piwik,代码行数:75,代码来源:Controller.php

示例15: render

 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsAnonymous = Piwik::isUserIsAnonymous();
         $this->userIsSuperUser = Piwik::hasUserSuperUserAccess();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         $piwikAds = StaticContainer::get('Piwik\\ProfessionalServices\\Advertising');
         $this->areAdsForProfessionalServicesEnabled = $piwikAds->areAdsForProfessionalServicesEnabled();
         if (Development::isEnabled()) {
             $cacheBuster = rand(0, 10000);
         } else {
             $cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster();
         }
         $this->cacheBuster = $cacheBuster;
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($this->userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         Log::debug($e);
         // can fail, for example at installation (no plugin loaded yet)
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     Common::sendHeader('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads
     // - when calling sendHeader() multiple times, the last one prevails
     Common::sendHeader('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:41,代码来源:View.php


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