开发者

Use complex expression with Spring EL (conditional & parenthesis)

I'm using spring-EL with spring security

Is it possible to make 'complex' conditional expressions wit开发者_如何转开发h parentesis?

@PreAuthorize("( hasRole('ROLE_USER') and ( isOwnerDocumentUUID( #docUuids ) ) or hasRole('ROLE_ADMIN')  ")

throw an java.lang.IllegalArgumentException:

Failed to parse expression

but

@PreAuthorize("hasRole('ROLE_USER') and ( isOwnerDocumentUUID( #docUuids ) ")

is accepted.


You have one extra (, the following should work:

@PreAuthorize("( hasRole('ROLE_USER') and isOwnerDocumentUUID( #docUuids ) ) or hasRole('ROLE_ADMIN')  ") 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜