From 6be92686d64926ed37b0dbbaaa808a4101768f70 Mon Sep 17 00:00:00 2001 From: attilatoury Date: Thu, 13 Aug 2026 15:25:43 +0200 Subject: [PATCH] Block unauthorized Sales Order Agent setup access --- src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Page.al | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Page.al b/src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Page.al index 7809af832c1..331b49480de 100644 --- a/src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Page.al +++ b/src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Page.al @@ -464,6 +464,7 @@ page 4400 "SOA Setup" var AgentRec: Record Agent; SOASetupRec: Record "SOA Setup"; + AgentSystemPermissions: Codeunit "Agent System Permissions"; FeatureTelemetry: Codeunit "Feature Telemetry"; SOASetupCU: Codeunit "SOA Setup"; UserSecurityIDFilter: Text; @@ -480,6 +481,9 @@ page 4400 "SOA Setup" if not Evaluate(UserSecurityID, UserSecurityIDFilter) then Clear(UserSecurityID); + if not AgentSystemPermissions.CurrentUserCanManageAgent(UserSecurityID) then + Error(NotAuthorizedToConfigureAgentErr); + if not IsNullGuid(UserSecurityID) then if SOASetupRec.GetBasedOnAgentUserSecurityID(UserSecurityID, false) then begin Rec."Agent Name" := SOASetupRec."Agent Name"; @@ -798,6 +802,7 @@ page 4400 "SOA Setup" DailyEmailLimitErr: Label 'The daily email limit must be greater than zero.'; EmailSignatureModifyLbl: Label 'Edit signature'; SelectMailboxFirstMsg: Label 'Please select an email account first.'; + NotAuthorizedToConfigureAgentErr: Label 'You do not have permission to configure the Sales Order Agent. Contact your system administrator to update your permissions or to mark you as one of the administrators for the agent.'; ConfiguredBy: Text[80]; SOACreateTaskLbl: Label 'Create task for the agent'; EnableAgentForTaskQst: Label 'Trying out the agent will activate it and turn off incoming email monitoring immediately.\\Do you want to continue?';