ResourceTypePermissionValidator { public boolean satisfyDependancies(PermissionCollection pc, ResourceType resourceType, ResourceAction resourceAction) { return resourceDependancy(resourceType, resourceAction).map(permissionAction -> { ResourceAction dependantAction = permissionAction.getDependantAction(); if (dependantAction != null) { org.uberfire.security.authz.Permission permission = permissionManager.createPermission(resourceType, dependantAction, true); return pc.implies(permission); } return true; }).orElse(true); } ResourceTypePermissionValidator(); @Inject  ResourceTypePermissionValidator(@Customizable final AppFormerActivities appFormerActivities, final OrganizationalUnitService organizationalUnitService,
                                           final WorkspaceProjectService projectService, final PermissionManager permissionManager); Set<Map.Entry<ResourceType, List<PermissionAction>>> getPermissionEntries(); boolean isPermissionAllowed(ResourceType resourceType, ResourceAction permissionType); Optional<PermissionAction> resourceDependancy(ResourceType resourceType, ResourceAction permissionType); boolean satisfyDependancies(PermissionCollection pc, ResourceType resourceType, ResourceAction resourceAction); boolean isValidResourceType(ResourceType resourceType, String resourceId);  }
@Test public void testSatisfyDependancy() { PermissionCollection permissionCollection = mock(PermissionCollection.class); Permission p = mock(Permission.class); when(permissionManager.createPermission(OrganizationalUnit.RESOURCE_TYPE, READ, true)).thenReturn(p); when(permissionCollection.implies(p)).thenReturn(true); assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, UPDATE)); assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, CREATE)); assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, BUILD)); }