feat: add support for multiple permissions check for users by sammyskills · Pull Request #791 · codeigniter4/shield · GitHub
Skip to content

feat: add support for multiple permissions check for users#791

Merged
kenjis merged 7 commits into
codeigniter4:developfrom
sammyskills:support-multiple-permissions
Aug 22, 2023
Merged

feat: add support for multiple permissions check for users#791
kenjis merged 7 commits into
codeigniter4:developfrom
sammyskills:support-multiple-permissions

Conversation

@sammyskills

@sammyskills sammyskills commented Aug 16, 2023

Copy link
Copy Markdown
Contributor

Added support for multiple permissions check for users via the Authorizable trait.

With this pull request, instead of writing:

if ($user->can('user.create') || $user->can('user.edit')){
    //
}

we use this:

if ($user->can('user.create', 'user.edit')){
    //
}

@datamweb datamweb added the enhancement New feature or request label Aug 17, 2023
@datamweb datamweb changed the title Add support for multiple permissions check for users. feat: add support for multiple permissions check for users Aug 17, 2023
Comment thread tests/Authorization/AuthorizableTest.php Outdated
Comment thread docs/authorization.md Outdated
@sammyskills sammyskills requested a review from datamweb August 17, 2023 23:23
Comment thread src/Authorization/Traits/Authorizable.php Outdated
@sammyskills sammyskills requested a review from kenjis August 18, 2023 06:45
Comment thread docs/authorization.md Outdated
@kenjis

kenjis commented Aug 21, 2023

Copy link
Copy Markdown
Member

@jozefrebjak

Copy link
Copy Markdown
Contributor

@sammyskills maybe add test also for wildcard case users.*

sammyskills and others added 2 commits August 21, 2023 08:40
@sammyskills sammyskills force-pushed the support-multiple-permissions branch from 8ae0f85 to 6d9e5be Compare August 21, 2023 07:52
@sammyskills

Copy link
Copy Markdown
Contributor Author

@sammyskills maybe add test also for wildcard case users.*

Yes, you are correct @jozefrebjak. I have added that now.

@datamweb datamweb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@sammyskills and @jozefrebjak thanks.

@kenjis kenjis merged commit f334a92 into codeigniter4:develop Aug 22, 2023
@kenjis

kenjis commented Aug 22, 2023

Copy link
Copy Markdown
Member

@sammyskills sammyskills deleted the support-multiple-permissions branch August 22, 2023 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants