-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPermissionRoleMatrix.cshtml
More file actions
158 lines (144 loc) · 5.93 KB
/
PermissionRoleMatrix.cshtml
File metadata and controls
158 lines (144 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
@page
@using Microsoft.Extensions.Localization
@using Unity.GrantManager.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.MultiTenancy
@model Unity.GrantManager.Web.Pages.Identity.Roles.PermissionRoleMatrixModel
@inject ICurrentTenant CurrentTenant
@inject IPageLayout PageLayout
@inject IStringLocalizer<GrantManagerResource> L
@tagHelperPrefix th:
@{
PageLayout.Content.Title = "Permission-Role Matrix";
ViewBag.PageTitle = "Permission-Role Matrix";
int rowCount = 1;
int maxDepth = Model.PermissionRoleMatrix.Max(item => item.Depth);
int headerLevel = maxDepth + 1;
}
@section scripts {
<th:abp-script src="/Pages/Identity/Roles/PermissionRoleMatrix.js" />
}
@section styles {
<style>
#permissionTableContainer {
position: relative;
min-height: 200px;
}
#permissionTable {
display: none;
}
.loading-spinner {
position: absolute;
top: 50%;
left: 50%;
text-align: center;
}
</style>
}
<div class="container-fluid px-0">
<div class="action-bar p-2 filter-search-action-bar">
<div class="unity-page-titlebar">
<h4 id="PermissionRoleMatrixTitle">Permission-Role Matrix - @CurrentTenant.Name</h4>
</div>
<div class="filter-search-action-bar_search-wrapper">
<input type="search" id="search" placeholder="Search" class="tbl-search">
</div>
<div class="btn-group" id="app_custom_buttons">
</div>
<div id="dynamicButtonContainerId" class="dynamic-buttons-div button-gap-1"></div>
</div>
<div class="p-3 pt-0">
<div id="permissionTableContainer" class="p-3 pt-0">
<div class="loading-spinner">
<p>Loading permission matrix...</p>
</div>
<table id="permissionTable" class="table table-bordered" aria-describedby="PermissionRoleMatrixTitle">
@if (!Model.IsExpanded)
{
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">L</th>
<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>())
{
<th scope="col" class="role-name" data-role-header="@role">@role</th>
}
</tr>
</thead>
<tbody>
@foreach (var permission in Model.PermissionRoleMatrix)
{
<tr>
<td>@rowCount.ToString("D2")</td>
@{
rowCount++;
}
<td>@permission.Depth.ToString("D1")</td>
<td>@permission.GroupName</td>
<td>@permission.PermissionName</td>
<td>@(L[permission.PermissionDisplayName].Value)</td>
@foreach (var hasPermission in permission.RolePermissions.Values)
{
<td>@(hasPermission ? "TRUE" : string.Empty)</td>
}
</tr>
}
</tbody>
}
else
{
<thead>
<tr>
<th scope="col" rowspan="2" data-dt-order="disable">#</th>
<th scope="col" rowspan="2" data-dt-order="disable">L</th>
<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>())
{
<th scope="col" rowspan="2" class="role-name" data-role-header="@role">@role</th>
}
</tr>
<tr>
@for (int groupLevel = 1; groupLevel < headerLevel + 1; groupLevel++)
{
<th scope="col">Level @groupLevel</th>
}
</tr>
</thead>
<tbody>
@foreach (var permission in Model.PermissionRoleMatrix)
{
<tr>
<td>
@rowCount.ToString("D2")
</td>
@{
rowCount++;
}
<td>@permission.Depth.ToString("D1")</td>
<td>@permission.GroupName</td>
@for (int i = 0; i < permission.Depth; i++)
{
<td></td>
}
<td>@permission.PermissionName</td>
@for (int j = permission.Depth; j < maxDepth; j++)
{
<td></td>
}
<td>@permission.PermissionDisplayName</td>
@foreach (var hasPermission in permission.RolePermissions.Values)
{
<td>@(hasPermission ? "TRUE" : string.Empty)</td>
}
</tr>
}
</tbody>
}
</table>
</div>
</div>