CodeIgniter Forums
Implementing RBAC for ion_auth codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forum-7.html)
+--- Forum: Addins (https://forum.codeigniter.com/forum-13.html)
+--- Thread: Implementing RBAC for ion_auth codeigniter (/thread-76165.html)



Implementing RBAC for ion_auth codeigniter - adeshina - 04-17-2020

Hi,
I am using ion_auth library for one of my web app projects. I find the library very useful and appreciate it.

I have settled everything and the system works well. But what i want to do is that i would like to implement RBAC model to manage the web app users access. I found the concept of group in ion_auth very interesting but i still can not achieve what i want to do. User is in a role, and permission is set for role. 

1- Right now i can add user to role(group) but i can not set permission to group(role). Do you have an idea of how to achieve this stuff ??

2- I found some RBAC library(like ezrbac) with codeigniter but i found them difficult to implement and some of them are not working. And may be you have a way to do that with ion_auth. So instead of looking for another library i will use ion_auth to do my work. If no, can you help me with how i can achieve RBAC with codeigniter based on your experience ?

Thank you so much in advance.


RE: Implementing RBAC for ion_auth codeigniter - jreklund - 04-18-2020

You may want to take a look at Community Auth instead. https://community-auth.com/

- Access Granted by Level / Role
- Access Granted by Role Group
- ACL for Finer Controlled Permissions


RE: Implementing RBAC for ion_auth codeigniter - adeshina - 04-18-2020

(04-18-2020, 05:51 AM)jreklund Wrote: You may want to take a look at Community Auth instead. https://community-auth.com/

- Access Granted by Level / Role
- Access Granted by Role Group
- ACL for Finer Controlled Permissions
Thank you.

Is there another library or system please ?


RE: Implementing RBAC for ion_auth codeigniter - jreklund - 04-18-2020

None that I know of. Those are the big ones.


RE: Implementing RBAC for ion_auth codeigniter - Leo - 04-18-2020

Just write your own check_login() function in MY_Controller - and specify what you need for different groups.
I did something simple along the lines of:

if ($this->ion_auth->in_group('moderator') || $this->ion_auth->is_admin()) {
return TRUE;
} else {
if(!$return) {
show_404('', 'Moderator access denied');
}
return FALSE;
}


RE: Implementing RBAC for ion_auth codeigniter - vzan8978 - 12-19-2020

Nice code. Thank you for sharing. It looks good on first sight.