@Test public void testAuthorizePass() { context.checking(new Expectations() { { allowing(actionContext).getPrincipal(); will(returnValue(principal)); allowing(principal).getAccountId(); will(returnValue(accountId)); allowing(actionContext).getParams(); will(returnValue(request)); allowing(request).getTabId(); will(returnValue(tabId)); allowing(tabPermission).canRenameTab(accountId, tabId, false); will(returnValue(true)); } }); sut.authorize(actionContext); context.assertIsSatisfied(); }
@Override public void authorize(final PrincipalActionContext inActionContext) { if (!tabPermission.canRenameTab(inActionContext.getPrincipal().getAccountId(), ((RenameTabRequest) inActionContext.getParams()).getTabId(), false)) { throw new AuthorizationException("Insufficient permissions to rename tab."); } }
RenameTabAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @Override public void authorize(final PrincipalActionContext inActionContext) { if (!tabPermission.canRenameTab(inActionContext.getPrincipal().getAccountId(), ((RenameTabRequest) inActionContext.getParams()).getTabId(), false)) { throw new AuthorizationException("Insufficient permissions to rename tab."); } } }
RenameTabAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @Override public void authorize(final PrincipalActionContext inActionContext) { if (!tabPermission.canRenameTab(inActionContext.getPrincipal().getAccountId(), ((RenameTabRequest) inActionContext.getParams()).getTabId(), false)) { throw new AuthorizationException("Insufficient permissions to rename tab."); } } RenameTabAuthorization(final TabPermission inTabPermission); }
RenameTabAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @Override public void authorize(final PrincipalActionContext inActionContext) { if (!tabPermission.canRenameTab(inActionContext.getPrincipal().getAccountId(), ((RenameTabRequest) inActionContext.getParams()).getTabId(), false)) { throw new AuthorizationException("Insufficient permissions to rename tab."); } } RenameTabAuthorization(final TabPermission inTabPermission); @Override void authorize(final PrincipalActionContext inActionContext); }
RenameTabAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @Override public void authorize(final PrincipalActionContext inActionContext) { if (!tabPermission.canRenameTab(inActionContext.getPrincipal().getAccountId(), ((RenameTabRequest) inActionContext.getParams()).getTabId(), false)) { throw new AuthorizationException("Insufficient permissions to rename tab."); } } RenameTabAuthorization(final TabPermission inTabPermission); @Override void authorize(final PrincipalActionContext inActionContext);  }