@Test public void test() { context.checking(new Expectations() { { oneOf(entityIdTransformer).transform(actionContext); will(returnValue("1")); oneOf(actionContext).getPrincipal(); will(returnValue(principal)); oneOf(principal).getId(); will(returnValue(0L)); oneOf(entityPermissionsChecker).hasCoordinatorAccessRecursively(0L, 1L); will(returnValue(true)); } }); assertTrue(sut.execute(actionContext)); context.assertIsSatisfied(); }
@Override public Boolean execute(final PrincipalActionContext inActionContext) { Long entityId = Long.valueOf((String) entityIdTransformer.transform(inActionContext)); Long personId = inActionContext.getPrincipal().getId(); boolean hasAccess = entityPermissionsChecker.hasCoordinatorAccessRecursively(personId, entityId); log.info("PersonId: " + personId + " " + (hasAccess ? "has" : "does not have") + " access to entity with entityId: " + entityId); return hasAccess; }
CoordinatorAccessAuthorizerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { Long entityId = Long.valueOf((String) entityIdTransformer.transform(inActionContext)); Long personId = inActionContext.getPrincipal().getId(); boolean hasAccess = entityPermissionsChecker.hasCoordinatorAccessRecursively(personId, entityId); log.info("PersonId: " + personId + " " + (hasAccess ? "has" : "does not have") + " access to entity with entityId: " + entityId); return hasAccess; } }
CoordinatorAccessAuthorizerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { Long entityId = Long.valueOf((String) entityIdTransformer.transform(inActionContext)); Long personId = inActionContext.getPrincipal().getId(); boolean hasAccess = entityPermissionsChecker.hasCoordinatorAccessRecursively(personId, entityId); log.info("PersonId: " + personId + " " + (hasAccess ? "has" : "does not have") + " access to entity with entityId: " + entityId); return hasAccess; } CoordinatorAccessAuthorizerExecution(final RequestTransformer inEntityIdtransformer,
            final CoordinatorAccessAuthorizer<Long, Long> inEntityPermissionsChecker); }
CoordinatorAccessAuthorizerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { Long entityId = Long.valueOf((String) entityIdTransformer.transform(inActionContext)); Long personId = inActionContext.getPrincipal().getId(); boolean hasAccess = entityPermissionsChecker.hasCoordinatorAccessRecursively(personId, entityId); log.info("PersonId: " + personId + " " + (hasAccess ? "has" : "does not have") + " access to entity with entityId: " + entityId); return hasAccess; } CoordinatorAccessAuthorizerExecution(final RequestTransformer inEntityIdtransformer,
            final CoordinatorAccessAuthorizer<Long, Long> inEntityPermissionsChecker); @Override Boolean execute(final PrincipalActionContext inActionContext); }
CoordinatorAccessAuthorizerExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { Long entityId = Long.valueOf((String) entityIdTransformer.transform(inActionContext)); Long personId = inActionContext.getPrincipal().getId(); boolean hasAccess = entityPermissionsChecker.hasCoordinatorAccessRecursively(personId, entityId); log.info("PersonId: " + personId + " " + (hasAccess ? "has" : "does not have") + " access to entity with entityId: " + entityId); return hasAccess; } CoordinatorAccessAuthorizerExecution(final RequestTransformer inEntityIdtransformer,
            final CoordinatorAccessAuthorizer<Long, Long> inEntityPermissionsChecker); @Override Boolean execute(final PrincipalActionContext inActionContext);  }