@Test public void testUnhandledStreamType() { mockery.checking(new Expectations() { { allowing(stream).getType(); will(returnValue(EntityType.APPLICATION)); } }); boolean result = sut.authorize(PERSON_ANYONE, activity, ActivityInteractionType.COMMENT); mockery.assertIsSatisfied(); assertFalse(result); }
public boolean authorize(final long userId, final ActivityDTO activity, final ActivityInteractionType interactionType) { switch (activity.getDestinationStream().getType()) { case PERSON: return authorizeForPersonStream(userId, activity, interactionType); case GROUP: return authorizeForGroupStream(userId, activity, interactionType); case RESOURCE: return true; default: return false; } }
ActivityInteractionAuthorizationStrategy { public boolean authorize(final long userId, final ActivityDTO activity, final ActivityInteractionType interactionType) { switch (activity.getDestinationStream().getType()) { case PERSON: return authorizeForPersonStream(userId, activity, interactionType); case GROUP: return authorizeForGroupStream(userId, activity, interactionType); case RESOURCE: return true; default: return false; } } }
ActivityInteractionAuthorizationStrategy { public boolean authorize(final long userId, final ActivityDTO activity, final ActivityInteractionType interactionType) { switch (activity.getDestinationStream().getType()) { case PERSON: return authorizeForPersonStream(userId, activity, interactionType); case GROUP: return authorizeForGroupStream(userId, activity, interactionType); case RESOURCE: return true; default: return false; } } ActivityInteractionAuthorizationStrategy(final DomainMapper<Long, PersonModelView> inGetPersonByIdDAO,
            final DomainMapper<Long, DomainGroupModelView> inGetGroupByIdDAO,
            final DomainMapper<Long, List<Long>> inGroupFollowersDAO,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordDAO); }
ActivityInteractionAuthorizationStrategy { public boolean authorize(final long userId, final ActivityDTO activity, final ActivityInteractionType interactionType) { switch (activity.getDestinationStream().getType()) { case PERSON: return authorizeForPersonStream(userId, activity, interactionType); case GROUP: return authorizeForGroupStream(userId, activity, interactionType); case RESOURCE: return true; default: return false; } } ActivityInteractionAuthorizationStrategy(final DomainMapper<Long, PersonModelView> inGetPersonByIdDAO,
            final DomainMapper<Long, DomainGroupModelView> inGetGroupByIdDAO,
            final DomainMapper<Long, List<Long>> inGroupFollowersDAO,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordDAO); boolean authorize(final long userId, final ActivityDTO activity,
            final ActivityInteractionType interactionType); boolean authorize(final ActivityDTO activity, final ActivityInteractionType interactionType,
            final boolean strict); }
ActivityInteractionAuthorizationStrategy { public boolean authorize(final long userId, final ActivityDTO activity, final ActivityInteractionType interactionType) { switch (activity.getDestinationStream().getType()) { case PERSON: return authorizeForPersonStream(userId, activity, interactionType); case GROUP: return authorizeForGroupStream(userId, activity, interactionType); case RESOURCE: return true; default: return false; } } ActivityInteractionAuthorizationStrategy(final DomainMapper<Long, PersonModelView> inGetPersonByIdDAO,
            final DomainMapper<Long, DomainGroupModelView> inGetGroupByIdDAO,
            final DomainMapper<Long, List<Long>> inGroupFollowersDAO,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordDAO); boolean authorize(final long userId, final ActivityDTO activity,
            final ActivityInteractionType interactionType); boolean authorize(final ActivityDTO activity, final ActivityInteractionType interactionType,
            final boolean strict);  }