Skip to content
Merged

Dev #1397

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 @@ -19,10 +19,16 @@
int rowCount = 1;
int maxDepth = Model.PermissionRoleMatrix.Max(item => item.Depth);
int headerLevel = maxDepth + 1;

var roleHeaders = Model.PermissionRoleMatrix.FirstOrDefault()?.RolePermissions.Keys ?? Enumerable.Empty<string>();
var filteredPermissions = Model.ShowNotDefined
? Model.PermissionRoleMatrix.Where(p => !p.IsDefined)
: Model.PermissionRoleMatrix.Where(p => p.IsDefined);
}

@section scripts {
<th:abp-script src="/Pages/Identity/Roles/PermissionRoleMatrix.js" />
<th:abp-script src="/Pages/AbpPermissionManagement/permission-management-modal.js" />
}

@section styles {
Expand Down Expand Up @@ -72,14 +78,14 @@
<th scope="col">Permission Group</th>
<th scope="col">Permission</th>
<th scope="col">Description</th>
@foreach (var role in Model.PermissionRoleMatrix.FirstOrDefault()?.RolePermissions.Keys ?? Enumerable.Empty<string>())
@foreach (var role in roleHeaders)
{
<th scope="col" class="role-name" data-role-header="@role">@role</th>
}
</tr>
</thead>
<tbody>
@foreach (var permission in Model.PermissionRoleMatrix)
@foreach (var permission in filteredPermissions)
{
<tr>
<td>@rowCount.ToString("D2")</td>
Expand Down Expand Up @@ -107,7 +113,7 @@
<th scope="col" rowspan="2">Permission Group</th>
<th scope="colgroup" colspan="@headerLevel" data-dt-order="disable">Permission</th>
<th scope="col" rowspan="2">Description</th>
@foreach (var role in Model.PermissionRoleMatrix.FirstOrDefault()?.RolePermissions.Keys ?? Enumerable.Empty<string>())
@foreach (var role in roleHeaders)
{
<th scope="col" rowspan="2" class="role-name" data-role-header="@role">@role</th>
}
Expand All @@ -120,7 +126,7 @@
</tr>
</thead>
<tbody>
@foreach (var permission in Model.PermissionRoleMatrix)
@foreach (var permission in filteredPermissions)
{
<tr>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,44 @@
using System.Threading.Tasks;
using Unity.GrantManager.Repositories;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace Unity.GrantManager.Web.Pages.Identity.Roles;

public class PermissionRoleMatrixModel(IPermissionRoleMatrixRepository repository) : AbpPageModel
public class PermissionRoleMatrixModel(IPermissionRoleMatrixRepository repository, IPermissionDefinitionManager permissionDefinitionManager) : AbpPageModel
{
public bool IsExpanded { get; private set; }
public bool ShowNotDefined { get; private set; } = false;
public required IList<PermissionRoleMatrixDto> PermissionRoleMatrix { get; set; }

public async Task OnGetAsync()
{
// Check if the query parameter "Render" is set to "Expanded"
IsExpanded = Request.Query["Render"].ToString().Equals("Expanded", StringComparison.OrdinalIgnoreCase);
ShowNotDefined = Request.Query["Show"].ToString().Equals("NotDefined", StringComparison.OrdinalIgnoreCase);

PermissionRoleMatrix = await repository.GetPermissionRoleMatrixAsync();
foreach (var item in PermissionRoleMatrix.Where(item => item.PermissionDisplayName.StartsWith("L:")))

var definedPermissionSet = await permissionDefinitionManager.GetPermissionsAsync();
var definedPermissionNames = new HashSet<string>(definedPermissionSet.Select(x => x.Name));

foreach (var item in PermissionRoleMatrix)
{
var parts = item.PermissionDisplayName[2..].Split(',');
if (parts.Length == 2)
item.IsDefined = definedPermissionNames.Contains(item.PermissionName);

var displayName = item.PermissionDisplayName;
if (displayName.Length > 2 && displayName.StartsWith("L:"))
{
var resourceName = parts[0];
var name = parts[1];
var displayName = new LocalizableString(name, resourceName);
item.PermissionDisplayName = (await displayName.LocalizeAsync(StringLocalizerFactory))?.Value ?? item.PermissionDisplayName;
var parts = displayName.AsSpan(2).ToString().Split(',');
if (parts.Length == 2)
{
var resourceName = parts[0];
var name = parts[1];
var localizable = new LocalizableString(name, resourceName);
var localized = await localizable.LocalizeAsync(StringLocalizerFactory);
item.PermissionDisplayName = localized?.Value ?? displayName;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
const columnDefs = [
{
targets: 0,
orderable: false,
orderable: true,
className: 'notexport'
}
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ public class PermissionRoleMatrixDto
public required string PermissionDisplayName { get; set; }
public int Depth { get; set; }
public required Dictionary<string, bool> RolePermissions { get; set; }
public bool IsDefined { get; set; } = false;
}
6 changes: 3 additions & 3 deletions openshift/redis-sentinel/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.16.1
digest: sha256:9790756cef622b027cfb67e6dfe1b2802a3cf74b46ec10e11ae1428becf5cb32
generated: "2024-02-23T09:58:09.769896-08:00"
version: 21.1.11
digest: sha256:98f3d6fdc3360f0ea929a647528658e8693cf22ea503a099dc77af35e46af99f
generated: "2025-06-03T11:36:36.363955-07:00"
6 changes: 3 additions & 3 deletions openshift/redis-sentinel/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
appVersion: "7.2.5"

dependencies:
- name: redis
version: "18.16.1" # Specify the version you want
version: "21.1.11" # Specify the version you want
repository: "https://charts.bitnami.com/bitnami"
Binary file removed openshift/redis-sentinel/charts/redis-18.16.1.tgz
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions openshift/redis-sentinel/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

redis:
# Bitnami chart version: updated from previous to 21.1.11
# Redis image tag: updated from 7.2.4-debian-12-r9 to 7.2.5 (see Chart.yaml)
fullnameOverride: redis-ha
architecture: replication
auth:
Expand All @@ -9,7 +10,7 @@ redis:
image:
registry: docker.io
repository: bitnami/redis
tag: 7.2.4-debian-12-r9
tag: 7.2.5 # updated from 7.2.4-debian-12-r9, now using default Bitnami Redis 7.2.5 image
sentinel:
enabled: true
masterSet: "redisMasterSet"
Expand Down
Loading