Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public class EnrollmentService {
    private static final AuthEvaluator IS_SELF_ADMIN_OR_STUDY_RESEARCHER = 
        AuthUtils.canAccessStudy().inRole(RESEARCHER).or()
            .inAnyRole(ADMIN, SUPERADMIN).or()
            isSelf();

    public PagedResourceList<EnrollmentDetail> getEnrollments(...) {
        IS_SELF_ADMIN_OR_STUDY_RESEARCHER.checkAndThrow("studyId", studyId);
    }
    
    public Enrollment enroll(...) {
        IS_SELF_ADMIN_OR_STUDY_RESEARCHER.checkAndThrow("studyId", studyId);
    }
    
    public void updateEnrollment(...) {
        IS_SELF_ADMIN_OR_STUDY_RESEARCHER.checkAndThrow("studyId", studyId);
    }
    
    public Enrollment unenroll(...) {
        IS_SELF_ADMIN_OR_STUDY_RESEARCHER.checkAndThrow("studyId", studyId);
    }
}

...