adamgriffiths / ag-auth

The Easiest Authentication Library for the CodeIgniter PHP Framework.

Home Page:http://www.adamgriffiths.co.uk/user_guide/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

insufficient group privileges / group_id issue

JadedEvan opened this issue · comments

Noticed a bug in the libraries/Auth.php file, near line 82:

Reads:
$user_level = $this->CI->session->userdata('group');

When it should be:
$user_level = $this->CI->session->userdata('group_id');

As in the login() function in the same file you set the session variable as 'group_id', not 'group'

Similarly, I added a redirect based on the user's group settings at the end of the login() function. Again there is trouble because of the group/group_id issue. Around line 143:
$auth_type => $username,
'username' => $row['username'],
'user_id' => $row['id'],
'group_id' => $row['group_id'],
'logged_in' => TRUE
);

Nowhere in that block is the 'group' being set. It'd be nice to access that instead of passing around the group_id.

I have fixed this issue in the latest commit to the repo. The correct reference for the group ID is 'group_id' not 'group'.

Hopefully this clears things up.

If you'd like to double check this in the repo I can close this issue then.

Thanks.