ReleasePermissions extends DocumentPermissions<Release> { @Override public boolean isActionAllowed(RequestedAction action) { if (action == RequestedAction.WRITE_ECC) { return PermissionUtils.isUserAtLeast(UserGroup.ECC_ADMIN, user); } else { return getStandardPermissions(action); } } protected  ReleasePermissions(Release document, User user); @Override void fillPermissions(Release other, Map<RequestedAction, Boolean> permissions); @Override boolean isActionAllowed(RequestedAction action);  }
@Test public void testEccPermission() { ReleasePermissions permissions = new ReleasePermissions(release, user); when(user.getUserGroup()).thenReturn(UserGroup.ECC_ADMIN); assertThat(permissions.isActionAllowed(RequestedAction.WRITE_ECC), is(true)); when(user.getUserGroup()).thenReturn(UserGroup.CLEARING_ADMIN); assertThat(permissions.isActionAllowed(RequestedAction.WRITE_ECC), is(false)); }