Esempio n. 1
0
  public Approval toApproval(CRApproval crApproval) {
    if (crApproval == null) return Approval.automaticApproval();

    Approval approval;
    if (crApproval.getType() == CRApprovalCondition.manual) approval = Approval.manualApproval();
    else approval = Approval.automaticApproval();

    AuthConfig authConfig = approval.getAuthConfig();
    for (String user : crApproval.getAuthorizedUsers()) {
      authConfig.add(new AdminUser(new CaseInsensitiveString(user)));
    }
    for (String user : crApproval.getAuthorizedRoles()) {
      authConfig.add(new AdminRole(new CaseInsensitiveString(user)));
    }

    return approval;
  }