public bool Showdrop(string group) { var u = HttpContext.Current.User; return((u.IsInRole("Edit") || RoleChecker.HasSetting(SettingName.OrgMembersDropAdd, true)) && (MultiSelect ? "" : GroupSelect) == group); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { NoCheckRole = NoCheckRole || (filterContext.RouteData.Values["Controller"].ToString() == "Email" && CurrentDatabase.Setting("UX-AllowMyDataUserEmails")) || (filterContext.RouteData.Values["Controller"].ToString() == "OrgMemberDialog" && filterContext.RouteData.Values["Action"].ToString() == "Drop" && CurrentDatabase.Setting("UX-AllowMyDataUserLeaveOrg") && Util.UserPeopleId.ToString() == filterContext.RequestContext?.HttpContext?.Request?.Params["PeopleId"]); if (!User.Identity.IsAuthenticated) { var s = "/Logon?ReturnUrl=" + HttpUtility.UrlEncode(Request.RawUrl); if (Request.QueryString.Count > 0) { s += "&" + Request.QueryString.ToString(); } filterContext.Result = Redirect(s); } else if (!NoCheckRole) { var r = AccountModel.CheckAccessRole(Util.UserName); if (r.HasValue()) { filterContext.Result = Redirect(r); } } var disableHomePageForOrgLeaders = CurrentDatabase.Setting("UX-DisableHomePageForOrgLeaders"); if (!disableHomePageForOrgLeaders) { disableHomePageForOrgLeaders = RoleChecker.HasSetting(SettingName.DisableHomePage, false); } var contr = filterContext.RouteData.Values["Controller"].ToString(); var act = filterContext.RouteData.Values["Action"].ToString(); var orgleaderonly = User.IsInRole("OrgLeadersOnly"); if (contr == "Home" && act == "Index" && disableHomePageForOrgLeaders && orgleaderonly) { Util2.OrgLeadersOnly = true; CurrentDatabase.SetOrgLeadersOnly(); filterContext.Result = Redirect($"/Person2/{Util.UserPeopleId}"); } else if (orgleaderonly && Util2.OrgLeadersOnly == false) { Util2.OrgLeadersOnly = true; CurrentDatabase.SetOrgLeadersOnly(); } base.OnActionExecuting(filterContext); Util.Helpfile = $"_{filterContext.ActionDescriptor.ControllerDescriptor.ControllerName}_{filterContext.ActionDescriptor.ActionName}"; CurrentDatabase.UpdateLastActivity(Util.UserId); HttpContext.Response.Headers.Add("X-Robots-Tag", "noindex"); HttpContext.Response.Headers.Add("X-Robots-Tag", "unavailable after: 1 Jan 2017 01:00:00 CST"); }
public bool Showdrop(string group) { if ((MultiSelect ? "" : GroupSelect) != group) { return(false); } return(User.InRole("Edit") || RoleChecker.HasSetting(SettingName.OrgMembersDropAdd, false)); }
public bool Showdrop(string group) { if ((MultiSelect ? "" : GroupSelect) != group) { return(false); } var u = HttpContext.Current.User; return(u.IsInRole("Edit") || RoleChecker.HasSetting(SettingName.OrgMembersDropAdd, false)); }
public bool UserCanEdit() { if (Type == "Attr") { return(false); } var user = HttpContext.Current?.User; if (user == null) { return(false); } var path = HttpContext.Current?.Request.Path; if (path != null && path.Contains("CommunityGroup")) { if (user.IsInRole("Edit")) { return(true); } if (RoleChecker.HasSetting(SettingName.CanEditCGInfoEVs, false)) { if (string.IsNullOrEmpty(EditableRoles)) { return(true); } var editableRoles = EditableRoles.SplitStr(","); return(editableRoles.Any(role => user.IsInRole(role.Trim()))); } return(false); } return(user.IsInRole("Edit")); }