using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace SecuMaison.Classes {
  public class RoleProviderMaison : RoleProvider {
    public const string Grouillot = "Grouillot";
    public const string Chef = "Chef";

    public override string[] GetAllRoles() {
      return new string[] { Grouillot, Chef };
    }
    public override string[] GetRolesForUser( string username ) {
      if( username.ToUpper().Contains( Chef.ToUpper() ) )
        return new string[] { Chef };
      else
        return new string[] { Grouillot };
    }
    public override bool IsUserInRole( string username, string roleName ) {
      if( string.Compare( roleName, Chef, true ) == 0 ) {
        return username.ToUpper().Contains( Chef.ToUpper() );
      }
      if( string.Compare( roleName, Grouillot, true ) == 0 ) {
        return true;
      }
      return false;
    }
    public override string ApplicationName { get; set; }

    public override void AddUsersToRoles( string[] usernames, string[] roleNames ) {
      throw new NotImplementedException();
    }
    #region Pas mis en oeuvre non plus...
    public override void CreateRole( string roleName ) {
      throw new NotImplementedException();
    }
    public override bool DeleteRole( string roleName, bool throwOnPopulatedRole ) {
      throw new NotImplementedException();
    }
    public override string[] FindUsersInRole( string roleName, string usernameToMatch ) {
      throw new NotImplementedException();
    }
    public override string[] GetUsersInRole( string roleName ) {
      throw new NotImplementedException();
    }
    public override void RemoveUsersFromRoles( string[] usernames, string[] roleNames ) {
      throw new NotImplementedException();
    }
    public override bool RoleExists( string roleName ) {
      throw new NotImplementedException();
    }
    #endregion Pas mis en oeuvre non plus...
  }
}