public void DeleteUserAccount(string userAccount) { try { if (manager.UserExists(userAccount)) { manager.DeleteUser(userAccount); } } catch (Exception ex) { throw ex; } }
public void DeleteUserWithAProfile() { UserRoleManager urm = new UserRoleManager("EntLibSecurity", Context); urm.CreateUser("testuser3", ASCIIEncoding.ASCII.GetBytes("Password")); GenericIdentity ident1 = new GenericIdentity("testuser3"); this.profile.SetProfile(ident1, "test"); try { urm.DeleteUser("testuser3"); } catch (Exception ex) { Assert.Fail("no exception should occur when deleting a user: " + ex.Message); } }
public void DeleteUserWithAProfile() { UserRoleManager urm = new UserRoleManager("EntLibSecurity", Context); urm.CreateUser("testuser3", ASCIIEncoding.ASCII.GetBytes("Password")); GenericIdentity ident1 = new GenericIdentity("testuser3"); this.profile.SetProfile(ident1, "test"); try { urm.DeleteUser("testuser3"); } catch (Exception ex) { Assert.Fail("no exception should occur when deleting a user: " + ex.Message); } }
public void CreateAndDeleteUser() { byte[] password = ASCIIEncoding.ASCII.GetBytes("zab123"); Assert.IsTrue(manager.CreateUser(userName, password)); DataSet ds = SelectIdentity(); Assert.AreEqual(1, ds.Tables[0].Rows.Count); Assert.AreEqual(userName, ds.Tables[0].Rows[0]["UserName"]); ds = GetPassword(userName); Assert.AreEqual(password.Length, ((byte[])ds.Tables[0].Rows[0]["Password"]).Length); manager.DeleteUser(userName); ds = SelectIdentity(); Assert.AreEqual(0, ds.Tables[0].Rows.Count); }
public static void DeleteTestData(ConfigurationContext context) { Data.Database db = DatabaseFactory.CreateDatabase("EntLibSecurity"); DBCommandWrapper cmd = db.GetSqlStringCommandWrapper("delete Profiles"); db.ExecuteNonQuery(cmd); UserRoleManager urm = new UserRoleManager("EntLibSecurity", context); try { urm.DeleteUserRole("testuser", "Users"); } catch { } try { urm.DeleteUserRole("testuser", "Managers"); } catch { } try { urm.DeleteRole("Admins"); } catch { } try { urm.DeleteRole("Managers"); } catch { } try { urm.DeleteRole("Users"); } catch { } try { urm.DeleteUser("testuser"); try {urm.DeleteUser("emptyUser");} catch{} } catch { } try { urm.DeleteUser("bogususer"); } catch { } try { urm.DeleteUser("emptyUser"); } catch { } }
private void DeleteUserDelegate(params object[] methodParams) { manager.DeleteUser((string)methodParams[0]); }
public static void DeleteTestData(ConfigurationContext context) { Data.Database db = DatabaseFactory.CreateDatabase("EntLibSecurity"); DBCommandWrapper cmd = db.GetSqlStringCommandWrapper("delete Profiles"); db.ExecuteNonQuery(cmd); UserRoleManager urm = new UserRoleManager("EntLibSecurity", context); try { urm.DeleteUserRole("testuser", "Users"); } catch { } try { urm.DeleteUserRole("testuser", "Managers"); } catch { } try { urm.DeleteRole("Admins"); } catch { } try { urm.DeleteRole("Managers"); } catch { } try { urm.DeleteRole("Users"); } catch { } try { urm.DeleteUser("testuser"); try { urm.DeleteUser("emptyUser"); } catch {} } catch { } try { urm.DeleteUser("bogususer"); } catch { } try { urm.DeleteUser("emptyUser"); } catch { } }