Search in sources :

Example 6 with DocumentAuthorizer

use of org.kuali.kfs.kns.document.authorization.DocumentAuthorizer in project cu-kfs by CU-CommunityApps.

the class WebUtils method canViewNoteAttachment.

public static boolean canViewNoteAttachment(Document document, String attachmentTypeCode) {
    boolean canViewNoteAttachment = false;
    DocumentAuthorizer documentAuthorizer = KNSServiceLocator.getDocumentHelperService().getDocumentAuthorizer(document);
    canViewNoteAttachment = documentAuthorizer.canViewNoteAttachment(document, attachmentTypeCode, GlobalVariables.getUserSession().getPerson());
    return canViewNoteAttachment;
}
Also used : DocumentAuthorizer(org.kuali.kfs.kns.document.authorization.DocumentAuthorizer)

Example 7 with DocumentAuthorizer

use of org.kuali.kfs.kns.document.authorization.DocumentAuthorizer in project cu-kfs by CU-CommunityApps.

the class CUFinancialSystemDocumentServiceImpl method getDocumentAuthorizer.

protected FinancialSystemTransactionalDocumentAuthorizerBase getDocumentAuthorizer(Document doc) {
    DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class);
    final String docTypeName = dataDictionaryService.getDocumentTypeNameByClass(doc.getClass());
    Class<? extends DocumentAuthorizer> documentAuthorizerClass = (Class<? extends DocumentAuthorizer>) dataDictionaryService.getDataDictionary().getDocumentEntry(docTypeName).getDocumentAuthorizerClass();
    FinancialSystemTransactionalDocumentAuthorizerBase documentAuthorizer = null;
    try {
        documentAuthorizer = (FinancialSystemTransactionalDocumentAuthorizerBase) documentAuthorizerClass.newInstance();
    } catch (InstantiationException ie) {
        throw new RuntimeException("Could not construct document authorizer: " + documentAuthorizerClass.getName(), ie);
    } catch (IllegalAccessException iae) {
        throw new RuntimeException("Could not construct document authorizer: " + documentAuthorizerClass.getName(), iae);
    }
    return documentAuthorizer;
}
Also used : FinancialSystemTransactionalDocumentAuthorizerBase(org.kuali.kfs.sys.document.authorization.FinancialSystemTransactionalDocumentAuthorizerBase) DocumentAuthorizer(org.kuali.kfs.kns.document.authorization.DocumentAuthorizer) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService)

Example 8 with DocumentAuthorizer

use of org.kuali.kfs.kns.document.authorization.DocumentAuthorizer in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderForm method canVoid.

// KFSUPGRADE-411
/**
 * Determines whether to display the void button for the purchase order document. Conditions:
 * PO is in Pending Print status, or is in Open status and has no PREQs against it;
 * PO's current indicator is true and pending indicator is false;
 * and the user is a member of the purchasing group).
 *
 * @return boolean true if the void button can be displayed.
 */
protected boolean canVoid() {
    // check PO status etc
    boolean can = getPurchaseOrderDocument().isPurchaseOrderCurrentIndicator() && !getPurchaseOrderDocument().isPendingActionIndicator();
    if (can) {
        boolean pendingPrint = PurapConstants.PurchaseOrderStatuses.APPDOC_PENDING_PRINT.equals(getPurchaseOrderDocument().getApplicationDocumentStatus());
        boolean open = PurapConstants.PurchaseOrderStatuses.APPDOC_OPEN.equals(getPurchaseOrderDocument().getApplicationDocumentStatus());
        boolean errorFax = PurapConstants.PurchaseOrderStatuses.APPDOC_FAX_ERROR.equals(getPurchaseOrderDocument().getApplicationDocumentStatus());
        List<PaymentRequestView> preqViews = SpringContext.getBean(PurapService.class).getRelatedViews(PaymentRequestView.class, getPurchaseOrderDocument().getAccountsPayablePurchasingDocumentLinkIdentifier());
        boolean hasPaymentRequest = preqViews != null && preqViews.size() > 0;
        can = pendingPrint || (open && !hasPaymentRequest) || errorFax;
    }
    // check user authorization
    if (can) {
        DocumentAuthorizer documentAuthorizer = SpringContext.getBean(DocumentHelperService.class).getDocumentAuthorizer(getPurchaseOrderDocument());
        can = documentAuthorizer.canInitiate(KFSConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER_VOID, GlobalVariables.getUserSession().getPerson());
    }
    return can;
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) DocumentAuthorizer(org.kuali.kfs.kns.document.authorization.DocumentAuthorizer) PaymentRequestView(org.kuali.kfs.module.purap.businessobject.PaymentRequestView) DocumentHelperService(org.kuali.kfs.kns.service.DocumentHelperService)

Aggregations

DocumentAuthorizer (org.kuali.kfs.kns.document.authorization.DocumentAuthorizer)8 DocumentHelperService (org.kuali.kfs.kns.service.DocumentHelperService)2 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)1 DisbursementVoucherWireTransferExtendedAttribute (edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute)1 CuPaymentRequestItemExtension (edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension)1 PaymentRequestWireTransfer (edu.cornell.kfs.module.purap.businessobject.PaymentRequestWireTransfer)1 List (java.util.List)1 ActionForward (org.apache.struts.action.ActionForward)1 FormFile (org.apache.struts.upload.FormFile)1 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1 TransactionalDocumentAuthorizer (org.kuali.kfs.kns.document.authorization.TransactionalDocumentAuthorizer)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)1 Attachment (org.kuali.kfs.krad.bo.Attachment)1 DocumentHeader (org.kuali.kfs.krad.bo.DocumentHeader)1 Note (org.kuali.kfs.krad.bo.Note)1 DataDictionary (org.kuali.kfs.krad.datadictionary.DataDictionary)1 DocumentEntry (org.kuali.kfs.krad.datadictionary.DocumentEntry)1 Document (org.kuali.kfs.krad.document.Document)1 AddNoteEvent (org.kuali.kfs.krad.rules.rule.event.AddNoteEvent)1