Ejemplo n.º 1
0
  /**
   * @see
   *     org.kuali.kra.protocol.document.authorizer.CommitteeAuthorizerBase#isAuthorized(java.lang.String,
   *     org.kuali.kra.protocol.document.authorization.CommitteeTaskBase)
   */
  public boolean isAuthorized(String userId, CommitteeTaskBase task) {
    boolean hasPermission = true;
    CommitteeBase committee = task.getCommittee();
    if (committee.getId() == null) {

      // We have to consider the case when we are saving the committee for the first time.

      hasPermission =
          hasUnitPermission(
              userId, getModuleNamespaceCodeHook(), getPermissionNameForAddCommiteeHook());
    } else {
      /*
       * After the initial save, the committee can only be modified has the required permission.
       */
      hasPermission =
          !committee.getCommitteeDocument().isViewOnly()
              && !isPessimisticLocked(committee.getCommitteeDocument())
              && hasPermission(userId, committee, getPermissionNameForModifyCommitteeHook());
    }

    // Verify that document is not locked
    if (isPessimisticLocked(committee.getCommitteeDocument())) {
      hasPermission = false;
    }

    return hasPermission;
  }
Ejemplo n.º 2
0
  /** This method is UI view hook. */
  public void prepareView() {
    if (committeeForm.getCommitteeDocument().getDocumentHeader().getWorkflowDocument().isFinal()
        || committeeForm
            .getCommitteeDocument()
            .getDocumentHeader()
            .getWorkflowDocument()
            .isEnroute()
        || committeeForm
            .getCommitteeDocument()
            .getDocumentHeader()
            .getWorkflowDocument()
            .isCanceled()) {
      modifyCommittee = false;
      CommitteeBase activeCommittee =
          getCommitteeService().getCommitteeById(getCommittee().getCommitteeId());
      if (activeCommittee != null && activeCommittee.getId().equals(getCommittee().getId())) {
        modifySchedule = canModifySchedule();
        viewSchedule = canViewSchedule();
        viewSpecificSchedule = canViewSpecificSchedule();
      } else {
        // inactive committee can not access schedule data either
        modifySchedule = false;
        viewSchedule = false;
        viewSpecificSchedule = canNotViewSpecificSchedule();
      }
    } else {
      modifyCommittee = canModifyCommittee();
      modifySchedule = false;
      viewSchedule = false;
      viewSpecificSchedule = canNotViewSpecificSchedule();
    }
    prepareCommitteeScheduleDeleteView();

    performAction = canPerformAction();
    initPrintCorrespondences();
  }