@@ -21,22 +21,32 @@ This provides some common expressions which are available in both web and method
21
21
|===
22
22
| Expression | Description
23
23
24
- | `hasRole([ role] )`
24
+ | `hasRole(String role)`
25
25
| Returns `true` if the current principal has the specified role.
26
+
27
+ For example, `hasRole('admin')`
28
+
26
29
By default if the supplied role does not start with 'ROLE_' it will be added.
27
30
This can be customized by modifying the `defaultRolePrefix` on `DefaultWebSecurityExpressionHandler`.
28
31
29
- | `hasAnyRole([role1,role2] )`
32
+ | `hasAnyRole(String... roles )`
30
33
| Returns `true` if the current principal has any of the supplied roles (given as a comma-separated list of strings).
34
+
35
+ For example, `hasAnyRole('admin', 'user')`
36
+
31
37
By default if the supplied role does not start with 'ROLE_' it will be added.
32
38
This can be customized by modifying the `defaultRolePrefix` on `DefaultWebSecurityExpressionHandler`.
33
39
34
- | `hasAuthority([ authority] )`
40
+ | `hasAuthority(String authority)`
35
41
| Returns `true` if the current principal has the specified authority.
36
42
37
- | `hasAnyAuthority([authority1,authority2])`
43
+ For example, `hasAuthority('read')`
44
+
45
+ | `hasAnyAuthority(String... authorities)`
38
46
| Returns `true` if the current principal has any of the supplied authorities (given as a comma-separated list of strings)
39
47
48
+ For example, `hasAnyAuthority('read', 'write')`
49
+
40
50
| `principal`
41
51
| Allows direct access to the principal object representing the current user
42
52
0 commit comments