调整角色如果不选栏目,默认拥有全部栏目权限
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(my.Roles.AuthorizedArticleCagegory);
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<select class="form-control m-b" name="KId" id="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count>0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "文章列表";
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory)?"[]": my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
@@ -21,7 +27,17 @@
|
||||
<option value="0">所有栏目</option>
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count>0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<label class="checkbox-inline i-checks">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(my.Roles.AuthorizedArticleCagegory);
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
@@ -24,9 +24,12 @@
|
||||
<select class="form-control m-b" asp-for="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count > 0)
|
||||
{
|
||||
<option value="@m.Id" selected>@m.KindName</option>
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user