Closed joha0123 closed 7 years ago
By adding them only in one group... I guess...
from documentaion of ion_auth
# single group (by name)
$group = 'gangstas';
if (!$this->ion_auth->in_group($group))
{
$this->session->set_flashdata('message', 'You must be a gangsta to view this page');
redirect('welcome/index');
}
# single group (by id)
$group = 1;
if (!$this->ion_auth->in_group($group))
{
$this->session->set_flashdata('message', 'You must be part of the group 1 to view this page');
redirect('welcome/index');
}
# multiple groups (by name)
$group = array('gangstas', 'hoodrats');
if (!$this->ion_auth->in_group($group))
$this->session->set_flashdata('message', 'You must be a gangsta OR a hoodrat to view this page');
redirect('welcome/index');
}
# multiple groups (by id)
$group = array(1, 2);
if (!$this->ion_auth->in_group($group))
$this->session->set_flashdata('message', 'You must be a part of group 1 or 2 to view this page');
redirect('welcome/index');
}
# multiple groups (by id and name)
$group = array('gangstas', 2);
if (!$this->ion_auth->in_group($group))
$this->session->set_flashdata('message', 'You must be a part of the gangstas or group 2');
redirect('welcome/index');
}
# multiple groups (by id) and check if all exist
$group = array(1, 2);
if (!$this->ion_auth->in_group($group, false, true))
$this->session->set_flashdata('message', 'You must be a part of group 1 and 2 to view this page');
redirect('welcome/index');
}
Hi, in my application i have three groups (admins, clients, employees). The groups are disjunct. How can i make sure, that a user cannot be in the clients and employees group?