You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/05/22 22:12:23 UTC
(causeway-app-petclinic) 04/07: adds new PetOwnerModuleSuperuserRole, makes sven user a member
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/causeway-app-petclinic.git
commit 382f70c558b4dcd8dde2acb1c0c114d054f8dfa5
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue May 21 10:42:05 2024 +0100
adds new PetOwnerModuleSuperuserRole, makes sven user a member
---
.../webapp/application/seed/CustomRolesAndUsers.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/webapp/src/main/java/domainapp/webapp/application/seed/CustomRolesAndUsers.java b/webapp/src/main/java/domainapp/webapp/application/seed/CustomRolesAndUsers.java
index da6cd6a..1d4d11c 100644
--- a/webapp/src/main/java/domainapp/webapp/application/seed/CustomRolesAndUsers.java
+++ b/webapp/src/main/java/domainapp/webapp/application/seed/CustomRolesAndUsers.java
@@ -20,9 +20,28 @@ public class CustomRolesAndUsers extends FixtureScript {
protected void execute(ExecutionContext executionContext) {
executionContext.executeChildren(this,
new SimpleModuleSuperuserRole(),
+ new PetOwnerModuleSuperuserRole(),
new SvenUser());
}
+ private static class PetOwnerModuleSuperuserRole extends AbstractRoleAndPermissionsFixtureScript {
+
+ public static final String ROLE_NAME = "petowner-superuser";
+
+ public PetOwnerModuleSuperuserRole() {
+ super(ROLE_NAME, "Permission to use everything in the 'petowner' module");
+ }
+
+ @Override
+ protected void execute(ExecutionContext executionContext) {
+ newPermissions(
+ ApplicationPermissionRule.ALLOW,
+ ApplicationPermissionMode.CHANGING,
+ Can.of(ApplicationFeatureId.newNamespace("petowner"))
+ );
+ }
+ }
+
private static class SimpleModuleSuperuserRole extends AbstractRoleAndPermissionsFixtureScript {
public static final String ROLE_NAME = "simple-superuser";
@@ -51,6 +70,7 @@ public class CustomRolesAndUsers extends FixtureScript {
public Can<String> get() {
return Can.of(
causewayConfiguration.getExtensions().getSecman().getSeed().getRegularUser().getRoleName(), // built-in stuff
+ PetOwnerModuleSuperuserRole.ROLE_NAME,
SimpleModuleSuperuserRole.ROLE_NAME
);
}