Community Auth: User Accounts & Groups |
I have SaaS-type app in mind where, ideally, I would like to segregate access to certain resources (i.e. designated file stores, databases etc.) based off of what group a user is associated with. So with that in mind...
(11-02-2015, 05:01 PM)8obby6igita1 Wrote: I have SaaS-type app in mind where, ideally, I would like to segregate access to certain resources (i.e. designated file stores, databases etc.) based off of what group a user is associated with. So with that in mind... If you take a look at the way groups work in Community Auth, you'll see that a group is just a set of roles. You get to name your groups whatever you want, and when you authenticate by group, all Community Auth is doing is cross referencing the roles that belong in the group, and then making sure one of those roles matches the user attempting to login. Nothing fancy going on here. So, lets say you have multiple types of employees: PHP Code: $config['groups'] = array( Any role can be a member of any group, just as long as you add it to the comma delimited list. In my apps I've used a group called "Team", which was used for a selection of employees. Another group for higher level employees was named "Management". While not implemented, it wouldn't be hard to use config_item() to get the groups, then determine if your logged in user is a member of a specific group(s). Because a role can be part of more than one group, you'd probably want to loop through all of the groups to see how many groups the logged in user belongs to. Such a feature has not been added to Community Auth, and probably won't be, unless it is requested by a few individuals. There aren't auth variables for groups because in the years that I've worked with and used Community Auth, I've never needed such a feature. If you're interested in doing some work and creating a pull request, I wouldn't mind doing something similar for groups, but it's low on my list of things to do. The previous version of Community Auth implemented user "profiles", and these profiles had data that was stored in separate tables. I've promised to show people how to implement these profiles in the current version of Community Auth, but for now please view the old version to see how it was done.
FYI, I made a little blog post about profiles today:
http://community-auth.com/blog-posts/int...r-profiles |
Welcome Guest, Not a member yet? Register Sign In |