Search in sources :

Example 6 with InsufficientPermissionException

use of org.akaza.openclinica.web.InsufficientPermissionException in project OpenClinica by OpenClinica.

the class ViewSectionDataEntryPreview method mayProceed.

/**
     * Checks whether the user has the correct privilege. This is from
     * ViewSectionDataEntryServlet.
     */
@Override
public void mayProceed(HttpServletRequest request, HttpServletResponse response) throws InsufficientPermissionException {
    UserAccountBean ub = (UserAccountBean) request.getSession().getAttribute(USER_BEAN_NAME);
    StudyUserRoleBean currentRole = (StudyUserRoleBean) request.getSession().getAttribute("userRole");
    if (ub.isSysAdmin()) {
        return;
    }
    if (currentRole.getRole().equals(Role.STUDYDIRECTOR) || currentRole.getRole().equals(Role.COORDINATOR) || currentRole.getRole().equals(Role.INVESTIGATOR) || currentRole.getRole().equals(Role.RESEARCHASSISTANT) || currentRole.getRole().equals(Role.RESEARCHASSISTANT2)) {
        return;
    }
    addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"), request);
    throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString("not_director"), "1");
}
Also used : StudyUserRoleBean(org.akaza.openclinica.bean.login.StudyUserRoleBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException)

Example 7 with InsufficientPermissionException

use of org.akaza.openclinica.web.InsufficientPermissionException in project OpenClinica by OpenClinica.

the class DownloadAttachedFileServlet method mayProceed.

/**
     * Checks whether the user has the correct privilege
     */
@Override
public void mayProceed() throws InsufficientPermissionException {
    Locale locale = LocaleResolver.getLocale(request);
    FormProcessor fp = new FormProcessor(request);
    if (ub.isSysAdmin()) {
        return;
    }
    if (SubmitDataServlet.mayViewData(ub, currentRole)) {
        return;
    }
    request.setAttribute("downloadStatus", "false");
    addPageMessage(respage.getString("you_not_have_permission_download_attached_file"));
    throw new InsufficientPermissionException(Page.DOWNLOAD_ATTACHED_FILE, resexception.getString("no_permission"), "1");
}
Also used : Locale(java.util.Locale) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException)

Example 8 with InsufficientPermissionException

use of org.akaza.openclinica.web.InsufficientPermissionException in project OpenClinica by OpenClinica.

the class ImportCRFDataServlet method mayProceed.

// < ResourceBundleresword,resexception,respage;
/**
     *
     */
@Override
public void mayProceed() throws InsufficientPermissionException {
    checkStudyLocked(Page.MENU_SERVLET, respage.getString("current_study_locked"));
    checkStudyFrozen(Page.MENU_SERVLET, respage.getString("current_study_frozen"));
    locale = LocaleResolver.getLocale(request);
    if (ub.isSysAdmin()) {
        return;
    }
    Role r = currentRole.getRole();
    if (r.equals(Role.STUDYDIRECTOR) || r.equals(Role.COORDINATOR) || r.equals(Role.INVESTIGATOR) || r.equals(Role.RESEARCHASSISTANT) || r.equals(Role.RESEARCHASSISTANT2)) {
        return;
    }
    addPageMessage(respage.getString("no_have_correct_privilege_current_study") + respage.getString("change_study_contact_sysadmin"));
    throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString("may_not_submit_data"), "1");
}
Also used : Role(org.akaza.openclinica.bean.core.Role) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException)

Example 9 with InsufficientPermissionException

use of org.akaza.openclinica.web.InsufficientPermissionException in project OpenClinica by OpenClinica.

the class ImportRuleServlet method mayProceed.

@Override
public void mayProceed() throws InsufficientPermissionException {
    locale = LocaleResolver.getLocale(request);
    if (ub.isSysAdmin()) {
        return;
    }
    Role r = currentRole.getRole();
    if (r.equals(Role.STUDYDIRECTOR) || r.equals(Role.COORDINATOR)) {
        return;
    }
    addPageMessage(respage.getString("no_have_correct_privilege_current_study") + respage.getString("change_study_contact_sysadmin"));
    throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString("may_not_submit_data"), "1");
}
Also used : Role(org.akaza.openclinica.bean.core.Role) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException)

Example 10 with InsufficientPermissionException

use of org.akaza.openclinica.web.InsufficientPermissionException in project OpenClinica by OpenClinica.

the class MarkEventCRFCompleteServlet method mayProceed.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.control.core.SecureController#mayProceed()
     */
@Override
protected void mayProceed() throws InsufficientPermissionException {
    locale = LocaleResolver.getLocale(request);
    // <
    // resexception=ResourceBundle.getBundle(
    // "org.akaza.openclinica.i18n.exceptions",locale);
    // < respage =
    // ResourceBundle.getBundle("org.akaza.openclinica.i18n.page_messages",
    // locale);
    // < resword =
    // ResourceBundle.getBundle("org.akaza.openclinica.i18n.words",locale);
    fp = new FormProcessor(request);
    if (currentRole.equals(Role.COORDINATOR) || currentRole.equals(Role.STUDYDIRECTOR)) {
        return;
    }
    getEventCRFBean();
    Role r = currentRole.getRole();
    if (ecb.getStage().equals(DataEntryStage.INITIAL_DATA_ENTRY)) {
        if (ecb.getOwnerId() != ub.getId() && !r.equals(Role.COORDINATOR) && !r.equals(Role.STUDYDIRECTOR)) {
            request.setAttribute(TableOfContentsServlet.INPUT_EVENT_CRF_BEAN, ecb);
            addPageMessage(respage.getString("not_mark_CRF_complete6"));
            throw new InsufficientPermissionException(Page.TABLE_OF_CONTENTS_SERVLET, resexception.getString("not_study_owner"), "1");
        }
    } else if (ecb.getStage().equals(DataEntryStage.DOUBLE_DATA_ENTRY)) {
        if (ecb.getValidatorId() != ub.getId() && !r.equals(Role.COORDINATOR) && !r.equals(Role.STUDYDIRECTOR)) {
            request.setAttribute(TableOfContentsServlet.INPUT_EVENT_CRF_BEAN, ecb);
            addPageMessage(respage.getString("not_mark_CRF_complete7"));
            throw new InsufficientPermissionException(Page.TABLE_OF_CONTENTS_SERVLET, resexception.getString("not_study_owner"), "1");
        }
    }
    return;
}
Also used : Role(org.akaza.openclinica.bean.core.Role) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException)

Aggregations

InsufficientPermissionException (org.akaza.openclinica.web.InsufficientPermissionException)43 Role (org.akaza.openclinica.bean.core.Role)25 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)14 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)12 StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)10 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)10 ArrayList (java.util.ArrayList)8 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)8 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)8 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)7 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)6 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)6 HttpSession (javax.servlet.http.HttpSession)5 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)5 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)5 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)5 DateFormat (java.text.DateFormat)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 List (java.util.List)4