Closed ikramkhizar closed 4 years ago
You mean is_member(), you can check with this functions if an user is member of a desired group, e.g. is_member('customer')
i have to check for a group like admin is a group and customer is also a group so i want to check like this aauth->is_customer? is it possible?
Hi @ikramkhizar actually you can extend and create a function inside your your controller file (such as My_Controller) and create functions that u want.
i tried to extend is_admin() function in aauth file but it won't work.
can you please guide me properly in detail?
function is_admin()
{
return is_member('admin');
}
Something like this, I presume.
I have tried this but it won't work.
Where did you placed this lines, inside the Aauth Class?
function is_admin()
{
return is_member('admin');
}
If you placed this inside Aauth Class, try this
public function is_admin()
{
return $this->is_member('admin');
}
also you can add this for a custom function
public function is_customer()
{
return $this->is_member('customer');
}
Where did you placed this lines, inside the Aauth Class?
function is_admin() { return is_member('admin'); }
If you placed this inside Aauth Class, try this
public function is_admin() { return $this->is_member('admin'); }
also you can add this for a custom function
public function is_customer() { return $this->is_member('customer'); }
it should have worked.
could i have to do this in application->libraries->aauth ?
should be yes, but you can create a helper for this too ^^
the content for the helper could look like this:
function is_admin()
{
$CII =& get_instance();
$CII->load->library('aauth');
return $CII->aauth->is_member('admin');
}
function is_customer()
{
$CII =& get_instance();
$CII->load->library('aauth');
return $CII->aauth->is_member('customer');
}
Hello Sir, first of all i love this library and having fun using it, i have a question i am using $this->aauth->is_admin() function it work's fine, i have another group for customer is there any possibilities to create a function like is_customer that validates if the user is customer ? if yes then how can you please guide ?