diff --git a/src/System Application/App/Agent/Permissions/AgentSystemPermissions.Codeunit.al b/src/System Application/App/Agent/Permissions/AgentSystemPermissions.Codeunit.al
index be5cca2c1e..5981a85c03 100644
--- a/src/System Application/App/Agent/Permissions/AgentSystemPermissions.Codeunit.al
+++ b/src/System Application/App/Agent/Permissions/AgentSystemPermissions.Codeunit.al
@@ -40,6 +40,17 @@ codeunit 4317 "Agent System Permissions"
exit("Agent System Permissions Impl.".CurrentUserHasCanCreateCustomAgent());
end;
+ ///
+ /// Gets whether the current user has permissions to manage a specific agent.
+ ///
+ /// The user security id associated with the agent.
+ /// True if the user has manage permissions for the specified agent, false otherwise.
+ [Scope('OnPrem')]
+ procedure CurrentUserCanManageAgent(AgentUserSecurityId: Guid): Boolean
+ begin
+ exit("Agent System Permissions Impl.".CurrentUserCanConfigureAgent(AgentUserSecurityId));
+ end;
+
var
"Agent System Permissions Impl.": Codeunit "Agent System Permissions Impl.";
}
\ No newline at end of file
diff --git a/src/System Application/App/Agent/Permissions/Internal/AgentSystemPermissionsImpl.Codeunit.al b/src/System Application/App/Agent/Permissions/Internal/AgentSystemPermissionsImpl.Codeunit.al
index 415e3e6438..bc2527622b 100644
--- a/src/System Application/App/Agent/Permissions/Internal/AgentSystemPermissionsImpl.Codeunit.al
+++ b/src/System Application/App/Agent/Permissions/Internal/AgentSystemPermissionsImpl.Codeunit.al
@@ -26,7 +26,20 @@ codeunit 4318 "Agent System Permissions Impl."
procedure CurrentUserHasCanCreateCustomAgent(): Boolean
begin
- // exit(CurrentUserHasExecuteSystemPermission(9667)); // "Create Custom Agent", not supported yet.
+ exit(CurrentUserHasExecuteSystemPermission(9667)); // "Create Custom Agent"
+ end;
+
+ procedure CurrentUserCanConfigureAgent(AgentUserSecurityId: Guid): Boolean
+ var
+ Agent: Record Agent;
+ begin
+ if (CurrentUserHasCanManageAllAgentsPermission()) then
+ exit(true);
+
+ if Agent.Get(AgentUserSecurityId) then
+ if Agent."Can Curr. User Configure Agent" then
+ exit(true);
+
exit(false);
end;
diff --git a/src/System Application/App/Agent/Setup/AccessControls/ViewAgentPermissions.Page.al b/src/System Application/App/Agent/Setup/AccessControls/ViewAgentPermissions.Page.al
index c4d7bfcb2f..650dc76c68 100644
--- a/src/System Application/App/Agent/Setup/AccessControls/ViewAgentPermissions.Page.al
+++ b/src/System Application/App/Agent/Setup/AccessControls/ViewAgentPermissions.Page.al
@@ -20,6 +20,7 @@ page 4334 "View Agent Permissions"
ModifyAllowed = false;
InherentPermissions = X;
InherentEntitlements = X;
+ Permissions = tabledata Agent = M;
layout
{
diff --git a/src/System Application/App/Agent/Setup/AgentCard.Page.al b/src/System Application/App/Agent/Setup/AgentCard.Page.al
index f4bac1852c..8ce0558185 100644
--- a/src/System Application/App/Agent/Setup/AgentCard.Page.al
+++ b/src/System Application/App/Agent/Setup/AgentCard.Page.al
@@ -194,7 +194,7 @@ page 4315 "Agent Card"
begin
AgentUtilities.BlockPageFromBeingOpenedByAgent();
- if not AgentSystemPermissions.CurrentUserHasCanManageAllAgentsPermission() then
+ if not AgentSystemPermissions.CurrentUserCanManageAgent(Rec."User Security ID") then
Error(YouDoNotHavePermissionToModifyThisAgentErr);
end;