d671b463 by Zelig

登陆权限bug

1 parent d8b678f2
...@@ -24,15 +24,12 @@ if(!function_exists('hasRole')) { ...@@ -24,15 +24,12 @@ if(!function_exists('hasRole')) {
24 function hasRole($roles = []) { 24 function hasRole($roles = []) {
25 $CI = &get_instance(); 25 $CI = &get_instance();
26 $CI->load->helper('cookie'); 26 $CI->load->helper('cookie');
27 $login_user = get_cookie('login_user'); 27 $login_user = api('system/user/loginUser');
28 if($login_user) { 28 foreach($login_user->roleKeys as $v){
29 $login_user = json_decode($login_user, true); 29 if(in_array($v, $roles)){
30 foreach($login_user['roleKeys'] as $v){ 30 return true;
31 if(in_array($v, $roles)){
32 return true;
33 }
34 } 31 }
35 return false;
36 } 32 }
33 return false;
37 } 34 }
38 } 35 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!