public void AddAndRemoveUserRoles() { byte[] password = ASCIIEncoding.ASCII.GetBytes("zab123"); manager.CreateUser(userName, password); manager.CreateRole(roleName); manager.CreateRole(roleName2); manager.CreateUserRole(userName, roleName); manager.CreateUserRole(userName, roleName2); DataSet ds = SelectUserRoles(userName); Assert.AreEqual(2, ds.Tables[0].Rows.Count); Assert.AreEqual(roleName, ds.Tables[0].Rows[0]["RoleName"]); Assert.AreEqual(roleName2, ds.Tables[0].Rows[1]["RoleName"]); // delete the rows manager.DeleteUserRole(userName, roleName); manager.DeleteUserRole(userName, roleName2); ds = SelectUserRoles(userName); Assert.AreEqual(0, ds.Tables[0].Rows.Count); manager.DeleteRole(roleName); manager.DeleteRole(roleName2); manager.DeleteUser(userName); }
private async void DeleteUserRole_Click(object sender, RoutedEventArgs e) { if (UserRoleIdWillBeDeleted.Text != "") { string id = UserRoleIdWillBeDeleted.Text; await UserRoleManager.DeleteUserRole(id, UserRoles); } }
public void DeleteUserRole(string userAccount, string userRole) { try { manager.DeleteUserRole(userAccount, userRole); } catch (Exception ex) { throw ex; } }
public int DeleteUserRole(int userRoleID) { try { return(UserRoleManager.DeleteUserRole(userRoleID)); } catch { return(0); } }
private async void DeleteUserRole_Click(object sender, RoutedEventArgs e) { await UserRoleManager.DeleteUserRole((String)((Button)sender).Tag, UserRoles); Frame.Navigate(typeof(ManageUserRolePage)); }
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 DeleteUserRoleDelegate(params object[] methodParams) { manager.DeleteUserRole((string)methodParams[0], (string)methodParams[1]); }
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 { } }