// // Summary: // Returns the user associated with this login public async Task <TUser> FindAsync(UserLoginInfo login) { var info = await m_lookupTable.FindAsync <LookupInfo>("LoginProvider_" + login.LoginProvider, login.ProviderKey); if (info != null) { return(await m_userTable.FindAsync <TUser>(info.UserId, string.Empty)); } return(null); }
// // Summary: // Removes the user login with the specified combination if it exists // // Parameters: // user: // // login: public async Task RemoveLoginAsync(TUser user, UserLoginInfo login) { var userLogin = await m_userLoginTable.FindAsync <UserLogin>(user.Id, login.ProviderKey); if (userLogin != null && userLogin.ProviderKey == login.ProviderKey) { await m_userLoginTable.DeleteAsync(userLogin); } var info = await m_lookupTable.FindAsync <LookupInfo>("LoginProvider_" + login.LoginProvider, login.ProviderKey); if (info != null) { await m_lookupTable.DeleteAsync(info); } }
/// <summary> /// Find an User by userId /// </summary> /// <param name="userId">The user's Id</param> /// <returns></returns> public Task <TUser> FindByIdAsync(string userId) { return(m_userTable.FindAsync <TUser>(userId, string.Empty)); }
// // Summary: // Returns true if a user is in the role // // Parameters: // user: // // roleName: public async Task <bool> IsInRoleAsync(TUser user, string roleName) { var userRole = await m_userRoleTable.FindAsync <UserRole>(user.Id, roleName); return(userRole != null); }
// // Summary: // Find a role by id // // Parameters: // roleId: public async Task <TRole> FindByIdAsync(string roleId) { return(await m_roleTable.FindAsync <TRole>(roleId, string.Empty)); }