Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]gscharlemann[/eluser]
I'm getting some weird results with the is_admin function in the Ion_Auth library.

I setup another controller: tracker.php

In tracker->view_items() I have:
Code:
public function view_items()
{
    $data['my_location'] = "admin";
    $data['page_title'] = "View Items";

    echo "is admin? = '". $this->ion_auth->is_admin() ."'<br>";
    if(!$this->ion_auth->logged_in() AND !$this->ion_auth->is_admin())
    {
        redirect('auth/login', 'refresh');
    }

    ...
}
A "member" user was not being redirected, so I added the print statement to see if I could figure out why. The call to $this->ion_auth->is_admin() doesn't produce anything.

I added a few print statements to the ion_auth->is_admin function:
Code:
public function is_admin()
{
    $admin_group = $this->ci->config->item('admin_group');
    $user_group  = $this->ci->session->userdata('group');

    echo "admin_group = " . $admin_group . "<br>";
    echo "user_group = " . $user_group . "<br>";

    return $user_group == $admin_group;
}

At the end of the day, the page that the "member" user views (which is an admin page and should be redirected) prints the following:

admin_group = admin
user_group = members
is admin? = ''

I can't figure out why ion_auth->is_admin() is not working... I'm not sure what else to look at.


Messages In This Thread
Ion Auth - Lightweight Auth System based on Redux Auth 2 - by El Forum - 03-31-2010, 04:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB