调整角色如果不选栏目,默认拥有全部栏目权限
This commit is contained in:
@@ -322,8 +322,11 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory)?"[]": my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
ex &= Article._.KId.In(aclist);
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
ex &= Article._.KId.In(aclist);
|
||||
}
|
||||
|
||||
//仅显示有权限内容
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1)
|
||||
ex &= Article._.AuthorId == my.Id;
|
||||
@@ -421,12 +424,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,12 +530,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if(my.Roles.OnlyEditMyselfArticle ==1 && entity.AuthorId != my.Id)
|
||||
@@ -638,12 +643,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目文章!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1 && entity.AuthorId != my.Id)
|
||||
|
||||
@@ -216,8 +216,11 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
ex &= Product._.KId.In(aclist);
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
ex &= Product._.KId.In(aclist);
|
||||
}
|
||||
|
||||
//仅显示有权限内容
|
||||
if (my.Roles.OnlyEditMyselfProduct == 1)
|
||||
ex &= Product._.AuthorId == my.Id;
|
||||
@@ -312,13 +315,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory)?"[]": my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//处理商品更多图片
|
||||
@@ -417,12 +422,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfProduct == 1 && entity.AuthorId != my.Id)
|
||||
@@ -497,14 +503,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count == 0) aclist.Add(0);
|
||||
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目商品!";
|
||||
return Json(tip);
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法删除非自己添加的商品!";
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div id="tab-3" class="tab-pane">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要选择。普通管理员需要赋予菜单权限方可生效。按ctrl或者shift多选
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要选择。普通管理员需要赋予菜单权限方可生效。按ctrl或者shift多选。不选则拥有所有栏目权限
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">限制文章权限:</label>
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<div id="tab-3" class="tab-pane">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-info">
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要选择。普通管理员需要赋予菜单权限方可生效。按ctrl或者shift多选
|
||||
温馨提示:如果选择『超级管理员』级别,则默认拥有所有权限,不需要选择。普通管理员需要赋予菜单权限方可生效。按ctrl或者shift多选。不选则拥有所有栏目权限
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">限制文章权限:</label>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<select class="form-control m-b" asp-for="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.AuthorizedCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(my.Roles.AuthorizedCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
@@ -21,7 +27,18 @@
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user