Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
member of method
What do you think about adding a Auth::member_of($groups) where $groups = array.
Or still use Auth::member but add support for arrays.
The idea being that I have different auth controllers for different parts of the site.(public, private, moderators room, admin).
So an Admin as access to all.
A mod to private and mod areas.
A user to private.
I just wanted a quicker way to see if they can even access that area (auth controller). I pass in an array of group id's that are allowed to that area and it returns true or false it the user is a member of one of those groups.
Ideally you should not use membership for that (which is why such a method isn't there), but use assigned rghts (through roles) and has_access().
I guess I am doing it that way because of the "Admin" auto install. I was following its example.
As well it defines groups like users, admin, super admin and so on.
It kind of leads you to believe that is the way it was intended to be used.
Each section is very much it's on site in a way with it's own master templates controllers, views, css, js etc.
Yeah, that is how a lot of people use groups. Something I don't agree with.
For me, groups are a way to group otherwise unrelated users, so 'users' is fine as a group name. However, 'administrator', 'moderator', etc are roles a user performs, so you should use roles for that. Then to each role you assign the permissions.
This has another advantage: you can only assign one group to a user, but you can assign unlimited roles. So if your security model becomes more complex, using groups is going to become a problem, how are you going to translate having rights A,B,D,F but not C and E into a single flat group structure?
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion