void CancelWF() { string WF_Workflow_id = Request["WF_Workflow_id"]; CWorkflow wf = (CWorkflow)m_BaseObjectMgr.WorkflowMgr.Find(new Guid(WF_Workflow_id)); //只有启动者或管理员才能撤销 if (wf.Creator != m_User.Id && !m_User.IsRole("管理员")) { Response.Write("没有权限撤销!"); return; } if (!m_BaseObjectMgr.WorkflowMgr.CancelWorkflow(wf)) { Response.Write("撤销失败!"); return; } }
void GetData() { string UType = Request["UType"]; string Uid = Request["Uid"]; CUser user = null; CRole role = null; if (UType == "0") //用户 { if (!string.IsNullOrEmpty(Uid)) { user = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(new Guid(Uid)); } } else if (UType == "1") //角色 { if (!string.IsNullOrEmpty(Uid)) { role = (CRole)m_Company.RoleMgr.Find(new Guid(Uid)); } } string sData = ""; List <CBaseObject> lstObj = m_Company.ReportMgr.GetList(); foreach (CBaseObject obj in lstObj) { CReport report = (CReport)obj; int iRead = 0; int iWrite = 0; if (UType == "0" && user != null) //用户 { //管理员有所有权限 if (user.IsRole("管理员")) { iRead = 1; iWrite = 1; } else { CReportAccessInUser raiu = user.ReportAccessInUserMgr.FindByReport(report.Id); if (raiu != null) { if (raiu.Access == AccessType.read) { iRead = 1; } else if (raiu.Access == AccessType.write) { iRead = 1; iWrite = 1; } } } } else if (UType == "1" && role != null) //用户 { //管理员有所有权限 if (role.Name == "管理员") { iRead = 1; iWrite = 1; } else { CReportAccessInRole rair = role.ReportAccessInRoleMgr.FindByReport(report.Id); if (rair != null) { if (rair.Access == AccessType.read) { iRead = 1; } else if (rair.Access == AccessType.write) { iRead = 1; iWrite = 1; } } } } string sRow = string.Format("\"id\":\"{0}\",\"Name\":\"{1}\",\"Read\":\"{2}\",\"Write\":\"{3}\",", report.Id, report.Name, iRead, iWrite); sRow = "{" + sRow + "},"; sData += sRow; } sData = sData.TrimEnd(",".ToCharArray()); sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, lstObj.Count); Response.Write(sJson); }
void PostData() { string UType = Request["UType"]; string Uid = Request["Uid"]; string postData = Request["postData"]; CUser user = null; CRole role = null; if (UType == "0") //用户 { user = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(new Guid(Uid)); //管理员有所有权限,不能修改! if (user.IsRole("管理员")) { Response.Write("管理员有所有权限,不能修改!"); return; } // string[] arr1 = postData.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string sItem1 in arr1) { string[] arr2 = sItem1.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Guid reportid = new Guid(arr2[0]); CReportAccessInUser raiu = user.ReportAccessInUserMgr.FindByReport(reportid); if (raiu == null) { raiu = new CReportAccessInUser(); raiu.RPT_Report_id = reportid; raiu.B_User_id = user.Id; if (arr2[2] == "1") { raiu.Access = AccessType.write; } else if (arr2[1] == "1") { raiu.Access = AccessType.read; } else { raiu.Access = AccessType.forbide; } CUser user0 = (CUser)Session["User"]; raiu.Creator = user0.Id; user.ReportAccessInUserMgr.AddNew(raiu); } else { if (arr2[2] == "1") { raiu.Access = AccessType.write; } else if (arr2[1] == "1") { raiu.Access = AccessType.read; } else { raiu.Access = AccessType.forbide; } CUser user0 = (CUser)Session["User"]; raiu.Updator = user0.Id; user.ReportAccessInUserMgr.Update(raiu); } } if (!user.ReportAccessInUserMgr.Save(true)) { Response.Write("保存失败!"); } } else if (UType == "1") //角色 { role = (CRole)m_Company.RoleMgr.Find(new Guid(Uid)); //管理员有所有权限,不能修改! if (role.Name == "管理员") { Response.Write("管理员有所有权限,不能修改!"); return; } // string[] arr1 = postData.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string sItem1 in arr1) { string[] arr2 = sItem1.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Guid reportid = new Guid(arr2[0]); CReportAccessInRole rair = role.ReportAccessInRoleMgr.FindByReport(reportid); if (rair == null) { rair = new CReportAccessInRole(); rair.RPT_Report_id = reportid; rair.B_Role_id = role.Id; if (arr2[2] == "1") { rair.Access = AccessType.write; } else if (arr2[1] == "1") { rair.Access = AccessType.read; } else { rair.Access = AccessType.forbide; } CUser user0 = (CUser)Session["User"]; rair.Creator = user0.Id; role.ReportAccessInRoleMgr.AddNew(rair); } else { if (arr2[2] == "1") { rair.Access = AccessType.write; } else if (arr2[1] == "1") { rair.Access = AccessType.read; } else { rair.Access = AccessType.forbide; } CUser user0 = (CUser)Session["User"]; rair.Updator = user0.Id; role.ReportAccessInRoleMgr.Update(rair); } } if (!role.ReportAccessInRoleMgr.Save(true)) { Response.Write("保存失败!"); } } }
void GetData() { string UType = Request["UType"]; string Uid = Request["Uid"]; CUser user = null; CRole role = null; if (UType == "0") //用户 { if (!string.IsNullOrEmpty(Uid)) { user = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(new Guid(Uid)); } } else if (UType == "1") //角色 { if (!string.IsNullOrEmpty(Uid)) { role = (CRole)m_Company.RoleMgr.Find(new Guid(Uid)); } } string FW_Table_id = Request["FW_Table_id"]; CTable table = null; if (!string.IsNullOrEmpty(FW_Table_id)) { table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(new Guid(FW_Table_id)); } string sData = ""; int iCount = 0; if (table != null) { List <CBaseObject> lstObj = table.ColumnMgr.GetList(); iCount = lstObj.Count; foreach (CBaseObject obj in lstObj) { CColumn column = (CColumn)obj; int iRead = 0; int iWrite = 0; if (UType == "0" && user != null) //用户 { //管理员有所有权限 if (user.IsRole("管理员")) { iRead = 1; iWrite = 1; } else { CColumnAccessInUser caiu = user.ColumnAccessInUserMgr.FindByColumn(column.Id); if (caiu != null) { if (caiu.Access == AccessType.read) { iRead = 1; } else if (caiu.Access == AccessType.write) { iRead = 1; iWrite = 1; } } else //没有手动设置字段权限, 则默认都可写 { iRead = 1; iWrite = 1; } } } else if (UType == "1" && role != null) //用户 { //管理员有所有权限 if (role.Name == "管理员") { iRead = 1; iWrite = 1; } else { CColumnAccessInRole cair = role.ColumnAccessInRoleMgr.FindByColumn(column.Id); if (cair != null) { if (cair.Access == AccessType.read) { iRead = 1; } else if (cair.Access == AccessType.write) { iRead = 1; iWrite = 1; } } else //没有手动设置字段权限, 则默认都可写 { iRead = 1; iWrite = 1; } } } string sRow = string.Format("\"id\":\"{0}\",\"Name\":\"{1}\",\"Read\":\"{2}\",\"Write\":\"{3}\",", column.Id, column.Name, iRead, iWrite); sRow = "{" + sRow + "},"; sData += sRow; } } sData = sData.TrimEnd(",".ToCharArray()); sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, iCount); Response.Write(sJson); }