Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Help with SimpleGroup
  • Hi, I've got SimpleAuth working but can't get my head around how get instances of SimpleGroup to check the roles of the current user. Can anyone point me in the right direction? Thanks!
  • Answering my own question because I eventually worked it out and couldn't find this info anywhere else. To get the group or acl driver access them via Auth $group_driver = \Auth::group('SimpleGroup');
    $acl_driver = \Auth::acl('SimpleAcl'); At the time of writing the master branch of SimpleGroup has some bugs in the get_name(...) and get_roles(...) functions so use the develop branch if possible. P.S. Sorry couldn't get the code formatting to work :(
  • Isn't there a simpler way for retrieving the group?
    as I tried Auth::member($id) but doesn't work.
  • Code tags are (without spaces): [ code] & [/ code] If you want the current group/acl driver those are indeed correct, but you should also be able to request them like this (without the specific drivers):
    $group_driver = \Auth::group();
    $acl_driver = \Auth::acl();
    

    If you want to check for specific group or rights:
    \Auth::member(5); // checks if current logged in user is a member of group 5
    \Auth::has_access(array('website', array('read'))); // checks if the logged in user has access to 'website' with rights 'read'
    
  • @Muts - I haven't had any luck either.
  • Still no solution :) Anyone able to help us on this? thanks
  • Is there any way to get the group of the currently logged in user? EDIT:
    Sorry, I found it.
    $groups = Auth::instance()->get_user_groups();
    $default_group = $groups[0][1];
    

Howdy, Stranger!

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

In this Discussion