コード例 #1
0
ファイル: access_hook.php プロジェクト: frosoco/frosoco-local
 public static function post_controller_constructor()
 {
     self::$CI->load->helper('access');
     self::$CI->load->helper('remote_user');
     $routing =& load_class('Router');
     $class = $routing->fetch_class();
     $method = $routing->fetch_method();
     $action = array('class' => $class, 'method' => $method);
     $remote_user = get_remote_user();
     if ($remote_user !== NULL && isset($_GET["user_id"])) {
         self::redirect_self();
     }
     if (is_action_public($action)) {
         return true;
     }
     if ($remote_user == NULL && !is_action_public($action)) {
         self::redirect_login();
         return false;
     }
     if (can_do($remote_user['access_group'], $action)) {
         return true;
     }
     self::redirect_access_denied();
     return false;
 }
コード例 #2
0
 function remote_user_can_do($action)
 {
     $remote_user = get_remote_user();
     if ($remote_user == NULL) {
         $remote_user = array('access_group' => 'PUBLIC');
     }
     return can_do($remote_user['access_group'], $action);
 }
コード例 #3
0
 function is_action_public($action)
 {
     return can_do('PUBLIC', $action);
 }