SetPurview.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using BizCom;
  2. using System.Web;
  3. namespace SiteCore.Handler
  4. {
  5. public class SetPurview : BaseHandler, IHttpHandler
  6. {
  7. public void ProcessRequest(HttpContext context)
  8. {
  9. if (context.Request.Form["type"] != null && context.Request.Form["setid"] != null)
  10. {
  11. string sType = context.Request.Form["type"].Trim().ToLower();
  12. string sId = context.Request.Form["setid"].Trim().ToLower();
  13. string sValue = context.Request.Form["v"].Trim().ToLower();
  14. try
  15. {
  16. switch (sType)
  17. {
  18. case "pms":
  19. {
  20. //更新权限
  21. XPermission.SavePermission(sId, "0", sValue);
  22. WebUser.RemovePermissionCache(sId);
  23. //返回信息
  24. Utils.CommonHelper.ReturnJsonMsg("success", "保存成功");
  25. break;
  26. }
  27. case "orgrights":
  28. {
  29. //更新权限
  30. CeErpPermission.SaveOrgPermission(sId, sValue);
  31. //返回信息
  32. Utils.CommonHelper.ReturnJsonMsg("success", "保存成功");
  33. break;
  34. }
  35. case "postrights":
  36. {
  37. string oId = context.Request.Form["oId"].ToString();
  38. CeErpPermission.SavePostPermission(sId, oId, sValue);
  39. WebUser.RemovePermissionCache(sId);
  40. //返回信息
  41. Utils.CommonHelper.ReturnJsonMsg("success", "保存成功");
  42. break;
  43. }
  44. }
  45. }
  46. catch
  47. {
  48. Utils.CommonHelper.ReturnJsonMsg("error", "服务器错误");
  49. }
  50. }
  51. else
  52. {
  53. Utils.CommonHelper.ReturnJsonMsg("error", "服务器错误");
  54. }
  55. }
  56. }
  57. }