if (Arrays.asList(user.getRoles()).contains("ROLE_TECH")) {
SecurityProfile sp = new SecurityProfile(user);
LimsUtils.inheritUsersAndGroups(study, project.getSecurityProfile());
study.setSecurityProfile(sp);
} else {
study.inheritPermissions(project);
}
if (!study.userCanWrite(user)) {
throw new SecurityException("Permission denied.");
}