在离子身份验证中检索组名称以进行重定向

时间:2013-11-02 21:02:05

标签: codeigniter authentication login ion

我是codeigniter的初学者,在这个系统上工作,有多个用户,如学术,财务,校长,导演等。我想要的是每个用户根据他的角色被定向到他自己的页面。这就是我到目前为止所做的事情

if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))          {
//if the login is successful
//redirect them back to the home page   
$this->session->set_flashdata('message', $this->ion_auth->messages());    
$user = $this->ion_auth->get_users_groups()->result();               
 switch ($user->name)
                    {
                        case ('admin'):
                            redirect(site_url('admin/index'), 'refresh');
                        break;
                        case ('academic'):
                            redirect(site_url('academic/dashboard'), 'refresh');
                        break;
                        case ('headmaster'):
                            redirect(site_url('headmaster/dashboard'), 'refresh');
                        break;
                        }
        }

我收到此错误 消息:尝试获取非对象的属性

也在尝试

switch($user['name'])

导致未定义的索引'名称'

任何人请

0 个答案:

没有答案