Skip to content
Merged
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 @@ -2,6 +2,7 @@

using System.Apps;
using System.Reflection;
using System.Security.AccessControl;

page 9631 "Page Inspection"
{
Expand Down Expand Up @@ -145,6 +146,27 @@ page 9631 "Page Inspection"
end;
}
}
group(ViewTablePermissionsGroup)
{
ShowCaption = false;
Visible = not PageIsOpening and not PageIsSystem and not PageIsReportRequest and not PageIsReportViewer and not PageIsXMLPortPage and not PageIsRoleCenter and not IsViewQueryPage and PageHasSourceTable;
field(ViewTablePermissionsLbl; ViewTablePermissionsLbl)
{
ApplicationArea = All;
DrillDown = true;
ShowCaption = false;
ToolTip = 'View an overview of permissions that apply to this table across all permission sets.';

trigger OnDrillDown()
var
PermissionsOverviewPage: Page "Permissions Overview";
ObjType: Option None,"Table Data","Table",,"Report",,"Codeunit","XMLport",MenuSuite,"Page","Query",System;
begin
PermissionsOverviewPage.SetInitialObjectFilter(ObjType::"Table Data", Format(Rec."Source Table No."));
PermissionsOverviewPage.Run();
end;
}
}
group(Control7)
{
ShowCaption = false;
Expand Down Expand Up @@ -309,6 +331,7 @@ page 9631 "Page Inspection"
InfoFormatSecondDetailOnlyLbl: Label '(%1)', Locked = true;
ViewFullTableURL: Text;
ViewTableLbl: Label 'View table';
ViewTablePermissionsLbl: Label 'View table permissions';
UpdateExploreInVsCodeRequestURL: Boolean;
ExploreInVsCodeTextLbl: Label 'Explore page in Visual Studio Code';
ShowExploreInVSCodeLink: Boolean;
Expand Down
35 changes: 35 additions & 0 deletions src/Layers/W1/BaseApp/System/Permissions/PermissionSets.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,41 @@ page 9802 "Permission Sets"
ToolTip = 'Set up or modify security groups as a fast way of giving users access to the functionality that is relevant to their work.';
}
}
group(PermissionsOverviewGroup)
{
Caption = 'Permissions Overview';
Image = Permission;
action("Where-Used")
{
ApplicationArea = Basic, Suite;
Caption = 'Where-Used';
Image = Track;
Scope = Repeater;
ToolTip = 'View where the selected permission set is used, including which users and security groups have been assigned with it.';

trigger OnAction()
var
PermissionsOverviewPage: Page "Permissions Overview";
begin
PermissionsOverviewPage.SetInitialRoleIDFilter(Rec."Role ID");
PermissionsOverviewPage.Run();
end;
}
action("Permissions Overview")
{
ApplicationArea = Basic, Suite;
Caption = 'Permissions Overview';
Image = Permission;
ToolTip = 'View an overview of how permissions are distributed across permission sets, users, and security groups.';

trigger OnAction()
var
PermissionsOverviewPage: Page "Permissions Overview";
begin
PermissionsOverviewPage.Run();
end;
}
}
}
area(processing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ page 9883 "Permissions Overview"
AddInherentPermissions(Rec."Object Type"::XMLport, Database::"XMLport Metadata", XMLportMetadata.FieldNo(ID), XMLportMetadata.FieldNo(InherentPermissions));
AddInherentPermissions(Rec."Object Type"::Query, Database::"Query Metadata", QueryMetadata.FieldNo(ID), QueryMetadata.FieldNo(InherentPermissions));

ApplyInitialFilters();

if Rec.FindFirst() then;
end;

Expand All @@ -332,6 +334,9 @@ page 9883 "Permissions Overview"
AppNameFilter: Text[250];
ExtUserFilterText: Text;
IsBuffered: Boolean;
InitialRoleIDFilter: Text[30];
InitialObjTypeFilter: Option None,"Table Data","Table",,"Report",,"Codeunit","XMLport",MenuSuite,"Page","Query",System;
InitialObjIDFilter: Text;

local procedure AddInherentPermissions(ForObjectType: Option; MetadataTableId: Integer; ObjectIdFieldId: Integer; InherentPermissionFieldId: Integer)
var
Expand Down Expand Up @@ -573,6 +578,30 @@ page 9883 "Permissions Overview"
exit(PublishedApplication.Name);
end;

local procedure ApplyInitialFilters()
begin
if InitialRoleIDFilter <> '' then begin
RoleIDFilter := InitialRoleIDFilter;
Rec.FilterGroup(2);
Rec.SetFilter("Role ID", RoleIDFilter);
Rec.FilterGroup(0);
end;

if InitialObjTypeFilter <> InitialObjTypeFilter::None then begin
ObjTypeFilter := InitialObjTypeFilter;
Rec.FilterGroup(2);
Rec.SetRange("Object Type", ObjTypeFilter - 1);
Rec.FilterGroup(0);
end;

if InitialObjIDFilter <> '' then begin
ObjIDFilter := InitialObjIDFilter;
Rec.FilterGroup(2);
Rec.SetFilter("Object ID", ObjIDFilter);
Rec.FilterGroup(0);
end;
end;

local procedure SetScope()
begin
case true of
Expand All @@ -584,5 +613,25 @@ page 9883 "Permissions Overview"
PermSetScope := PermSetScope::System;
end;
end;

/// <summary>
/// Sets the initial Role ID filter to apply when the page opens.
/// </summary>
/// <param name="NewRoleIDFilter">The Role ID to filter on.</param>
procedure SetInitialRoleIDFilter(NewRoleIDFilter: Text[30])
begin
InitialRoleIDFilter := NewRoleIDFilter;
end;

/// <summary>
/// Sets the initial object type and ID filters to apply when the page opens.
/// </summary>
/// <param name="NewObjTypeFilter">The object type to filter on.</param>
/// <param name="NewObjIDFilter">The object ID to filter on.</param>
procedure SetInitialObjectFilter(NewObjTypeFilter: Option None,"Table Data","Table",,"Report",,"Codeunit","XMLport",MenuSuite,"Page","Query",System; NewObjIDFilter: Text)
begin
InitialObjTypeFilter := NewObjTypeFilter;
InitialObjIDFilter := NewObjIDFilter;
end;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ------------------------------------------------------------------------------------------------
// 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;

codeunit 9886 "Permissions Overview Handler"
{
Access = Internal;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Permissions Overview", 'OnOpenPermissionsOverview', '', false, false)]
local procedure HandleOpenPermissionsOverview()
var
PermissionsOverviewPage: Page "Permissions Overview";
begin
PermissionsOverviewPage.Run();
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Permissions Overview", 'OnOpenPermissionsOverviewForPermissionSet', '', false, false)]
local procedure HandleOpenForPermissionSet(RoleID: Text[30])
var
PermissionsOverviewPage: Page "Permissions Overview";
begin
PermissionsOverviewPage.SetInitialRoleIDFilter(RoleID);
PermissionsOverviewPage.Run();
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Permissions Overview", 'OnOpenPermissionsOverviewForTable', '', false, false)]
local procedure HandleOpenForTable(TableNo: Integer)
var
PermissionsOverviewPage: Page "Permissions Overview";
ObjType: Option None,"Table Data","Table",,"Report",,"Codeunit","XMLport",MenuSuite,"Page","Query",System;
begin
PermissionsOverviewPage.SetInitialObjectFilter(ObjType::"Table Data", Format(TableNo));
PermissionsOverviewPage.Run();
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ page 9855 "Permission Set"
AboutTitle = 'About view all permissions';
AboutText = 'View all permissions gives you the big picture. It opens a flat list of the permissions in the set you''re working with and all added sets';
}
action("Where-Used")
{
ApplicationArea = All;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Process;
Image = Track;
Caption = 'Where-Used';
ToolTip = 'View where this permission set is used, including which users and security groups have been assigned with it.';

trigger OnAction()
var
PermissionsOverviewCU: Codeunit "Permissions Overview";
begin
PermissionsOverviewCU.OpenForPermissionSet(Rec."Role ID");
end;
}
group("Record Permissions")
{
Caption = 'Record Permissions';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// ------------------------------------------------------------------------------------------------
// 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;

/// <summary>
/// Provides procedures to open the Permissions Overview page with optional filters.
/// Raises integration events that allow the hosting application to handle the navigation.
/// </summary>
codeunit 9865 "Permissions Overview"
{
Access = Public;

/// <summary>
/// Opens the Permissions Overview page without any filters.
/// </summary>
procedure Open()
begin
OnOpenPermissionsOverview();
end;

/// <summary>
/// Opens the Permissions Overview page filtered to a specific permission set (Where-Used).
/// </summary>
/// <param name="RoleID">The Role ID of the permission set to filter on.</param>
procedure OpenForPermissionSet(RoleID: Text[30])
begin
OnOpenPermissionsOverviewForPermissionSet(RoleID);
end;

/// <summary>
/// Opens the Permissions Overview page filtered to a specific table.
/// </summary>
/// <param name="TableNo">The table number to filter on.</param>
procedure OpenForTable(TableNo: Integer)
begin
OnOpenPermissionsOverviewForTable(TableNo);
end;

/// <summary>
/// Raised when the Permissions Overview page should be opened without filters.
/// </summary>
[IntegrationEvent(false, false)]
internal procedure OnOpenPermissionsOverview()
begin
end;

/// <summary>
/// Raised when the Permissions Overview page should be opened filtered to a permission set.
/// </summary>
/// <param name="RoleID">The Role ID to filter on.</param>
[IntegrationEvent(false, false)]
internal procedure OnOpenPermissionsOverviewForPermissionSet(RoleID: Text[30])
begin
end;

/// <summary>
/// Raised when the Permissions Overview page should be opened filtered to a table.
/// </summary>
/// <param name="TableNo">The table number to filter on.</param>
[IntegrationEvent(false, false)]
internal procedure OnOpenPermissionsOverviewForTable(TableNo: Integer)
begin
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissionset 9862 "Permission Sets - Objects"
Assignable = false;
Permissions =
codeunit "Permission Set Relation" = X,
codeunit "Permissions Overview" = X,
codeunit "Log Activity Permissions" = X,
page "Expanded Permissions" = X,
page "Expanded Permissions Factbox" = X,
Expand Down
6 changes: 6 additions & 0 deletions src/System Application/App/Table Information/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
"name": "User Permissions",
"publisher": "Microsoft",
"version": "29.0.0.0"
},
{
"id": "4992eeac-2fd3-4515-a50b-7336a332d47f",
"name": "Permission Sets",
"publisher": "Microsoft",
"version": "29.0.0.0"
}
],
"screenshots": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace System.DataAdministration;
using System.Diagnostics;
using System.Environment;
using System.Reflection;
using System.Security.AccessControl;
using System.Security.User;

/// <summary>
Expand Down Expand Up @@ -113,6 +114,28 @@ page 8700 "Table Information"
}
}

actions
{
area(Navigation)
{
action("View Table Permissions")
{
ApplicationArea = All;
Caption = 'View Table Permissions';
Image = Permission;
Scope = Repeater;
ToolTip = 'View an overview of permissions that apply to this table across all permission sets.';

trigger OnAction()
var
PermissionsOverviewCU: Codeunit "Permissions Overview";
begin
PermissionsOverviewCU.OpenForTable(Rec."Table No.");
end;
}
}
}

trigger OnInit()
var
UserPermissions: Codeunit "User Permissions";
Expand Down
Loading