public Roles getRoles(User secureuser) { var userRoles = new Roles(); string strQuery = "SELECT dbo.udf_GetEmployeeType(@cUser_Cd) AS EmployeeType_Txt "; var employeeType = (_connection.Query<EmployeeType>(strQuery, new { cUser_Cd = secureuser.Id }).SingleOrDefault()); if(employeeType == null) throw new Exception("Something Bad Happened"); employeeType.Initialize(); if (employeeType.IsAdmin) { userRoles = userRoles | Roles.Admin; } else if (employeeType.IsManager) { strQuery = "select Access_Cd from Security..UserSettings where User_Cd = @cUser_Cd"; var managerType = (_connection.Query<string>(strQuery, new { cUser_Cd = secureuser.Id }).SingleOrDefault()); if(managerType == null) throw new Exception("Something Bad Happened"); managerType = managerType.Trim(); if(managerType.Equals("D")) userRoles = userRoles | Roles.ManagerDepartment; else userRoles = userRoles | Roles.ManagerEmployee; } else { userRoles = userRoles | Roles.Ess; } return userRoles; }
public JsonResult GetDashboard() { var loggedinUser = new User { Id = _sd.NetworkUserID, IsEss = _sd.IsEss.Equals("Yes") }; _sr.Setup(loggedinUser); var dashboard = _dashboardbuilder.BuildDashboard(_sr); return Json(dashboard, JsonRequestBehavior.AllowGet); }
public JsonResult GetWidgetList() { var loggedinUser = new User { Id = _sd.NetworkUserID, IsEss = _sd.IsEss.Equals("Yes") }; _sr.Setup(loggedinUser); var widgets = _widgetbuilder.BuildWidgets(_sr); return Json(widgets, JsonRequestBehavior.AllowGet); }
/// <summary> /// Decides if the user has a custom dashboard, or they are using default. /// </summary> /// <param name="user"></param> /// <param name="role"></param> /// <returns>Company or User</returns> public string GetDashboardType(User user, Roles role) { if (role == (Roles)1) { return "Company"; } else { return "User"; } }
public List<Permission> getPermissions(User secureuser) { var displaySecurity = new DisplaySecurity(); var modifySecurity = new ModifySecurity(); const string strQuery = "SELECT dbo.udf_GetEmployeeType(@cUser_Cd) AS EmployeeType_Txt "; var employeeType = (_connection.Query<EmployeeType>(strQuery, new { cUser_Cd = secureuser.Id }).SingleOrDefault()); if (employeeType == null) throw new Exception("Something Bad Happened"); employeeType.Initialize(); return new PermissionList(displaySecurity, modifySecurity); }
public Dashboard GetUserDashboard(User user, Roles role) { return new Dashboard(2, "layout4", "User"); ; }
public Dashboard GetCompanyDashboard(User user) { return new Dashboard(1, "layout1", "Company"); }
public void Setup(User loggedinUser) { user = loggedinUser; //GetCurrentRole(); }