Пример #1
0
 /**
  * Constructor.
  *
  * @param string $name The setting's persisted name.
  * @param string $title The setting's display name.
  * @param null|string $userLogin The user this setting applies to. Will default to the current user login.
  */
 public function __construct($name, $title, $userLogin = null)
 {
     parent::__construct($name, $title);
     $this->setUserLogin($userLogin);
     $this->writableByCurrentUser = Piwik::isUserHasSomeViewAccess();
     $this->readableByCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #2
0
 /**
  * Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
  *
  * @return bool
  */
 public function isWritableByCurrentUser()
 {
     if (isset($this->hasReadAndWritePermission)) {
         return $this->hasReadAndWritePermission;
     }
     $this->hasReadAndWritePermission = Piwik::isUserHasSomeViewAccess();
     return $this->hasReadAndWritePermission;
 }
Пример #3
0
 /**
  * Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
  *
  * @return bool
  */
 public function isWritableByCurrentUser()
 {
     if (isset($this->hasWritePermission)) {
         return $this->hasWritePermission;
     }
     // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB.
     $this->hasWritePermission = Piwik::isUserHasSomeViewAccess();
     return $this->hasWritePermission;
 }
Пример #4
0
 /**
  * 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);
 }
Пример #5
0
 public function configureAdminMenu(MenuAdmin $menu)
 {
     $menu->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), Piwik::isUserHasSomeAdminAccess(), $order = 2);
     $menu->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), Piwik::isUserHasSomeViewAccess(), $order = 3);
 }
Пример #6
0
 /**
  * Constructor.
  *
  * @param string $name The persisted name of the setting.
  * @param string $title The display name of the setting.
  */
 public function __construct($name, $title)
 {
     parent::__construct($name, $title);
     $this->writableByCurrentUser = Piwik::isUserHasSomeAdminAccess();
     $this->readableByCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #7
0
 /**
  * Constructor.
  * 
  * @param string $name The setting's persisted name.
  * @param string $title The setting's display name.
  * @param null|string $userLogin The user this setting applies to. Will default to the current user login.
  */
 public function __construct($name, $title, $userLogin = null)
 {
     parent::__construct($name, $title);
     $this->setUserLogin($userLogin);
     $this->displayedForCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #8
0
 /**
  * Add admin menu items
  */
 function addMenu()
 {
     MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), Piwik::isUserHasSomeAdminAccess(), $order = 2);
     MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), Piwik::isUserHasSomeViewAccess(), $order = 3);
 }