[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 authored at 2024-08-09 00:30:41 石头 committed at 2024-08-10 14:22:24
1.74 KiB
X
@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>&nbsp;</text>
                                }
                            }
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>