Thanks, I have read the docs and dug really deep into this before posting. But, I'm still having some trouble with this. Something I should mention, not sure if it matters but, no user is logged in. In my app/config/auth.php return array( 'driver' => 'Ormauth', 'verify_multiple_logins' => false, 'salt' => 'saltysaltsalt', 'iterations' => 10000, );
The app/config/ormauth.php is default.
Here is the result of $user = \Auth::validate_user(\Input::param('username'), \Input::param('login-password')) as an array:
So then I tried: if ($user = \Auth::validate_user(\Input::param('username'), \Input::param('login-password'))) { // the login credentials are valid if(\Auth::member(7, array('ormauth', $user))) { echo 'not in group 7'; } else { echo 'in group 7'; } }
Prints 'not in group 7'.
Ok, so I tried to changing the $user object after realizing I was sending it wrong: if(\Auth::member(7, array('Ormauth', (int)$user->id))) { echo 'in group 7'; } else { echo 'not in group 7'; }
and it printed 'not in group 7'.
Hmm... now I'm pretty confused.
So I made this code to test: if(\Auth::member(7, array('ormauth', 35))) { echo 'in group 7'; } else { echo 'not in group 7'; }
Ok, so I tried to changing the $user object after realizing I was sending it wrong: if(\Auth::member(7, array('ormauth', (int)$user->id))) { echo 'in group 7'; } else { echo 'not in group 7'; }
and it printed 'not in group 7'.
So I made this code to test: if(\Auth::member(7, array('ormauth', 35))) { echo 'in group 7'; } else { echo 'not in group 7'; }
Had to dive into the code to see what exactly happens, and it seems I'm wrong.
If you pass a driver/user combination, all it uses is the driver info, to fetch an alternative list of groups. It ignores any user information you pass to it, it hard-coded checks the current logged-in user.
I would consider this a bug, I'll see if I can find time to fix this.