getUsersSitesFromAccess() 공개 메소드

public getUsersSitesFromAccess ( $access )
예제 #1
0
파일: API.php 프로젝트: JoeHorn/piwik
 /**
  * For each user, returns the list of website IDs where the user has the supplied $access level.
  * If a user doesn't have the given $access to any website IDs,
  * the user will not be in the returned array.
  *
  * @param string Access can have the following values : 'view' or 'admin'
  *
  * @return array    The returned array has the format
  *                    array(
  *                        login1 => array ( idsite1,idsite2),
  *                        login2 => array(idsite2),
  *                        ...
  *                    )
  */
 public function getUsersSitesFromAccess($access)
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->checkAccessType($access);
     $userSites = $this->model->getUsersSitesFromAccess($access);
     $userSites = $this->userFilter->filterLoginIndexedArray($userSites);
     return $userSites;
 }
예제 #2
0
 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]);
 }
예제 #3
0
 /**
  * For each user, returns the list of website IDs where the user has the supplied $access level.
  * If a user doesn't have the given $access to any website IDs,
  * the user will not be in the returned array.
  *
  * @param string Access can have the following values : 'view' or 'admin'
  *
  * @return array    The returned array has the format
  *                    array(
  *                        login1 => array ( idsite1,idsite2),
  *                        login2 => array(idsite2),
  *                        ...
  *                    )
  */
 public function getUsersSitesFromAccess($access)
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->checkAccessType($access);
     return $this->model->getUsersSitesFromAccess($access);
 }