Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND/OR mode for @Pattern constraint #88

Merged
merged 1 commit into from
Feb 28, 2018
Merged

AND/OR mode for @Pattern constraint #88

merged 1 commit into from
Feb 28, 2018

Conversation

mkurz
Copy link
Owner

@mkurz mkurz commented Feb 28, 2018

Fully backwards compatible.

Allows us to to write awesome stuff like:

// subject needs to have both permissions
@Pattern(value = { "curator.museum.insects", "killer.undead.zombie" }, mode = AND)

// subject needs to have one of these permissions
@Pattern(value = { "curator.museum.insects", "killer.undead.zombie" }, mode = OR)

Together with the deadbolt.java.constraint-mode setting this is really useful. E.g. you could set deadbolt.java.constraint-mode = AND, annotate the controller with @Restrict(...) to only allow certain roles and on the method you can then require that this role has x or y permission to access that action method. Nice.

@mkurz mkurz merged commit 46bc808 into mkurz:master Feb 28, 2018
@mkurz mkurz deleted the constraintModeInsideAnnotations branch February 28, 2018 11:26
@mkurz mkurz mentioned this pull request Feb 28, 2018
16 tasks
@eximius313
Copy link

Wouldn't be a problem if somebody was already using ConstraintMode from here: #87 ?

@mkurz
Copy link
Owner Author

mkurz commented Feb 28, 2018

That's ok, they are two different things. One is for global mode and one for the Pattern. Unfortunately we can't re-use because they have different values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants