public ActionResult Index() { //String dataPermissions = Session["Permissions"].ToString(); //String dataPermissionsClient = Session["PermissionsClient"].ToString(); //bool access = false; //bool accessClient = false; // access = getpermissions("users", "r"); //access = validatepermissions.getpermissions("employee", "r", dataPermissions); //accessClient = validatepermissions.getpermissions("employee", "r", dataPermissionsClient); //if (access == true) && accessClient == true) if (true) { /////bind empli try { String profileOptions = ""; List <BsonDocument> profileList = employeeprofileTable.getRows(); //getting all the profiles profileOptions += "<option value='null' selected> Elija una opción</option>"; foreach (BsonDocument document in profileList) //for each profile we create an option element with id as value and the name as the text { profileOptions += "<option value='" + document.GetElement("_id").Value + "'"; //setting the id as the value profileOptions += ">" + document.GetElement("name").Value + "</option>"; //setting the text as the name } ViewData["profileList"] = new HtmlString(profileOptions); } catch (Exception ex) { ViewData["profileList"] = null; } //Detects if the user is an Admin try { JObject userdata = JsonConvert.DeserializeObject <JObject>(userTable.GetRow(this.Session["_id"].ToString())); JObject userprofile = JsonConvert.DeserializeObject <JObject>(profileTable.GetRow(userdata["profileId"].ToString())); if (userprofile["name"].ToString() == "Administrador de sistema") { ViewData["signalMasive"] = true; } else { ViewData["signalMasive"] = false; } } catch (Exception ex) { ViewData["signalMasive"] = false; } loadAreas(); return(View()); } else { return(Redirect("~/Home")); } }
// // GET: /UserProfile/ public ActionResult Index() { String dataPermissions = Session["Permissions"].ToString(); String dataPermissionsClient = Session["PermissionsClient"].ToString(); bool access = false; bool accessClient = false; access = validatepermissions.getpermissions("profiles", "r", dataPermissions); accessClient = validatepermissions.getpermissions("profiles", "r", dataPermissionsClient); if (access == true && accessClient == true) { //TODO: advanced search using Agregation. var profiles = _employeeProfileTable.getRows(); ViewBag.userTable = _userTable; return(View(profiles)); } else { return(Redirect("~/Home")); } }