@using System.Reflection
@using XCode
@using XCode.Configuration
@{
var role = Model.Role as Role;
var menus = Menu.Root.AllChilds;
//var pfs = EnumHelper.GetDescriptions<PermissionFlags>().Where(e => e.Key > PermissionFlags.None);
}
<div class="form-group col-md-12">
<label class="control-label col-md-2">授权</label>
<div class="input-group col-md-10">
<table class="table table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th>名称</th>
<th>显示名</th>
<th>授权</th>
<th>操作权限</th>
</tr>
</thead>
<tbody>
@foreach (var entity in menus)
{
<tr>
<td>@entity.TreeNodeName</td>
<td>@entity.DisplayName</td>
<td>@Html.CheckBox("p" + entity.ID, role.Has(entity.ID))</td>
<td>
@if (entity.ChildKeys.Count == 0)
{
foreach (var item in entity.Permissions)
{
var id = "pf" + entity.ID + "_" + ((Int32)item.Key);
@Html.CheckBox(id, role.Has(entity.ID, (PermissionFlags)item.Key))
@Html.Label(id, item.Value)
<text> </text>
}
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
|