/// <summary> /// 判断用户是否有对应的访问权限 /// </summary> /// <param name="limitId"></param> /// <returns></returns> public static bool HasPermiss(int limitId) { if (CurrentUser.IsSuper) { return(true); } var result = true; lock (objLock) { var menus = DataCache.Get <List <Models.SysMenuLimitModel> >("limits"); if (menus == null) { var menuService = NinjectObject.GetFromMVC <Pharos.Logic.OMS.BLL.MenuService>(); menus = menuService.GetUserMenus(UID); //DataCache.Set("limits", menus, 1); } if (HttpContext.Current != null && HttpContext.Current.Request.RawUrl != "/") { result = menus.Any(o => o.URL != null && HttpContext.Current.Request.RawUrl.EndsWith(o.URL, StringComparison.CurrentCultureIgnoreCase)); } if (limitId > 0) { result = menus.Any(o => ("," + o.LimitIdStr + ",").Contains("," + limitId + ",") || o.LimitIdStr == "-1"); } } return(result); }
public static List <int> GetDeptChildsByDeptId(int deptId) { lock (objLock) { var depts = DataCache.Get <List <int> >("deptchilds"); if (depts == null) { var src = NinjectObject.GetFromMVC <Pharos.Logic.OMS.BLL.DepartMentService>(); depts = src.GetDeptChildByDeptId(deptId); //DataCache.Set("deptchilds", depts, 1); } return(depts); } }
public static List <string> GetAllCreateUIDByDeptId(int deptId) { lock (objLock) { var users = DataCache.Get <List <string> >("deptusers"); if (users == null) { var src = NinjectObject.GetFromMVC <Pharos.Logic.OMS.BLL.DepartMentService>(); users = src.GetAllCreateUIDByDeptId(deptId); //DataCache.Set("deptusers", users, 1); } return(users); } }