Skip to content

Instantly share code, notes, and snippets.

@BryanWilhite
Created November 12, 2014 23:14
Show Gist options
  • Save BryanWilhite/103eb35da46468576ea1 to your computer and use it in GitHub Desktop.
Save BryanWilhite/103eb35da46468576ea1 to your computer and use it in GitHub Desktop.
ASP.NET MVC: IAccountRepository
using System.Web.Security;
namespace Fox.Web.Mvc.Models
{
/// <summary>
/// Defines the contract to support <see cref="AccountMembershipProvider"/>.
/// </summary>
public interface IAccountRepository
{
/// <summary>
/// Gets a list of the roles that a specified user is in for the configured applicationName.
/// </summary>
/// <param name="username">The user to return a list of roles for.</param>
/// <returns>
/// A string array containing the names of all the roles that the specified user is in for the configured applicationName.
/// </returns>
string[] GetRolesForUser(string username);
/// <summary>
/// Gets a value indicating whether the specified role name already exists in the role data source for the configured applicationName.
/// </summary>
/// <param name="roleName">The name of the role to search for in the data source.</param>
/// <returns>
/// true if the role name already exists in the data source for the configured applicationName; otherwise, false.
/// </returns>
bool RoleExists(string roleName);
/// <summary>
/// Updates information about a user in the data source.
/// </summary>
/// <param name="user">A <see cref="T:System.Web.Security.MembershipUser"/> object that represents the user to update and the updated information for the user.</param>
void UpdateUser(MembershipUser user);
/// <summary>
/// Verifies that the specified user name and password exist in the data source.
/// </summary>
/// <param name="username">The name of the user to validate.</param>
/// <param name="password">The password for the specified user.</param>
/// <returns>
/// true if the specified username and password are valid; otherwise, false.
/// </returns>
bool ValidateUser(string username, string password);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment