管理组管理增加控制普通管理组的文章和商品权限,文章、商品操作增加权限判断
This commit is contained in:
@@ -208,7 +208,20 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
numPerPage = limit;
|
||||
currentPage = page;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
Expression ex = Product._.Id > 0;
|
||||
Expression ex = new Expression();
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
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 (my.Roles.OnlyEditMyselfProduct == 1)
|
||||
ex &= Product._.AuthorId == my.Id;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
{
|
||||
@@ -292,6 +305,22 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "商品图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
//处理商品更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -312,7 +341,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
model.Content = content;
|
||||
}
|
||||
model.ItemImg = morIMG;
|
||||
model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.AuthorId = my.Id;
|
||||
model.Insert();
|
||||
Category.UpdateDetailCount(model.KId);
|
||||
//添加TAG
|
||||
@@ -381,6 +410,28 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "商品图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfProduct == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法编辑非自己添加的商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
//处理商品更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -439,6 +490,28 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "系统找不到本商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法删除非自己添加的商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
int kid = entity.KId;
|
||||
//删除TAG
|
||||
//Tag.DeleteTag(RTType.RatuoModule.Article, entity.Id);
|
||||
|
||||
Reference in New Issue
Block a user