public IUserProfile Authorize(Security.SecurityPrincipal principal) { IUserProfile profile = null; using (var db = new FleetConnectEntities()) { #region Variables List <string> permissions = new List <string>(); List <int> retailers = new List <int>(); SECURITY_User usr = db.SECURITY_User.Find(Helpers.SessionHelpers.LOGGED_IN_USER); //This is set in Authenticate(System.Net.NetworkCredential credential) above #endregion #region Get permissions log.Info("Detected user : "******"Granting " + usr.EmailAddress + " permission : " + item.Name); if (!permissions.Contains(item.GUID.ToString().ToUpper())) { permissions.Add(item.GUID.ToString().ToUpper()); } else { log.Info("Permission list already contains: " + item.Name); } } #region Create the UserProfile profile = new Assessment.Security.UserProfile(usr.UserId, usr.FirstName + " " + usr.LastName, permissions, retailers); #endregion #endregion } return(profile); }