assertFilterPermission(Permissions.DELETE, ownerUser, filter.getId(), true);
assertFilterPermission(Permissions.DELETE, anotherUser, filter.getId(), false);
}
protected User createTestUser(String userId) {
User user = identityService.newUser(userId);
identityService.saveUser(user);
// give user all permission to manipulate authorisations
Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
authorization.setUserId(user.getId());
authorization.setResource(Resources.AUTHORIZATION);
authorization.setResourceId(Authorization.ANY);
authorization.addPermission(Permissions.ALL);
authorizationService.saveAuthorization(authorization);
// give user all permission to manipulate users
authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
authorization.setUserId(user.getId());
authorization.setResource(Resources.USER);
authorization.setResourceId(Authorization.ANY);
authorization.addPermission(Permissions.ALL);
authorizationService.saveAuthorization(authorization);