protected override bool AuthorizeCore(HttpContextBase httpContext) { if (AllowMembers.IsNullOrWhiteSpace()) { AllowMembers = ""; } if (AllowGroup.IsNullOrWhiteSpace()) { AllowGroup = ""; } if (AllowType.IsNullOrWhiteSpace()) { AllowType = ""; } var members = new List <int>(); foreach (var s in AllowMembers.Split(',')) { if (int.TryParse(s, out var id)) { members.Add(id); } } var helper = Current.Factory.GetInstance <MembershipHelper>(); return(helper.IsMemberAuthorized(AllowType.Split(','), AllowGroup.Split(','), members)); }
private async Task <bool> IsAuthorizedAsync(IMemberManager memberManager) { if (AllowMembers.IsNullOrWhiteSpace()) { AllowMembers = string.Empty; } if (AllowGroup.IsNullOrWhiteSpace()) { AllowGroup = string.Empty; } if (AllowType.IsNullOrWhiteSpace()) { AllowType = string.Empty; } var members = new List <int>(); foreach (var s in AllowMembers.Split(Core.Constants.CharArrays.Comma)) { if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var id)) { members.Add(id); } } return(await memberManager.IsMemberAuthorizedAsync(AllowType.Split(Core.Constants.CharArrays.Comma), AllowGroup.Split(Core.Constants.CharArrays.Comma), members)); }
protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext) { if (AllowMembers.IsNullOrWhiteSpace()) { AllowMembers = ""; } if (AllowGroup.IsNullOrWhiteSpace()) { AllowGroup = ""; } if (AllowType.IsNullOrWhiteSpace()) { AllowType = ""; } var members = new List <int>(); foreach (var s in AllowMembers.Split(',')) { int id; if (int.TryParse(s, out id)) { members.Add(id); } } return(GetUmbracoContext().Security.IsMemberAuthorized(AllowAll, AllowType.Split(','), AllowGroup.Split(','), members)); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (AllowMembers.IsNullOrWhiteSpace()) { AllowMembers = ""; } if (AllowGroup.IsNullOrWhiteSpace()) { AllowGroup = ""; } if (AllowType.IsNullOrWhiteSpace()) { AllowType = ""; } var members = new List <int>(); foreach (var s in AllowMembers.Split(',')) { int id; if (int.TryParse(s, out id)) { members.Add(id); } } return(UmbracoContext.Security.IsMemberAuthorized(AllowAll, AllowType.Split(','), AllowGroup.Split(','), members)); }
protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext) { if (AllowMembers.IsNullOrWhiteSpace()) { AllowMembers = ""; } if (AllowGroup.IsNullOrWhiteSpace()) { AllowGroup = ""; } if (AllowType.IsNullOrWhiteSpace()) { AllowType = ""; } var members = new List <int>(); foreach (var s in AllowMembers.Split(Constants.CharArrays.Comma)) { if (int.TryParse(s, out var id)) { members.Add(id); } } var helper = Current.Factory.GetInstance <MembershipHelper>(); return(helper.IsMemberAuthorized(AllowType.Split(Constants.CharArrays.Comma), AllowGroup.Split(Constants.CharArrays.Comma), members)); }