private static bool memberAuthentication(RestExtensionMethod baseExt, Member currentMem) { //Check group, type and ID bool memberAccess = false; if (!string.IsNullOrEmpty(baseExt.GetAllowGroup())) { //Groups array string[] groupArray = baseExt.GetAllowGroup().Split(','); foreach (MemberGroup mg in currentMem.Groups.Values) { foreach (string group in groupArray) { if (group == mg.Text) { memberAccess = true; } } } } //Membertype allowed? if (!string.IsNullOrEmpty(baseExt.GetAllowType()) && !memberAccess) { //Types array string[] typeArray = baseExt.GetAllowType().Split(','); foreach (string type in typeArray) { if (type == currentMem.ContentType.Alias) { memberAccess = true; } } } //Member ID allowed? should this work with loginName instead? if (!string.IsNullOrEmpty(baseExt.GetAllowMember()) && !memberAccess) { if (int.Parse((string)baseExt.GetAllowMember().Trim()) == currentMem.Id) { memberAccess = true; } } return(memberAccess); }
private static bool memberAuthentication(RestExtensionMethod baseExt, Member currentMem) { //Check group, type and ID bool memberAccess = false; if (!string.IsNullOrEmpty(baseExt.GetAllowGroup())) { //Groups array string[] groupArray = baseExt.GetAllowGroup().Split(','); foreach (MemberGroup mg in currentMem.Groups.Values) { foreach (string group in groupArray) { if (group == mg.Text) memberAccess = true; } } } //Membertype allowed? if (!string.IsNullOrEmpty(baseExt.GetAllowType()) && !memberAccess) { //Types array string[] typeArray = baseExt.GetAllowType().Split(','); foreach (string type in typeArray) { if (type == currentMem.ContentType.Alias) memberAccess = true; } } //Member ID allowed? should this work with loginName instead? if (!string.IsNullOrEmpty(baseExt.GetAllowMember()) && !memberAccess) { if (int.Parse((string)baseExt.GetAllowMember().Trim()) == currentMem.Id) memberAccess = true; } return memberAccess; }