Hi here my problem is to add conditional statements in @preauthorize spring annotation
,I need to give Users_view and Users_manage permission for principal but i cant add both permission like below
@PreAuthorize("hasPermission(#id, 'com.foo', 'USERS_VIEW','USERS_MANAGE')")
in @preauthorize ,I have an idea like below
@PreAuthorize("hasPermission(#id, 'com.foo', 'USERS_VIEW') OR hasPermission(#id, 'com.foo', 'USERS_VIEW')")
Will spring support conditional clauses in @preauthorize so if not what is the solution for this.(Here I need to use only @preauthorize rather than hasroles[])
Thanks in advance
Of course it will. But I have not tried in uppercase, in lowercase it is sure (I mean or instead of OR). See Logical operators section of the official documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With