You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@ -37,19 +37,19 @@ namespace System.Web.Security {
|
||||
public class ActiveDirectoryMembershipProvider : MembershipProvider {
|
||||
|
||||
[MonoTODO ("Not implemented")]
|
||||
public override bool ChangePassword (string username, string oldPwd, string newPwd)
|
||||
public override bool ChangePassword (string username, string oldPassword, string newPassword)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO ("Not implemented")]
|
||||
public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPwdQuestion, string newPwdAnswer)
|
||||
public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPasswordQuestion, string newPasswordAnswer)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO ("Not implemented")]
|
||||
public override MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
|
||||
public override MembershipUser CreateUser (string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@ -73,7 +73,7 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
[MonoTODO ("Not implemented")]
|
||||
public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
public override MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@ -91,7 +91,7 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override string GetPassword (string username, string answer)
|
||||
public override string GetPassword (string username, string passwordAnswer)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@ -121,7 +121,7 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override string ResetPassword (string username, string answer)
|
||||
public override string ResetPassword (string username, string passwordAnswer)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override bool UnlockUser (string userName)
|
||||
public override bool UnlockUser (string username)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ namespace System.Web.Security
|
||||
return usr;
|
||||
}
|
||||
|
||||
public static MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status)
|
||||
public static MembershipUser CreateUser (string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, out MembershipCreateStatus status)
|
||||
{
|
||||
return CreateUser (username, password, email, pwdQuestion, pwdAnswer, isApproved, null, out status);
|
||||
return CreateUser (username, password, email, passwordQuestion, passwordAnswer, isApproved, null, out status);
|
||||
}
|
||||
|
||||
public static MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
|
||||
public static MembershipUser CreateUser (string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
|
||||
{
|
||||
if (String.IsNullOrEmpty (username)) {
|
||||
status = MembershipCreateStatus.InvalidUserName;
|
||||
@ -100,7 +100,7 @@ namespace System.Web.Security
|
||||
return null;
|
||||
}
|
||||
|
||||
return Provider.CreateUser (username, password, email, pwdQuestion, pwdAnswer, isApproved, providerUserKey, out status);
|
||||
return Provider.CreateUser (username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status);
|
||||
}
|
||||
|
||||
public static bool DeleteUser (string username)
|
||||
@ -221,9 +221,9 @@ namespace System.Web.Security
|
||||
return Provider.GetUser (providerUserKey, userIsOnline);
|
||||
}
|
||||
|
||||
public static string GetUserNameByEmail (string email)
|
||||
public static string GetUserNameByEmail (string emailToMatch)
|
||||
{
|
||||
return Provider.GetUserNameByEmail (email);
|
||||
return Provider.GetUserNameByEmail (emailToMatch);
|
||||
}
|
||||
|
||||
public static void UpdateUser (MembershipUser user)
|
||||
@ -247,15 +247,15 @@ namespace System.Web.Security
|
||||
return Provider.FindUsersByEmail (emailToMatch, pageIndex, pageSize, out totalRecords);
|
||||
}
|
||||
|
||||
public static MembershipUserCollection FindUsersByName (string nameToMatch)
|
||||
public static MembershipUserCollection FindUsersByName (string usernameToMatch)
|
||||
{
|
||||
int totalRecords;
|
||||
return Provider.FindUsersByName (nameToMatch, 0, int.MaxValue, out totalRecords);
|
||||
return Provider.FindUsersByName (usernameToMatch, 0, int.MaxValue, out totalRecords);
|
||||
}
|
||||
|
||||
public static MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
public static MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
return Provider.FindUsersByName (nameToMatch, pageIndex, pageSize, out totalRecords);
|
||||
return Provider.FindUsersByName (usernameToMatch, pageIndex, pageSize, out totalRecords);
|
||||
}
|
||||
|
||||
public static string ApplicationName {
|
||||
|
@ -46,29 +46,29 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
|
||||
public static void AddUsersToRole (string [] usernames, string rolename)
|
||||
public static void AddUsersToRole (string [] usernames, string roleName)
|
||||
{
|
||||
Provider.AddUsersToRoles (usernames, new string[] {rolename});
|
||||
Provider.AddUsersToRoles (usernames, new string[] {roleName});
|
||||
}
|
||||
|
||||
public static void AddUsersToRoles (string [] usernames, string [] rolenames)
|
||||
public static void AddUsersToRoles (string [] usernames, string [] roleNames)
|
||||
{
|
||||
Provider.AddUsersToRoles (usernames, rolenames);
|
||||
Provider.AddUsersToRoles (usernames, roleNames);
|
||||
}
|
||||
|
||||
public static void AddUserToRole (string username, string rolename)
|
||||
public static void AddUserToRole (string username, string roleName)
|
||||
{
|
||||
Provider.AddUsersToRoles (new string[] {username}, new string[] {rolename});
|
||||
Provider.AddUsersToRoles (new string[] {username}, new string[] {roleName});
|
||||
}
|
||||
|
||||
public static void AddUserToRoles (string username, string [] rolenames)
|
||||
public static void AddUserToRoles (string username, string [] roleNames)
|
||||
{
|
||||
Provider.AddUsersToRoles (new string[] {username}, rolenames);
|
||||
Provider.AddUsersToRoles (new string[] {username}, roleNames);
|
||||
}
|
||||
|
||||
public static void CreateRole (string rolename)
|
||||
public static void CreateRole (string roleName)
|
||||
{
|
||||
Provider.CreateRole (rolename);
|
||||
Provider.CreateRole (roleName);
|
||||
}
|
||||
|
||||
public static void DeleteCookie ()
|
||||
@ -91,14 +91,14 @@ namespace System.Web.Security {
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DeleteRole (string rolename)
|
||||
public static bool DeleteRole (string roleName)
|
||||
{
|
||||
return Provider.DeleteRole (rolename, true);
|
||||
return Provider.DeleteRole (roleName, true);
|
||||
}
|
||||
|
||||
public static bool DeleteRole (string rolename, bool throwOnPopulatedRole)
|
||||
public static bool DeleteRole (string roleName, bool throwOnPopulatedRole)
|
||||
{
|
||||
return Provider.DeleteRole (rolename, throwOnPopulatedRole);
|
||||
return Provider.DeleteRole (roleName, throwOnPopulatedRole);
|
||||
}
|
||||
|
||||
public static string [] GetAllRoles ()
|
||||
@ -125,51 +125,51 @@ namespace System.Web.Security {
|
||||
return Provider.GetRolesForUser (username);
|
||||
}
|
||||
|
||||
public static string [] GetUsersInRole (string rolename)
|
||||
public static string [] GetUsersInRole (string roleName)
|
||||
{
|
||||
return Provider.GetUsersInRole (rolename);
|
||||
return Provider.GetUsersInRole (roleName);
|
||||
}
|
||||
|
||||
public static bool IsUserInRole (string rolename)
|
||||
public static bool IsUserInRole (string roleName)
|
||||
{
|
||||
return IsUserInRole (CurrentUser, rolename);
|
||||
return IsUserInRole (CurrentUser, roleName);
|
||||
}
|
||||
|
||||
public static bool IsUserInRole (string username, string rolename)
|
||||
public static bool IsUserInRole (string username, string roleName)
|
||||
{
|
||||
if (String.IsNullOrEmpty (username))
|
||||
return false;
|
||||
return Provider.IsUserInRole (username, rolename);
|
||||
return Provider.IsUserInRole (username, roleName);
|
||||
}
|
||||
|
||||
public static void RemoveUserFromRole (string username, string rolename)
|
||||
public static void RemoveUserFromRole (string username, string roleName)
|
||||
{
|
||||
Provider.RemoveUsersFromRoles (new string[] {username}, new string[] {rolename});
|
||||
Provider.RemoveUsersFromRoles (new string[] {username}, new string[] {roleName});
|
||||
}
|
||||
|
||||
public static void RemoveUserFromRoles (string username, string [] rolenames)
|
||||
public static void RemoveUserFromRoles (string username, string [] roleNames)
|
||||
{
|
||||
Provider.RemoveUsersFromRoles (new string[] {username}, rolenames);
|
||||
Provider.RemoveUsersFromRoles (new string[] {username}, roleNames);
|
||||
}
|
||||
|
||||
public static void RemoveUsersFromRole (string [] usernames, string rolename)
|
||||
public static void RemoveUsersFromRole (string [] usernames, string roleName)
|
||||
{
|
||||
Provider.RemoveUsersFromRoles (usernames, new string[] {rolename});
|
||||
Provider.RemoveUsersFromRoles (usernames, new string[] {roleName});
|
||||
}
|
||||
|
||||
public static void RemoveUsersFromRoles (string [] usernames, string [] rolenames)
|
||||
public static void RemoveUsersFromRoles (string [] usernames, string [] roleNames)
|
||||
{
|
||||
Provider.RemoveUsersFromRoles (usernames, rolenames);
|
||||
Provider.RemoveUsersFromRoles (usernames, roleNames);
|
||||
}
|
||||
|
||||
public static bool RoleExists (string rolename)
|
||||
public static bool RoleExists (string roleName)
|
||||
{
|
||||
return Provider.RoleExists (rolename);
|
||||
return Provider.RoleExists (roleName);
|
||||
}
|
||||
|
||||
public static string[] FindUsersInRole (string rolename, string usernameToMatch)
|
||||
public static string[] FindUsersInRole (string roleName, string usernameToMatch)
|
||||
{
|
||||
return Provider.FindUsersInRole (rolename, usernameToMatch);
|
||||
return Provider.FindUsersInRole (roleName, usernameToMatch);
|
||||
}
|
||||
|
||||
public static string ApplicationName {
|
||||
|
@ -122,28 +122,28 @@ namespace System.Web.Security {
|
||||
throw new ArgumentException (String.Format ("invalid format for {0}", pName));
|
||||
}
|
||||
|
||||
public override bool ChangePassword (string username, string oldPwd, string newPwd)
|
||||
public override bool ChangePassword (string username, string oldPassword, string newPassword)
|
||||
{
|
||||
if (username != null) username = username.Trim ();
|
||||
if (oldPwd != null) oldPwd = oldPwd.Trim ();
|
||||
if (newPwd != null) newPwd = newPwd.Trim ();
|
||||
if (oldPassword != null) oldPassword = oldPassword.Trim ();
|
||||
if (newPassword != null) newPassword = newPassword.Trim ();
|
||||
|
||||
CheckParam ("username", username, 256);
|
||||
CheckParam ("oldPwd", oldPwd, 128);
|
||||
CheckParam ("newPwd", newPwd, 128);
|
||||
CheckParam ("oldPassword", oldPassword, 128);
|
||||
CheckParam ("newPassword", newPassword, 128);
|
||||
|
||||
if (!CheckPassword (newPwd))
|
||||
if (!CheckPassword (newPassword))
|
||||
throw new ArgumentException (string.Format (
|
||||
"New Password invalid. New Password length minimum: {0}. Non-alphanumeric characters required: {1}.",
|
||||
MinRequiredPasswordLength,
|
||||
MinRequiredNonAlphanumericCharacters));
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
PasswordInfo pi = ValidateUsingPassword (username, oldPwd);
|
||||
PasswordInfo pi = ValidateUsingPassword (username, oldPassword);
|
||||
|
||||
if (pi != null) {
|
||||
EmitValidatingPassword (username, newPwd, false);
|
||||
string db_password = EncodePassword (newPwd, pi.PasswordFormat, pi.PasswordSalt);
|
||||
EmitValidatingPassword (username, newPassword, false);
|
||||
string db_password = EncodePassword (newPassword, pi.PasswordFormat, pi.PasswordSalt);
|
||||
|
||||
DbCommand command = factory.CreateCommand ();
|
||||
command.Connection = connection;
|
||||
@ -169,23 +169,23 @@ namespace System.Web.Security {
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPwdQuestion, string newPwdAnswer)
|
||||
public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPasswordQuestion, string newPasswordAnswer)
|
||||
{
|
||||
if (username != null) username = username.Trim ();
|
||||
if (newPwdQuestion != null) newPwdQuestion = newPwdQuestion.Trim ();
|
||||
if (newPwdAnswer != null) newPwdAnswer = newPwdAnswer.Trim ();
|
||||
if (newPasswordQuestion != null) newPasswordQuestion = newPasswordQuestion.Trim ();
|
||||
if (newPasswordAnswer != null) newPasswordAnswer = newPasswordAnswer.Trim ();
|
||||
|
||||
CheckParam ("username", username, 256);
|
||||
if (RequiresQuestionAndAnswer)
|
||||
CheckParam ("newPwdQuestion", newPwdQuestion, 128);
|
||||
CheckParam ("newPasswordQuestion", newPasswordQuestion, 128);
|
||||
if (RequiresQuestionAndAnswer)
|
||||
CheckParam ("newPwdAnswer", newPwdAnswer, 128);
|
||||
CheckParam ("newPasswordAnswer", newPasswordAnswer, 128);
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
PasswordInfo pi = ValidateUsingPassword (username, password);
|
||||
|
||||
if (pi != null) {
|
||||
string db_passwordAnswer = EncodePassword (newPwdAnswer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
string db_passwordAnswer = EncodePassword (newPasswordAnswer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
|
||||
DbCommand command = factory.CreateCommand ();
|
||||
command.Connection = connection;
|
||||
@ -194,7 +194,7 @@ namespace System.Web.Security {
|
||||
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
AddParameter (command, "@UserName", username);
|
||||
AddParameter (command, "@NewPasswordQuestion", newPwdQuestion);
|
||||
AddParameter (command, "@NewPasswordQuestion", newPasswordQuestion);
|
||||
AddParameter (command, "@NewPasswordAnswer", db_passwordAnswer);
|
||||
DbParameter returnValue = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
|
||||
@ -212,8 +212,8 @@ namespace System.Web.Security {
|
||||
public override MembershipUser CreateUser (string username,
|
||||
string password,
|
||||
string email,
|
||||
string pwdQuestion,
|
||||
string pwdAnswer,
|
||||
string passwordQuestion,
|
||||
string passwordAnswer,
|
||||
bool isApproved,
|
||||
object providerUserKey,
|
||||
out MembershipCreateStatus status)
|
||||
@ -221,8 +221,8 @@ namespace System.Web.Security {
|
||||
if (username != null) username = username.Trim ();
|
||||
if (password != null) password = password.Trim ();
|
||||
if (email != null) email = email.Trim ();
|
||||
if (pwdQuestion != null) pwdQuestion = pwdQuestion.Trim ();
|
||||
if (pwdAnswer != null) pwdAnswer = pwdAnswer.Trim ();
|
||||
if (passwordQuestion != null) passwordQuestion = passwordQuestion.Trim ();
|
||||
if (passwordAnswer != null) passwordAnswer = passwordAnswer.Trim ();
|
||||
|
||||
/* some initial validation */
|
||||
if (username == null || username.Length == 0 || username.Length > 256 || username.IndexOf (',') != -1) {
|
||||
@ -245,14 +245,14 @@ namespace System.Web.Security {
|
||||
return null;
|
||||
}
|
||||
if (RequiresQuestionAndAnswer &&
|
||||
(pwdQuestion == null ||
|
||||
pwdQuestion.Length == 0 || pwdQuestion.Length > 256)) {
|
||||
(passwordQuestion == null ||
|
||||
passwordQuestion.Length == 0 || passwordQuestion.Length > 256)) {
|
||||
status = MembershipCreateStatus.InvalidQuestion;
|
||||
return null;
|
||||
}
|
||||
if (RequiresQuestionAndAnswer &&
|
||||
(pwdAnswer == null ||
|
||||
pwdAnswer.Length == 0 || pwdAnswer.Length > 128)) {
|
||||
(passwordAnswer == null ||
|
||||
passwordAnswer.Length == 0 || passwordAnswer.Length > 128)) {
|
||||
status = MembershipCreateStatus.InvalidAnswer;
|
||||
return null;
|
||||
}
|
||||
@ -275,7 +275,7 @@ namespace System.Web.Security {
|
||||
|
||||
password = EncodePassword (password, PasswordFormat, passwordSalt);
|
||||
if (RequiresQuestionAndAnswer)
|
||||
pwdAnswer = EncodePassword (pwdAnswer, PasswordFormat, passwordSalt);
|
||||
passwordAnswer = EncodePassword (passwordAnswer, PasswordFormat, passwordSalt);
|
||||
|
||||
/* make sure the hashed/encrypted password and
|
||||
* answer are still under 128 characters. */
|
||||
@ -285,7 +285,7 @@ namespace System.Web.Security {
|
||||
}
|
||||
|
||||
if (RequiresQuestionAndAnswer) {
|
||||
if (pwdAnswer.Length > 128) {
|
||||
if (passwordAnswer.Length > 128) {
|
||||
status = MembershipCreateStatus.InvalidAnswer;
|
||||
return null;
|
||||
}
|
||||
@ -307,8 +307,8 @@ namespace System.Web.Security {
|
||||
AddParameter (command, "@Password", password);
|
||||
AddParameter (command, "@PasswordSalt", passwordSalt);
|
||||
AddParameter (command, "@Email", email);
|
||||
AddParameter (command, "@PasswordQuestion", pwdQuestion);
|
||||
AddParameter (command, "@PasswordAnswer", pwdAnswer);
|
||||
AddParameter (command, "@PasswordQuestion", passwordQuestion);
|
||||
AddParameter (command, "@PasswordAnswer", passwordAnswer);
|
||||
AddParameter (command, "@IsApproved", isApproved);
|
||||
AddParameter (command, "@CurrentTimeUtc", Now);
|
||||
AddParameter (command, "@CreateDate", Now);
|
||||
@ -429,9 +429,9 @@ namespace System.Web.Security {
|
||||
}
|
||||
}
|
||||
|
||||
public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
public override MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
CheckParam ("nameToMatch", nameToMatch, 256);
|
||||
CheckParam ("usernameToMatch", usernameToMatch, 256);
|
||||
|
||||
if (pageIndex < 0)
|
||||
throw new ArgumentException ("pageIndex must be >= 0");
|
||||
@ -449,7 +449,7 @@ namespace System.Web.Security {
|
||||
|
||||
AddParameter (command, "@PageIndex", pageIndex);
|
||||
AddParameter (command, "@PageSize", pageSize);
|
||||
AddParameter (command, "@UserNameToMatch", nameToMatch);
|
||||
AddParameter (command, "@UserNameToMatch", usernameToMatch);
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
// return value
|
||||
AddParameter (command, "@ReturnValue", ParameterDirection.ReturnValue, null);
|
||||
@ -529,20 +529,20 @@ namespace System.Web.Security {
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetPassword (string username, string answer)
|
||||
public override string GetPassword (string username, string passwordAnswer)
|
||||
{
|
||||
if (!EnablePasswordRetrieval)
|
||||
throw new NotSupportedException ("this provider has not been configured to allow the retrieval of passwords");
|
||||
|
||||
CheckParam ("username", username, 256);
|
||||
if (RequiresQuestionAndAnswer)
|
||||
CheckParam ("answer", answer, 128);
|
||||
CheckParam ("passwordAnswer", passwordAnswer, 128);
|
||||
|
||||
PasswordInfo pi = GetPasswordInfo (username);
|
||||
if (pi == null)
|
||||
throw new ProviderException ("An error occurred while retrieving the password from the database");
|
||||
|
||||
string user_answer = EncodePassword (answer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
string user_answer = EncodePassword (passwordAnswer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
string password = null;
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
@ -790,7 +790,7 @@ namespace System.Web.Security {
|
||||
ProvidersHelper.GetDbProviderFactory (connectionString.ProviderName);
|
||||
}
|
||||
|
||||
public override string ResetPassword (string username, string answer)
|
||||
public override string ResetPassword (string username, string passwordAnswer)
|
||||
{
|
||||
if (!EnablePasswordReset)
|
||||
throw new NotSupportedException ("this provider has not been configured to allow the resetting of passwords");
|
||||
@ -798,7 +798,7 @@ namespace System.Web.Security {
|
||||
CheckParam ("username", username, 256);
|
||||
|
||||
if (RequiresQuestionAndAnswer)
|
||||
CheckParam ("answer", answer, 128);
|
||||
CheckParam ("passwordAnswer", passwordAnswer, 128);
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
|
||||
@ -810,7 +810,7 @@ namespace System.Web.Security {
|
||||
EmitValidatingPassword (username, newPassword, false);
|
||||
|
||||
string db_password = EncodePassword (newPassword, pi.PasswordFormat, pi.PasswordSalt);
|
||||
string db_answer = EncodePassword (answer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
string db_answer = EncodePassword (passwordAnswer, pi.PasswordFormat, pi.PasswordSalt);
|
||||
|
||||
DbCommand command = factory.CreateCommand ();
|
||||
command.Connection = connection;
|
||||
|
@ -87,7 +87,7 @@ namespace System.Web.Security
|
||||
return dbp;
|
||||
}
|
||||
|
||||
public override void AddUsersToRoles (string [] usernames, string [] rolenames)
|
||||
public override void AddUsersToRoles (string [] usernames, string [] roleNames)
|
||||
{
|
||||
Hashtable h = new Hashtable ();
|
||||
|
||||
@ -102,7 +102,7 @@ namespace System.Web.Security
|
||||
}
|
||||
|
||||
h = new Hashtable ();
|
||||
foreach (string r in rolenames) {
|
||||
foreach (string r in roleNames) {
|
||||
if (r == null)
|
||||
throw new ArgumentNullException ("null element in rolenames array");
|
||||
if (h.ContainsKey (r))
|
||||
@ -119,7 +119,7 @@ namespace System.Web.Security
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameter (command, "@RoleNames", String.Join (",", rolenames));
|
||||
AddParameter (command, "@RoleNames", String.Join (",", roleNames));
|
||||
AddParameter (command, "@UserNames", String.Join (",", usernames));
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
AddParameter (command, "@CurrentTimeUtc", DateTime.UtcNow);
|
||||
@ -139,12 +139,12 @@ namespace System.Web.Security
|
||||
}
|
||||
}
|
||||
|
||||
public override void CreateRole (string rolename)
|
||||
public override void CreateRole (string roleName)
|
||||
{
|
||||
if (rolename == null)
|
||||
throw new ArgumentNullException ("rolename");
|
||||
if (roleName == null)
|
||||
throw new ArgumentNullException ("roleName");
|
||||
|
||||
if (rolename.Length == 0 || rolename.Length > 256 || rolename.IndexOf (',') != -1)
|
||||
if (roleName.Length == 0 || roleName.Length > 256 || roleName.IndexOf (',') != -1)
|
||||
throw new ArgumentException ("rolename is in invalid format");
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
@ -154,25 +154,25 @@ namespace System.Web.Security
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
AddParameter (command, "@RoleName", rolename);
|
||||
AddParameter (command, "@RoleName", roleName);
|
||||
DbParameter dbpr = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
|
||||
command.ExecuteNonQuery ();
|
||||
int returnValue = (int) dbpr.Value;
|
||||
|
||||
if (returnValue == 1)
|
||||
throw new ProviderException (rolename + " already exists in the database");
|
||||
throw new ProviderException (roleName + " already exists in the database");
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool DeleteRole (string rolename, bool throwOnPopulatedRole)
|
||||
public override bool DeleteRole (string roleName, bool throwOnPopulatedRole)
|
||||
{
|
||||
if (rolename == null)
|
||||
throw new ArgumentNullException ("rolename");
|
||||
if (roleName == null)
|
||||
throw new ArgumentNullException ("roleName");
|
||||
|
||||
if (rolename.Length == 0 || rolename.Length > 256 || rolename.IndexOf (',') != -1)
|
||||
if (roleName.Length == 0 || roleName.Length > 256 || roleName.IndexOf (',') != -1)
|
||||
throw new ArgumentException ("rolename is in invalid format");
|
||||
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
@ -182,7 +182,7 @@ namespace System.Web.Security
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
AddParameter (command, "@RoleName", rolename);
|
||||
AddParameter (command, "@RoleName", roleName);
|
||||
AddParameter (command, "@DeleteOnlyIfRoleIsEmpty", throwOnPopulatedRole);
|
||||
DbParameter dbpr = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
|
||||
@ -194,7 +194,7 @@ namespace System.Web.Security
|
||||
if (returnValue == 1)
|
||||
return false; //role does not exist
|
||||
else if (returnValue == 2 && throwOnPopulatedRole)
|
||||
throw new ProviderException (rolename + " is not empty");
|
||||
throw new ProviderException (roleName + " is not empty");
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@ -272,7 +272,7 @@ namespace System.Web.Security
|
||||
}
|
||||
}
|
||||
|
||||
public override string [] GetUsersInRole (string rolename)
|
||||
public override string [] GetUsersInRole (string roleName)
|
||||
{
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
DbCommand command = factory.CreateCommand ();
|
||||
@ -280,7 +280,7 @@ namespace System.Web.Security
|
||||
command.Connection = connection;
|
||||
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
AddParameter (command, "@RoleName", rolename);
|
||||
AddParameter (command, "@RoleName", roleName);
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
|
||||
DbDataReader reader = command.ExecuteReader ();
|
||||
@ -327,7 +327,7 @@ namespace System.Web.Security
|
||||
ProvidersHelper.GetDbProviderFactory (connectionString.ProviderName);
|
||||
}
|
||||
|
||||
public override bool IsUserInRole (string username, string rolename)
|
||||
public override bool IsUserInRole (string username, string roleName)
|
||||
{
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
DbCommand command = factory.CreateCommand ();
|
||||
@ -335,7 +335,7 @@ namespace System.Web.Security
|
||||
command.Connection = connection;
|
||||
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
AddParameter (command, "@RoleName", rolename);
|
||||
AddParameter (command, "@RoleName", roleName);
|
||||
AddParameter (command, "@UserName", username);
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
DbParameter dbpr = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
@ -350,7 +350,7 @@ namespace System.Web.Security
|
||||
}
|
||||
}
|
||||
|
||||
public override void RemoveUsersFromRoles (string [] usernames, string [] rolenames)
|
||||
public override void RemoveUsersFromRoles (string [] usernames, string [] roleNames)
|
||||
{
|
||||
Hashtable h = new Hashtable ();
|
||||
|
||||
@ -365,7 +365,7 @@ namespace System.Web.Security
|
||||
}
|
||||
|
||||
h = new Hashtable ();
|
||||
foreach (string r in rolenames) {
|
||||
foreach (string r in roleNames) {
|
||||
if (r == null)
|
||||
throw new ArgumentNullException ("null element in rolenames array");
|
||||
if (h.ContainsKey (r))
|
||||
@ -382,7 +382,7 @@ namespace System.Web.Security
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameter (command, "@UserNames", String.Join (",", usernames));
|
||||
AddParameter (command, "@RoleNames", String.Join (",", rolenames));
|
||||
AddParameter (command, "@RoleNames", String.Join (",", roleNames));
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
DbParameter dbpr = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
|
||||
@ -402,7 +402,7 @@ namespace System.Web.Security
|
||||
}
|
||||
}
|
||||
|
||||
public override bool RoleExists (string rolename)
|
||||
public override bool RoleExists (string roleName)
|
||||
{
|
||||
using (DbConnection connection = CreateConnection ()) {
|
||||
|
||||
@ -412,7 +412,7 @@ namespace System.Web.Security
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameter (command, "@ApplicationName", ApplicationName);
|
||||
AddParameter (command, "@RoleName", rolename);
|
||||
AddParameter (command, "@RoleName", roleName);
|
||||
DbParameter dbpr = AddParameter (command, "@ReturnVal", ParameterDirection.ReturnValue, DbType.Int32, null);
|
||||
|
||||
command.ExecuteNonQuery ();
|
||||
|
Reference in New Issue
Block a user