登陆权限bug
Showing
1 changed file
with
2 additions
and
5 deletions
| ... | @@ -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); | ||
| 30 | foreach($login_user['roleKeys'] as $v){ | ||
| 31 | if(in_array($v, $roles)){ | 29 | if(in_array($v, $roles)){ |
| 32 | return true; | 30 | return true; |
| 33 | } | 31 | } |
| 34 | } | 32 | } |
| 35 | return false; | 33 | return false; |
| 36 | } | 34 | } |
| 37 | } | ||
| 38 | } | 35 | } | ... | ... |
-
Please register or sign in to post a comment