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 445555eff8b01658e96acdce28600abfd1dace38 Author: Dan Haywood <[email protected]> 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 ); }
