Exemple #1
0
 public static function getAccessList($group_id, $user_pids = '')
 {
     if ($user_pids != '') {
         $user_pids = json_decode($user_pids, true);
     } else {
         $user_pids = array();
     }
     if (isset($this->cache)) {
         $groups = $this->cache->get('user.roles');
         $purviews = $this->cache->get('user.purviews');
     }
     if (empty($groups)) {
         $groups = GroupModel::getGroupsByCache();
         //Role::getRoles();
     }
     if (empty($purviews)) {
         $purviews = PurviewModel::getPurviewsByCache();
     }
     if (empty($groups)) {
         return array();
     }
     $group_pids = $groups[$group_id]['purviews'];
     if ($group_pids != 'all') {
         $group_pids = json_decode($group_pids, true);
         $pids = is_array($group_pids) && is_array($user_pids) ? array_merge($group_pids, $user_pids) : array();
     }
     $ret = array();
     foreach ($purviews as $_k => $_v) {
         if ($group_pids == 'all' || in_array($_v['purview_id'], $pids)) {
             $ret[] = $_v['identify_tree'];
         }
     }
     return $ret;
 }