use of ca.corefacility.bioinformatics.irida.events.annotations.LaunchesProjectEvent in project irida by phac-nml.
the class ProjectServiceImpl method updateUserProjectRole.
/**
* {@inheritDoc}
*/
@Override
@Transactional
@LaunchesProjectEvent(UserRoleSetProjectEvent.class)
@PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#project,'canManageLocalProjectSettings')")
public Join<Project, User> updateUserProjectRole(Project project, User user, ProjectRole projectRole) throws ProjectWithoutOwnerException {
ProjectUserJoin projectJoinForUser = pujRepository.getProjectJoinForUser(project, user);
if (projectJoinForUser == null) {
throw new EntityNotFoundException("Join between this project and user does not exist. User: " + user + " Project: " + project);
}
if (!allowRoleChange(projectJoinForUser.getSubject(), projectJoinForUser.getProjectRole())) {
throw new ProjectWithoutOwnerException("This role change would leave the project without an owner");
}
projectJoinForUser.setProjectRole(projectRole);
return pujRepository.save(projectJoinForUser);
}
use of ca.corefacility.bioinformatics.irida.events.annotations.LaunchesProjectEvent in project irida by phac-nml.
the class SequencingObjectServiceImpl method createSequencingObjectInSample.
/**
* {@inheritDoc}
*/
@Override
@Transactional
@PreAuthorize("hasPermission(#sample, 'canUpdateSample')")
@LaunchesProjectEvent(DataAddedToSampleProjectEvent.class)
public SampleSequencingObjectJoin createSequencingObjectInSample(SequencingObject seqObject, Sample sample) {
// create the sequencing object
seqObject = create(seqObject);
// save the new join
SampleSequencingObjectJoin sampleSequencingObjectJoin = new SampleSequencingObjectJoin(sample, seqObject);
return ssoRepository.save(sampleSequencingObjectJoin);
}
Aggregations