Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ codeunit 4317 "Agent System Permissions"
exit("Agent System Permissions Impl.".CurrentUserHasCanCreateCustomAgent());
end;

/// <summary>
/// Gets whether the current user has permissions to manage a specific agent.
/// </summary>
/// <param name="AgentUserSecurityId">The user security id associated with the agent.</param>
/// <returns>True if the user has manage permissions for the specified agent, false otherwise.</returns>
[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.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ page 4334 "View Agent Permissions"
ModifyAllowed = false;
InherentPermissions = X;
InherentEntitlements = X;
Permissions = tabledata Agent = M;

layout
{
Expand Down
2 changes: 1 addition & 1 deletion src/System Application/App/Agent/Setup/AgentCard.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down