/// <summary> /// if the user is in any one of the validRoleNames, authentication will proceed. /// </summary> /// <param name="context"></param> /// <param name="validRoleNames"></param> /// <returns></returns> public bool CheckAuthentication(HttpContext context, string[] validRoleNames, PortalApplication portalApp) { var IsValid = false; if (WebPortalUser.CheckLogin(_un, _pw, portalApp)) { WebPortalUser u = WebPortalUser.FetchUser(_un, portalApp); foreach (string requiredRoleName in validRoleNames) { bool b = u.inRole(requiredRoleName); if (b) { Roles.Add(requiredRoleName); IsValid = true; } } if (IsValid) { u.SetLastLoginInDatabaseToNow(); return(true); } } return(false); }
public bool CheckAuthentication(HttpContext context, string requiredRoleName, PortalApplication portalApp) { if (WebPortalUser.CheckLogin(_un, _pw, portalApp)) { WebPortalUser u = WebPortalUser.FetchUser(_un, portalApp); bool b = u.inRole(requiredRoleName); if (b) { u.SetLastLoginInDatabaseToNow(); return(true); } } return(false); }