roles icon indicating copy to clipboard operation
roles copied to clipboard

"If user has all roles" doc section confusing

Open mkarnicki opened this issue 8 years ago • 2 comments

Hi. The section of the documentation here says:

if($user->isAll('admin|forum.moderator')){
        // do something
    }

yet, it contains an alternative symbol ( | ). That's actually confusing, as | would then be ignored in this case? Perhaps you could clarify the behavior in the docs. In my mind, this should throw an exception (you're asking for all, yet using incorrect symbol in the list). Cheers.

mkarnicki avatar May 16 '17 15:05 mkarnicki

It throws \HttpOz\Roles\Exceptions\RoleDeniedException or \HttpOz\Roles\Exceptions\GroupDeniedException exceptions if it goes wrong.

'if it goes wrong' is also not very descriptive. I know I should file a separate bug, but since this affects documentation, I thought I'd leave a comment here. What happens when the user has a role and belongs to a group that doesn't have that role, does the group middleware still fail?

mkarnicki avatar May 16 '17 16:05 mkarnicki

Hey @mkarnicki I'll look at this shortly.

httpoz avatar May 17 '17 12:05 httpoz