@Test(expected = AuthorizationException.class) public void testStreamIsNotPublicUserNotInGroup() { final List<Long> visibleIds = new LinkedList<Long>(); context.checking(new Expectations() { { allowing(actionContext).getPrincipal(); will(returnValue(principal)); allowing(principal).getId(); will(returnValue(principalId)); allowing(actionContext).getParams(); will(returnValue(activityId)); allowing(securityTrimmer).trim(with(any(List.class)), with(principalId)); will(returnValue(visibleIds)); } }); sut.authorize(actionContext); context.assertIsSatisfied(); }
public void authorize(final ServiceActionContext inActionContext) { if (securityTrimmer.trim(Arrays.asList((Long) inActionContext.getParams()), inActionContext.getPrincipal().getId()).size() == 0) { throw new AuthorizationException("Current user does not have access right to view activity."); } }
ViewActivityAuthorizationStrategy implements AuthorizationStrategy<ServiceActionContext> { public void authorize(final ServiceActionContext inActionContext) { if (securityTrimmer.trim(Arrays.asList((Long) inActionContext.getParams()), inActionContext.getPrincipal().getId()).size() == 0) { throw new AuthorizationException("Current user does not have access right to view activity."); } } }
ViewActivityAuthorizationStrategy implements AuthorizationStrategy<ServiceActionContext> { public void authorize(final ServiceActionContext inActionContext) { if (securityTrimmer.trim(Arrays.asList((Long) inActionContext.getParams()), inActionContext.getPrincipal().getId()).size() == 0) { throw new AuthorizationException("Current user does not have access right to view activity."); } } ViewActivityAuthorizationStrategy(final ActivitySecurityTrimmer inSecurityTrimmer); }
ViewActivityAuthorizationStrategy implements AuthorizationStrategy<ServiceActionContext> { public void authorize(final ServiceActionContext inActionContext) { if (securityTrimmer.trim(Arrays.asList((Long) inActionContext.getParams()), inActionContext.getPrincipal().getId()).size() == 0) { throw new AuthorizationException("Current user does not have access right to view activity."); } } ViewActivityAuthorizationStrategy(final ActivitySecurityTrimmer inSecurityTrimmer); void authorize(final ServiceActionContext inActionContext); }
ViewActivityAuthorizationStrategy implements AuthorizationStrategy<ServiceActionContext> { public void authorize(final ServiceActionContext inActionContext) { if (securityTrimmer.trim(Arrays.asList((Long) inActionContext.getParams()), inActionContext.getPrincipal().getId()).size() == 0) { throw new AuthorizationException("Current user does not have access right to view activity."); } } ViewActivityAuthorizationStrategy(final ActivitySecurityTrimmer inSecurityTrimmer); void authorize(final ServiceActionContext inActionContext);  }