public static bool HasAccess(int actionID) { HardX.Models.User theUser = new HardX.Models.User(); List <HardX.Models.User> theUserList = new List <Models.User>(); if (HttpContext.Current.User.Identity.Name == "") { return(false); } theUserList = (List <HardX.Models.User>)theUser.GetAll("UPPER(LOGIN) = '" + HttpContext.Current.User.Identity.Name.ToUpper() + "'"); if (theUserList.Count == 1) { return(true); } /* * foreach (var theAction in theUserList[0].Role.Actions) * { * if (actionID == theAction.Id) * { * return true; * } * } * */ return(false); }
public JsonResult IsUserName_Available(string Name) { HardX.Models.User theUser = new HardX.Models.User(); int userCount = theUser.GetAll("NAME = '" + Name + "'").Count; if (userCount > 0) { string suggestedUID = String.Format(CultureInfo.InvariantCulture, "Пользователь с имененем '{0}' уже существует.", Name); return(Json(suggestedUID, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult IsUserLogin_Available(string Login) { HardX.Models.User theUser = new HardX.Models.User(); int userCount = theUser.GetAll("UPPER(LOGIN) = '" + Login.ToUpper() + "'").Count; if (userCount > 0) { string suggestedUID = String.Format(CultureInfo.InvariantCulture, "Пользователь с логином '{0}' уже существует.", Login); return(Json(suggestedUID, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }