private void PermissionObject_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { PickOne pickOne = new PickOne("Select an object or statement"); SqlCommand sqlCommand = GetUserObjectsCommand(); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); pickOne.AppendListContents(sqlDataReader, "name"); sqlDataReader.Close(); string [] statementPermissions = { "CREATE DATABASE", "CREATE DEFAULT", "CREATE FUNCTION", "CREATE PROCEDURE", "CREATE RULE", "CREATE TABLE", "CREATE VIEW", "BACKUP DATABASE", "BACKUP LOG" }; pickOne.AppendListContents(statementPermissions); if (pickOne.ShowDialog() == DialogResult.OK) { sqlCommand = GetPermissionsCommand(); SqlParameter sqlParameter = new SqlParameter("@name", pickOne.Selected); sqlCommand.Parameters.Add(sqlParameter); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } } }
private void PermissionUser_Click(object sender, System.EventArgs e) { // need to pick up all roles and all users in the current database CheckConnection(); if (sqlConnection != null) { PickOne pickOne = new PickOne("Select a user or role"); SqlCommand sqlCommand = GetUsersCommand(); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); pickOne.AppendListContents(sqlDataReader, "UserName"); sqlDataReader.Close(); sqlCommand = GetRolesCommand(); sqlDataReader = sqlCommand.ExecuteReader(); pickOne.AppendListContents(sqlDataReader, "RoleName"); sqlDataReader.Close(); if (pickOne.ShowDialog() == DialogResult.OK) { sqlCommand = GetPermissionsCommand(); SqlParameter sqlParameter = new SqlParameter("@username", pickOne.Selected); sqlCommand.Parameters.Add(sqlParameter); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } } }
private void ViewRoles_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { SqlCommand sqlCommand = this.GetRolesCommand(); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } }
private void AllPermissions_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { SqlCommand sqlCommand = GetPermissionsCommand(); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } }
private void ServerRoleMembers_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { SqlCommand sqlCommand = GetServerRoleMembersCommand(); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } }
private void ValidateLoginsButton_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { SqlCommand sqlCommand = GetValidateLoginsCommand(); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } }
private void FixedRolePermissions_Click(object sender, System.EventArgs e) { CheckConnection(); if (sqlConnection != null) { SqlCommand sqlCommand = GetFixedDbRolesCommand(); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); PickOne pickOne = new PickOne("Select a server role"); pickOne.AppendListContents(sqlDataReader, "DbFixedRole"); sqlDataReader.Close(); if (pickOne.ShowDialog() == DialogResult.OK) { sqlCommand = GetDbFixedRolePermissionsCommand(); SqlParameter sqlParameter = new SqlParameter("@rolename", pickOne.Selected); sqlCommand.Parameters.Add(sqlParameter); QueryForm queryForm = new QueryForm(sqlCommand); queryForm.ShowDialog(); } } }