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;
}
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;
}
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;
}
Aggregations