From d1655672345b7173d5d5d804436dddb1cb0ec904 Mon Sep 17 00:00:00 2001 From: Marta-Vladyslava Baranovych Date: Mon, 20 Jul 2026 12:38:03 +0000 Subject: [PATCH] Add event subscriber for OpenPermissionSetPage --- .../PermissionSetCardSubscriber.Codeunit.al | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/System Application/App/Permission Sets/src/PermissionSetCardSubscriber.Codeunit.al diff --git a/src/System Application/App/Permission Sets/src/PermissionSetCardSubscriber.Codeunit.al b/src/System Application/App/Permission Sets/src/PermissionSetCardSubscriber.Codeunit.al new file mode 100644 index 0000000000..a2351851c9 --- /dev/null +++ b/src/System Application/App/Permission Sets/src/PermissionSetCardSubscriber.Codeunit.al @@ -0,0 +1,38 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.Security.AccessControl; + +using System.Environment; + +/// +/// Subscribes to the platform OpenPermissionSetCard system action and opens the permission set card. +/// +codeunit 9850 "Permission Set Card Subscriber" +{ + Access = Internal; + + /// + /// Event subscriber that opens the permission set card for the specified permission set. + /// + /// The permission set scope. + /// The app ID of the permission set. + /// The role ID of the permission set. + [EventSubscriber(ObjectType::Codeunit, Codeunit::"System Action Triggers", 'OpenPermissionSetCard', '', false, false)] + local procedure OnOpenPermissionSetCard(Scope: Integer; AppId: Guid; RoleId: Code[30]) + var + AggregatePermissionSet: Record "Aggregate Permission Set"; + PermissionSetRelation: Codeunit "Permission Set Relation"; + begin + if not AggregatePermissionSet.Get(Scope, AppId, RoleId) then + exit; + + PermissionSetRelation.OpenPermissionSetPage( + AggregatePermissionSet.Name, + AggregatePermissionSet."Role ID", + AggregatePermissionSet."App ID", + AggregatePermissionSet.Scope); + end; +}