feat: 增加数据库角色授权菜单等项目检查
This commit is contained in:
parent
1cf5de03ec
commit
0ec160bbb5
|
@ -45,15 +45,26 @@ namespace Bootstrap.Admin.HealthChecks
|
|||
Widget = config["Widget"],
|
||||
ConnectionString = ConnectionStringResolve(config.GetSection("ConnectionStrings").Exists() ? config : _configuration, string.Empty)
|
||||
}).FirstOrDefault(i => i.Enabled);
|
||||
|
||||
// 检查 Admin 账户权限
|
||||
var user = UserHelper.RetrieveUserByUserName("Admin");
|
||||
var roles = RoleHelper.RetrievesByUserName("Admin");
|
||||
var dicts = DictHelper.RetrieveDicts();
|
||||
var menus = MenuHelper.RetrieveMenusByUserName("Admin");
|
||||
|
||||
var data = new Dictionary<string, object>()
|
||||
{
|
||||
{ "ConnectionString", db.ConnectionString },
|
||||
{ "Widget", db.Widget },
|
||||
{ "DbType", db.ProviderName },
|
||||
{ "Dicts", dicts.Count() }
|
||||
{ "Dicts", dicts.Count() },
|
||||
{ "User(Admin)", user != null },
|
||||
{ "Roles(Admin)", string.Join(",", roles) },
|
||||
{ "Navigations(Admin)", menus.Count() }
|
||||
};
|
||||
return dicts.Any() ? Task.FromResult(HealthCheckResult.Healthy("Ok", data)) : Task.FromResult(HealthCheckResult.Degraded("No init data in DB"));
|
||||
|
||||
var v = dicts.Any() && user != null && roles.Any() && menus.Any();
|
||||
return v ? Task.FromResult(HealthCheckResult.Healthy("Ok", data)) : Task.FromResult(HealthCheckResult.Degraded("Failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
return cate[value];
|
||||
};
|
||||
|
||||
var ExceptionFormatter = function (value) {
|
||||
return value ? JSON.stringify(value) : null;
|
||||
};
|
||||
|
||||
var $table = $('#tbCheck').smartTable({
|
||||
sidePagination: "client",
|
||||
showToggle: false,
|
||||
|
@ -17,7 +21,7 @@
|
|||
columns: [
|
||||
{ title: "分类", field: "Name", formatter: CategoryFormatter },
|
||||
{ title: "描述", field: "Description" },
|
||||
{ title: "异常信息", field: "Exception" },
|
||||
{ title: "异常信息", field: "Exception", formatter: ExceptionFormatter },
|
||||
{ title: "耗时", field: "Duration" },
|
||||
{ title: "检查结果", field: "Status", formatter: StatusFormatter },
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue