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

[eluser]Kevin Phillips[/eluser]
Using Ion 2

Small problem, first the function $this->ion_auth->is_group($group) should be in_group().
I think I remember seeing this elsewhere. However a problem exists if you pass an array of groups.

Currently is_group returns in_array($check_group, $groups) which won't work if check_group is an array.

Solution:
application/libraries/Icon_auth.php

Add condition to check if $check_groups is an array and if it is then walk through the array checking for a match.
Code:
public function in_group($check_group)
{
$this->ci->ion_auth_model->trigger_events('is_group');

    $users_groups = $this->ci->ion_auth_model->get_users_groups();
    $groups = array();
    foreach ($users_groups as $group)
    {
        $groups[] = $group->name;
    }
    $permission = false;
    if(is_array($check_group)) {
        foreach($check_group as $key => $value){
            if(in_array($value, $groups)) {
                $permission = true;
            }
        }
    } else {
        if(in_array($check_group, $groups)) {
            $permission = true;
        }
    }
    return $permission;
}

Otherwise love your work


Messages In This Thread
Ion Auth - Lightweight Auth System based on Redux Auth 2 - by El Forum - 08-18-2011, 03:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB