From ca24356311b689d8807674067011d92b6aad5585 Mon Sep 17 00:00:00 2001 From: cah292 Date: Thu, 22 Aug 2024 14:48:14 -0400 Subject: [PATCH] KFSPTS-32444 Fix editing of IWNT Proc Assistant NetID (#1640) --- .../document/authorization/IWantDocumentAuthorizer.java | 8 ++++++++ .../IWantDocumentPresentationController.java | 7 +++++-- .../webapp/WEB-INF/tags/module/purap/iWantContract.tag | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentAuthorizer.java b/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentAuthorizer.java index 6116c12ab3..c01074672b 100644 --- a/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentAuthorizer.java +++ b/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentAuthorizer.java @@ -80,6 +80,10 @@ public Set getEditModes(Document document, Person user, Set edit result.remove(CUPurapConstants.IWNT_DOC_RETURN_TO_SSC); } + if (!canEditProcurementAssistantNetId(user)) { + result.remove(CUPurapConstants.I_WANT_DOC_EDIT_PROCUREMENT_ASSISTANT_NET_ID); + } + return result; } @@ -209,6 +213,10 @@ private boolean isInProcurementAssistantNode(Document document) { return false; } + private boolean canEditProcurementAssistantNetId(Person currentUser) { + return isCurrentUserProcurementContractAssistant(currentUser); + } + private boolean isCurrentUserInRole(String namespace, String roleName, Person currentUser) { List roleIds = new ArrayList(); roleIds.add(getRoleService().getRoleIdByNamespaceCodeAndName(namespace, roleName)); diff --git a/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentPresentationController.java b/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentPresentationController.java index 22919f8253..470493ef09 100644 --- a/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentPresentationController.java +++ b/src/main/java/edu/cornell/kfs/module/purap/document/authorization/IWantDocumentPresentationController.java @@ -13,6 +13,7 @@ import org.kuali.kfs.sys.service.impl.KfsParameterConstants; import edu.cornell.kfs.module.purap.CUPurapConstants; +import edu.cornell.kfs.module.purap.CUPurapConstants.IWantRouteNodes; import edu.cornell.kfs.module.purap.CUPurapParameterConstants; import edu.cornell.kfs.module.purap.document.IWantDocument; import edu.cornell.kfs.sys.CUKFSConstants; @@ -148,13 +149,15 @@ public Set getEditModes(Document document) { } editModes.add(CUPurapConstants.I_WANT_DOC_EDIT_PROC_NET_ID); - editModes.add(CUPurapConstants.I_WANT_DOC_EDIT_PROCUREMENT_ASSISTANT_NET_ID); editModes.add(CUPurapConstants.IWNT_DOC_DISPLAY_NOTE_OPTIONS); if (isContractFunctionalityEnabled()) { editModes.add(CUPurapConstants.IWNT_DOC_DISPLAY_CONTRACT_TAB); editModes.add(CUPurapConstants.IWNT_DOC_EDIT_CONTRACT_INDICATOR); - + if (workflowDocument.isEnroute() && workflowDocument.getCurrentNodeNames().contains( + IWantRouteNodes.PROCUREMENT_CONTRACT_ASSISTANT)) { + editModes.add(CUPurapConstants.I_WANT_DOC_EDIT_PROCUREMENT_ASSISTANT_NET_ID); + } } return editModes; diff --git a/src/main/webapp/WEB-INF/tags/module/purap/iWantContract.tag b/src/main/webapp/WEB-INF/tags/module/purap/iWantContract.tag index c6590737cf..933f274d72 100644 --- a/src/main/webapp/WEB-INF/tags/module/purap/iWantContract.tag +++ b/src/main/webapp/WEB-INF/tags/module/purap/iWantContract.tag @@ -8,8 +8,8 @@ - - + +