Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SimpleAcl and SimpleGroup example?
  • My first post! I just started to create my own CMS and over all it's going well. Fantastic framework even when still in beta. The namespace thingy is confusing me a bit but I'll learn that eventually. But I was wondering before I go all crazy, does the acl and group actually work or is it a work in progress? If it works (even though not finished) is there any example code to use 'em? I'm already using the Auth for logins but would like to user acl and groups... I was trying but I didn't succeed. Again thumbs up for this framework. I'll be here for a while ;) Thanks in advance,
    Ranie
  • huglester - just wanted to say that I found your examples very helpful - thanks! I've got my groups and permissions all set up now and it was indeed pretty simple. Still though, it would be really helpful to have something in the docs on this. The pages on groups and acl are still blank. Thanks!
  • Seconded - anyone got any real world examples of simpleACL being used?
  • It isn't that complicated (hence the name simple): Every user is assigned a group. Group's are defined in the config file simpleauth.php. The default group is 1, which is, as you can see in the config file, a plain user. The config file also defines the roles that are assigned to those groups. You'll see that only the role 'user' is assigned to the group 'user'. It also shows you that by default, everyone has 'read' permission on 'website', and in addition to that, the user role has 'create' and 'read' permissions on 'comments'. Given this information, you can for example check if the current user has 'read' permission on 'website' by using
    \Auth::has_access(array('website', array('read'))); // checks if the logged in user has access to 'website' with rights 'read'
    
  • Are the location=>rights pairs defined in the Roles section of the config file tied to controller/action or are they arbitrary?
  • You can create your own structure. Store your file in app/config, so you don't loose your settings when you update the package.
  • Hello, in short, I have smth like this in the my extentended controller in before() method, so I can check all pages easily:
    http://scrp.at/6k and the simple auth snip looks like this:
    http://scrp.at/6l hope that helps you :) Good luck!
  • Hello, can you show me please how to use this things? any working sample as a reference? thanks
  • Hi huglester ... the link is broken, can you please update it to a working one, i'll also need to take a look at your example.

    Thx

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion