This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new c9383b1061 CAUSEWAY-3698: updates adoc example
c9383b1061 is described below
commit c9383b1061668aba7dd2b1415e1027384ef3d987
Author: Andi Huber <[email protected]>
AuthorDate: Thu Mar 21 12:44:31 2024 +0100
CAUSEWAY-3698: updates adoc example
---
.../src/main/adoc/modules/simple/pages/about.adoc | 41 ++++++++++++----------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/security/simple/src/main/adoc/modules/simple/pages/about.adoc
b/security/simple/src/main/adoc/modules/simple/pages/about.adoc
index 10d5f3b186..0745cb76c7 100644
--- a/security/simple/src/main/adoc/modules/simple/pages/about.adoc
+++ b/security/simple/src/main/adoc/modules/simple/pages/about.adoc
@@ -24,24 +24,29 @@ In your application's `AppManifest` (top-level Spring
`@Configuration` used to b
})
public class AppManifest {
- @Bean
- public SimpleRealm simpleRealm() {
- return new SimpleRealm()
- //roles
- .addRoleWithReadAndChange("admin_role", id->true)
- .addRoleWithReadAndChange("order_role", id->
- id.getFullIdentityString().contains("Order"))
- .addRoleWithReadAndChange("customer_role", id->
- id.getFullIdentityString().contains("Customer"))
- .addRoleWithReadOnly("reader_role", id->
- !id.getFullIdentityString().contains("TopSecret"))
- //users
- .addUser("sven", pwdhash, List.of("admin_role"))
- .addUser("dick", pwdhash, List.of("reader_role", "order_role"))
- .addUser("bob", pwdhash, List.of("reader_role", "customer_role"))
- .addUser("joe", pwdhash, List.of("reader_role"));
- }
-
+ @Bean
+ public SimpleRealm simpleRealm() {
+ return new SimpleRealm()
+ //roles
+ .addRole("admin_role", id->Grant.CHANGE)
+ .addRole("order_role", id->
+ id.getFullIdentityString().contains("Order")
+ ? Grant.CHANGE
+ : Grant.NONE)
+ .addRole("customer_role", id->
+ id.getFullIdentityString().contains("Customer")
+ ? Grant.CHANGE
+ : Grant.NONE)
+ .addRole("reader_role", id->
+ id.getFullIdentityString().contains("TopSecret")
+ ? Grant.NONE
+ : Grant.READ)
+ //users
+ .addUser("sven", pwdhash, List.of("admin_role"))
+ .addUser("dick", pwdhash, List.of("reader_role", "order_role"))
+ .addUser("bob", pwdhash, List.of("reader_role", "customer_role"))
+ .addUser("joe", pwdhash, List.of("reader_role"));
+ }
}
----