Welcome Guest, Not a member yet? Register   Sign In
Implementing RBAC for ion_auth codeigniter
#1

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.
Reply
#2

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
Reply
#3

(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 ?
Reply
#4

None that I know of. Those are the big ones.
Reply
#5

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;
}
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Reply
#6

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




Theme © iAndrew 2016 - Forum software by © MyBB