Example #1
0
 public ICollection <AspNetIdentityUserClaim> AspNetIdentityUserClaims(GStoreData.Models.UserProfile userProfile)
 {
     Identity.AspNetIdentityUser user = AspNetIdentityUser(userProfile);
     if (user == null)
     {
         return(null);
     }
     return(user.Claims);
 }
Example #2
0
        public ICollection <AspNetIdentityUserLogin> AspNetIdentityUserLogins(Models.UserProfile userProfile)
        {
            Identity.AspNetIdentityUser user = AspNetIdentityUser(userProfile);
            if (user == null)
            {
                return(null);
            }

            return(user.Logins);
        }
Example #3
0
        public List <AspNetIdentityRole> AspNetIdentityRoles(GStoreData.Models.UserProfile userProfile)
        {
            Identity.AspNetIdentityUser user = AspNetIdentityUser(userProfile);
            if (user == null)
            {
                return(null);
            }

            var query = from userRole in user.Roles
                        join role in this.Roles on userRole.RoleId equals role.Id
                        select role;

            return(query.ToList());
        }
Example #4
0
 public Identity.AspNetIdentityUser AspNetIdentityUser(GStoreData.Models.UserProfile userProfile)
 {
     if (userProfile == null)
     {
         throw new ApplicationException("User profile is null, cannot check identity user with null profile");
     }
     Identity.AspNetIdentityContext ctx  = new Identity.AspNetIdentityContext();
     Identity.AspNetIdentityUser    user = ctx.Users.SingleOrDefault(usr => usr.Id == userProfile.UserId);
     if (user == null)
     {
         throw new ApplicationException("AspNetUser not found. Check for extra profiles in UserProfile table with duplicate email address."
                                        + "\n\tUserId (from profile): " + userProfile.UserId
                                        + "\n\tEmail (from profile): " + userProfile.Email
                                        + "\n\tUserProfileId (from profile): " + userProfile.UserProfileId);
     }
     return(user);
 }