mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Error on unused private properties (#2008)
* Error on unused private properties * Remove nullable * Delete some commented out code * Fix compile
This commit is contained in:
@@ -14,6 +14,11 @@ dotnet_diagnostic.IDE0073.severity = none
|
|||||||
|
|
||||||
dotnet_analyzer_diagnostic.severity = error
|
dotnet_analyzer_diagnostic.severity = error
|
||||||
|
|
||||||
|
# The private field 'field' is assigned but its value is never used
|
||||||
|
dotnet_diagnostic.CS0414.severity = error
|
||||||
|
# The private field 'class member' is never used
|
||||||
|
dotnet_diagnostic.CS0169.severity = error
|
||||||
|
|
||||||
# Errors flagged when this file was added. These should be
|
# Errors flagged when this file was added. These should be
|
||||||
# investigated and either fixed or marked as acceptable with
|
# investigated and either fixed or marked as acceptable with
|
||||||
# a reason why
|
# a reason why
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace Microsoft.SqlTools.Extensibility
|
|||||||
{
|
{
|
||||||
|
|
||||||
private ExtensibleServiceHostOptions options;
|
private ExtensibleServiceHostOptions options;
|
||||||
private static bool isLoaded;
|
|
||||||
public ExtensionServiceProvider serviceProvider;
|
public ExtensionServiceProvider serviceProvider;
|
||||||
private List<IHostedService> initializedServices = new List<IHostedService>();
|
private List<IHostedService> initializedServices = new List<IHostedService>();
|
||||||
|
|
||||||
@@ -39,8 +38,6 @@ namespace Microsoft.SqlTools.Extensibility
|
|||||||
// as otherwise the Initialize event can be lost - it's processed and discarded before the handler
|
// as otherwise the Initialize event can be lost - it's processed and discarded before the handler
|
||||||
// is hooked up to receive the message
|
// is hooked up to receive the message
|
||||||
this.Start().GetAwaiter().GetResult();
|
this.Start().GetAwaiter().GetResult();
|
||||||
isLoaded = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
|
|||||||
@@ -62,11 +62,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ConnectionService Instance => instance.Value;
|
public static ConnectionService Instance => instance.Value;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The authenticator instance for AAD MFA authentication needs.
|
|
||||||
/// </summary>
|
|
||||||
private IAuthenticator authenticator;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IV and Key as received from Encryption Key Notification event.
|
/// IV and Key as received from Encryption Key Notification event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -742,8 +742,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
private ShowPlanGraph graph;
|
private ShowPlanGraph graph;
|
||||||
private Edge parentEdge;
|
private Edge parentEdge;
|
||||||
private List<Edge> childrenEdges;
|
private List<Edge> childrenEdges;
|
||||||
private string nodeType;
|
|
||||||
|
|
||||||
private Node root;
|
private Node root;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -118,8 +118,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
private string displayNameKey;
|
private string displayNameKey;
|
||||||
private string descriptionKey;
|
private string descriptionKey;
|
||||||
private string imageName;
|
private string imageName;
|
||||||
private string helpKeyword;
|
|
||||||
private Type displayNodeType;
|
|
||||||
|
|
||||||
private string image;
|
private string image;
|
||||||
private string displayName;
|
private string displayName;
|
||||||
|
|||||||
@@ -37,14 +37,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private string contextUrn;
|
private string contextUrn;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parent node in the tree
|
|
||||||
/// </summary>
|
|
||||||
//private INodeInformation parent;
|
|
||||||
/// <summary>
|
|
||||||
/// Weak reference to the tree node this is paired with
|
|
||||||
/// </summary>
|
|
||||||
WeakReference NavigableItemReference;
|
|
||||||
/// <summary>
|
|
||||||
/// Property handlers
|
/// Property handlers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//private IList<IPropertyHandler> propertyHandlers;
|
//private IList<IPropertyHandler> propertyHandlers;
|
||||||
@@ -83,8 +75,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
properties = new NameObjectCollection();
|
properties = new NameObjectCollection();
|
||||||
//propertyHandlers = null;
|
|
||||||
NavigableItemReference = null;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class AppRoleGeneral
|
internal class AppRoleGeneral
|
||||||
{
|
{
|
||||||
#region Members
|
#region Members
|
||||||
|
|
||||||
private IServiceProvider serviceProvider = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// data container member that contains data specific information like
|
/// data container member that contains data specific information like
|
||||||
@@ -38,40 +36,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
//property by the initialization code
|
//property by the initialization code
|
||||||
private ServerConnection serverConnection;
|
private ServerConnection serverConnection;
|
||||||
|
|
||||||
|
#endregion
|
||||||
/// <summary>
|
|
||||||
/// execution mode by default for now is success
|
|
||||||
/// </summary>
|
|
||||||
private ExecutionMode m_executionMode = ExecutionMode.Success;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// should UI be enabled?
|
|
||||||
/// </summary>
|
|
||||||
private bool executeEnabled = true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// should script buttons be enabled?
|
|
||||||
/// </summary>
|
|
||||||
private bool scriptEnabled = true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// F1 keyword to be passed to books on-line
|
|
||||||
/// </summary>
|
|
||||||
private string helpF1Keyword = null;
|
|
||||||
private RunType runType;
|
|
||||||
|
|
||||||
//if derived class tries to call a protected method that relies on service provider,
|
|
||||||
//and the service provider hasn't been set yet, we will cache the values and will
|
|
||||||
//propagate them when we get the provider set
|
|
||||||
private System.Drawing.Icon cachedIcon = null;
|
|
||||||
private string cachedCaption = null;
|
|
||||||
|
|
||||||
//whether or not try to auto resize grid columns inside OnLoad method
|
|
||||||
private bool attemtGridAutoResize = true;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Trace support
|
#region Trace support
|
||||||
private const string componentName = "AppRoleGeneral";
|
private const string componentName = "AppRoleGeneral";
|
||||||
|
|
||||||
public string ComponentName
|
public string ComponentName
|
||||||
@@ -81,18 +49,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
return componentName;
|
return componentName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constants - urn fields, etc...
|
#region Constants - urn fields, etc...
|
||||||
private const string ownerField = "Owner";
|
private const string ownerField = "Owner";
|
||||||
private const string defaultSchemaField = "DefaultSchema";
|
private const string defaultSchemaField = "DefaultSchema";
|
||||||
private const string schemaNameField = "Name";
|
private const string schemaNameField = "Name";
|
||||||
private const string schemaOwnerField = "Owner";
|
private const string schemaOwnerField = "Owner";
|
||||||
private const string memberNameField = "Name";
|
private const string memberNameField = "Name";
|
||||||
private const string memberUrnField = "Urn";
|
private const string memberUrnField = "Urn";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constants - grid columns positions, etc...
|
#region Constants - grid columns positions, etc...
|
||||||
private const int colSchemasChecked = 0;
|
private const int colSchemasChecked = 0;
|
||||||
private const int colSchemasOwnedSchemas = 1;
|
private const int colSchemasOwnedSchemas = 1;
|
||||||
|
|
||||||
@@ -101,17 +69,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
private const int sizeCheckboxColumn = 20;
|
private const int sizeCheckboxColumn = 20;
|
||||||
private const int sizeBitmapColumn = 20;
|
private const int sizeBitmapColumn = 20;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Non-UI variables
|
#region Non-UI variables
|
||||||
private System.Xml.XmlDocument document = null;
|
private System.Xml.XmlDocument document = null;
|
||||||
private bool panelInitialized = false;
|
|
||||||
|
|
||||||
|
|
||||||
// info extracted from context
|
// info extracted from context
|
||||||
private string serverName;
|
private string serverName;
|
||||||
private string databaseName;
|
private string databaseName;
|
||||||
private string approleName;
|
private string approleName;
|
||||||
private bool passwordChanged = false;
|
private bool passwordChanged = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -119,21 +85,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
private string initialDefaultSchema;
|
private string initialDefaultSchema;
|
||||||
|
|
||||||
|
|
||||||
private bool isYukonOrLater;
|
private bool isYukonOrLater;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Properties: CreateNew/Properties mode
|
#region Properties: CreateNew/Properties mode
|
||||||
private bool IsPropertiesMode
|
private bool IsPropertiesMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return(approleName!=null) && (approleName.Trim().Length != 0);
|
return (approleName != null) && (approleName.Trim().Length != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors / Dispose
|
#region Constructors / Dispose
|
||||||
public AppRoleGeneral()
|
public AppRoleGeneral()
|
||||||
{
|
{
|
||||||
// This call is required by the Windows.Forms Form Designer.
|
// This call is required by the Windows.Forms Form Designer.
|
||||||
@@ -142,11 +108,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
public AppRoleGeneral(CDataContainer context)
|
public AppRoleGeneral(CDataContainer context)
|
||||||
{
|
{
|
||||||
// STrace.SetDefaultLevel(ComponentName , SQLToolsCommonTraceLvl.L1);
|
|
||||||
|
|
||||||
// this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + @".swb.approle.general.f1";
|
|
||||||
|
|
||||||
// InitializeComponent();
|
|
||||||
dataContainer = context;
|
dataContainer = context;
|
||||||
|
|
||||||
if (dataContainer != null)
|
if (dataContainer != null)
|
||||||
@@ -176,9 +137,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
// base.Dispose( disposing );
|
// base.Dispose( disposing );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Implementation: LoadData(), InitProp(), SendDataToServer()
|
#region Implementation: LoadData(), InitProp(), SendDataToServer()
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -191,16 +152,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
{
|
{
|
||||||
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
|
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
|
||||||
|
|
||||||
STParameters param;
|
STParameters param;
|
||||||
bool bStatus;
|
bool bStatus;
|
||||||
|
|
||||||
param = new STParameters();
|
param = new STParameters();
|
||||||
|
|
||||||
param.SetDocument(doc);
|
param.SetDocument(doc);
|
||||||
|
|
||||||
bStatus = param.GetParam("servername", ref this.serverName);
|
bStatus = param.GetParam("servername", ref this.serverName);
|
||||||
bStatus = param.GetParam("database", ref this.databaseName);
|
bStatus = param.GetParam("database", ref this.databaseName);
|
||||||
bStatus = param.GetParam("applicationrole", ref this.approleName);
|
bStatus = param.GetParam("applicationrole", ref this.approleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -235,7 +196,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
Enumerator enumerator = new Enumerator();
|
Enumerator enumerator = new Enumerator();
|
||||||
Request request = new Request();
|
Request request = new Request();
|
||||||
request.Urn = this.dataContainer.ObjectUrn;
|
request.Urn = this.dataContainer.ObjectUrn;
|
||||||
request.Fields = new String[] { AppRoleGeneral.defaultSchemaField};
|
request.Fields = new String[] { AppRoleGeneral.defaultSchemaField };
|
||||||
|
|
||||||
DataTable dataTable = enumerator.Process(serverConnection, request);
|
DataTable dataTable = enumerator.Process(serverConnection, request);
|
||||||
// STrace.Assert(dataTable != null, "dataTable is null");
|
// STrace.Assert(dataTable != null, "dataTable is null");
|
||||||
@@ -247,7 +208,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataRow dataRow = dataTable.Rows[0];
|
DataRow dataRow = dataTable.Rows[0];
|
||||||
this.initialDefaultSchema = Convert.ToString(dataRow[AppRoleGeneral.defaultSchemaField],System.Globalization.CultureInfo.InvariantCulture);
|
this.initialDefaultSchema = Convert.ToString(dataRow[AppRoleGeneral.defaultSchemaField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
// this.textBoxDefaultSchema.Text = this.initialDefaultSchema;
|
// this.textBoxDefaultSchema.Text = this.initialDefaultSchema;
|
||||||
}
|
}
|
||||||
@@ -346,17 +307,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.databaseName), "databaseName is empty");
|
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.databaseName), "databaseName is empty");
|
||||||
|
|
||||||
Microsoft.SqlServer.Management.Smo.Server srv = this.dataContainer.Server;
|
Microsoft.SqlServer.Management.Smo.Server srv = this.dataContainer.Server;
|
||||||
System.Diagnostics.Debug.Assert(srv!=null, "server object is null");
|
System.Diagnostics.Debug.Assert(srv != null, "server object is null");
|
||||||
|
|
||||||
Database db = srv.Databases[this.databaseName];
|
Database db = srv.Databases[this.databaseName];
|
||||||
System.Diagnostics.Debug.Assert(db!=null, "database object is null");
|
System.Diagnostics.Debug.Assert(db != null, "database object is null");
|
||||||
|
|
||||||
if (this.IsPropertiesMode == true) // in properties mode -> alter role
|
if (this.IsPropertiesMode == true) // in properties mode -> alter role
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.approleName), "approleName is empty");
|
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.approleName), "approleName is empty");
|
||||||
|
|
||||||
ApplicationRole approle = db.ApplicationRoles[this.approleName];
|
ApplicationRole approle = db.ApplicationRoles[this.approleName];
|
||||||
System.Diagnostics.Debug.Assert(approle!=null, "approle object is null");
|
System.Diagnostics.Debug.Assert(approle != null, "approle object is null");
|
||||||
|
|
||||||
bool alterRequired = false;
|
bool alterRequired = false;
|
||||||
|
|
||||||
@@ -368,7 +329,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
if (passwordChanged == true)
|
if (passwordChanged == true)
|
||||||
{
|
{
|
||||||
approle.ChangePassword((string) "_textBoxPaswordText");
|
approle.ChangePassword((string)"_textBoxPaswordText");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alterRequired == true)
|
if (alterRequired == true)
|
||||||
@@ -387,238 +348,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
approle.DefaultSchema = _selectedDefaultSchema;
|
approle.DefaultSchema = _selectedDefaultSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
approle.Create((string) "_textBoxPaswordText");
|
approle.Create((string)"_textBoxPaswordText");
|
||||||
|
|
||||||
SendToServerSchemaOwnershipChanges(db,approle);
|
SendToServerSchemaOwnershipChanges(db, approle);
|
||||||
SendToServerMembershipChanges(db,approle);
|
SendToServerMembershipChanges(db, approle);
|
||||||
|
|
||||||
this.dataContainer.SqlDialogSubject = approle; // needed by extended properties page
|
this.dataContainer.SqlDialogSubject = approle; // needed by extended properties page
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Schemas - general operations with ...
|
||||||
// #region Update UI enable/disable controls
|
|
||||||
// private void EnableDisableControls()
|
|
||||||
// {
|
|
||||||
// if (!this.isYukonOrLater)
|
|
||||||
// {
|
|
||||||
// panelSchema.Enabled = false;
|
|
||||||
// textBoxDefaultSchema.Enabled = false;
|
|
||||||
// buttonBrowseSchema.Enabled = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.IsPropertiesMode == true)
|
|
||||||
// {
|
|
||||||
// System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(this.textBoxRoleName.Text), "textBoxRoleName is empty");
|
|
||||||
// this.textBoxRoleName.Enabled = false;
|
|
||||||
|
|
||||||
// this.AllUIEnabled = true;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// this.textBoxRoleName.Enabled = true;
|
|
||||||
|
|
||||||
// this.AllUIEnabled = (this.textBoxRoleName.Text.Trim().Length != 0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if ((passwordChanged==true) && (textBoxPasword.Text != textBoxConfirmPassword.Text))
|
|
||||||
// {
|
|
||||||
// this.AllUIEnabled = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
|
|
||||||
|
|
||||||
// panelMembership.Enabled = false; // app role currently doesnt support any members
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Component Designer generated code
|
|
||||||
// /// <summary>
|
|
||||||
// /// Required method for Designer support - do not modify
|
|
||||||
// /// the contents of this method with the code editor.
|
|
||||||
// /// </summary>
|
|
||||||
// private void InitializeComponent()
|
|
||||||
// {
|
|
||||||
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppRoleGeneral));
|
|
||||||
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
|
|
||||||
// this.panelGeneral = new System.Windows.Forms.Panel();
|
|
||||||
// this.buttonBrowseSchema = new System.Windows.Forms.Button();
|
|
||||||
// this.textBoxDefaultSchema = new System.Windows.Forms.TextBox();
|
|
||||||
// this.textBoxPasword = new System.Windows.Forms.TextBox();
|
|
||||||
// this.labelPassword = new System.Windows.Forms.Label();
|
|
||||||
// this.labelDefaultSchema = new System.Windows.Forms.Label();
|
|
||||||
// this.textBoxRoleName = new System.Windows.Forms.TextBox();
|
|
||||||
// this.labelRoleName = new System.Windows.Forms.Label();
|
|
||||||
// this.textBoxConfirmPassword = new System.Windows.Forms.TextBox();
|
|
||||||
// this.labelConfirmPassword = new System.Windows.Forms.Label();
|
|
||||||
// this.panelMembership = new System.Windows.Forms.Panel();
|
|
||||||
// this.buttonRemove = new System.Windows.Forms.Button();
|
|
||||||
// this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
|
||||||
// this.labelMembersOfAppRole = new System.Windows.Forms.Label();
|
|
||||||
// this.panelSchema = new System.Windows.Forms.Panel();
|
|
||||||
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
|
||||||
// this.labelSchemasOwnedByAppRole = new System.Windows.Forms.Label();
|
|
||||||
// this.panelEntireUserControl.SuspendLayout();
|
|
||||||
// this.panelGeneral.SuspendLayout();
|
|
||||||
// this.panelMembership.SuspendLayout();
|
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
|
|
||||||
// this.panelSchema.SuspendLayout();
|
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
|
|
||||||
// this.SuspendLayout();
|
|
||||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
// //
|
|
||||||
// // panelEntireUserControl
|
|
||||||
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
|
|
||||||
// //
|
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelGeneral);
|
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
|
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
|
|
||||||
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
|
|
||||||
// this.panelEntireUserControl.Name = "panelEntireUserControl";
|
|
||||||
// //
|
|
||||||
// // panelGeneral
|
|
||||||
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.panelGeneral, "panelGeneral");
|
|
||||||
// this.panelGeneral.Controls.Add(this.labelRoleName);
|
|
||||||
// this.panelGeneral.Controls.Add(this.textBoxRoleName);
|
|
||||||
// this.panelGeneral.Controls.Add(this.labelDefaultSchema);
|
|
||||||
// this.panelGeneral.Controls.Add(this.textBoxDefaultSchema);
|
|
||||||
// this.panelGeneral.Controls.Add(this.buttonBrowseSchema);
|
|
||||||
// this.panelGeneral.Controls.Add(this.labelPassword);
|
|
||||||
// this.panelGeneral.Controls.Add(this.textBoxPasword);
|
|
||||||
// this.panelGeneral.Controls.Add(this.labelConfirmPassword);
|
|
||||||
// this.panelGeneral.Controls.Add(this.textBoxConfirmPassword);
|
|
||||||
// this.panelGeneral.Name = "panelGeneral";
|
|
||||||
// //
|
|
||||||
// // buttonBrowseSchema
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.buttonBrowseSchema, "buttonBrowseSchema");
|
|
||||||
// this.buttonBrowseSchema.Name = "buttonBrowseSchema";
|
|
||||||
// this.buttonBrowseSchema.Click += new System.EventHandler(this.buttonBrowseSchema_Click);
|
|
||||||
// //
|
|
||||||
// // textBoxDefaultSchema
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.textBoxDefaultSchema, "textBoxDefaultSchema");
|
|
||||||
// this.textBoxDefaultSchema.Name = "textBoxDefaultSchema";
|
|
||||||
// this.textBoxDefaultSchema.TextChanged += new System.EventHandler(this.textBoxRoleName_TextChanged);
|
|
||||||
// //
|
|
||||||
// // textBoxPasword
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.textBoxPasword, "textBoxPasword");
|
|
||||||
// this.textBoxPasword.Name = "textBoxPasword";
|
|
||||||
// this.textBoxPasword.TextChanged += new System.EventHandler(this.textBoxPasword_TextChanged);
|
|
||||||
// //
|
|
||||||
// // labelPassword
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelPassword, "labelPassword");
|
|
||||||
// this.labelPassword.Name = "labelPassword";
|
|
||||||
// //
|
|
||||||
// // labelDefaultSchema
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelDefaultSchema, "labelDefaultSchema");
|
|
||||||
// this.labelDefaultSchema.Name = "labelDefaultSchema";
|
|
||||||
// //
|
|
||||||
// // textBoxRoleName
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.textBoxRoleName, "textBoxRoleName");
|
|
||||||
// this.textBoxRoleName.Name = "textBoxRoleName";
|
|
||||||
// this.textBoxRoleName.TextChanged += new System.EventHandler(this.textBoxRoleName_TextChanged);
|
|
||||||
// //
|
|
||||||
// // labelRoleName
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelRoleName, "labelRoleName");
|
|
||||||
// this.labelRoleName.Name = "labelRoleName";
|
|
||||||
// //
|
|
||||||
// // textBoxConfirmPassword
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.textBoxConfirmPassword, "textBoxConfirmPassword");
|
|
||||||
// this.textBoxConfirmPassword.Name = "textBoxConfirmPassword";
|
|
||||||
// this.textBoxConfirmPassword.TextChanged += new System.EventHandler(this.textBoxConfirmPassword_TextChanged);
|
|
||||||
// //
|
|
||||||
// // labelConfirmPassword
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelConfirmPassword, "labelConfirmPassword");
|
|
||||||
// this.labelConfirmPassword.Name = "labelConfirmPassword";
|
|
||||||
// //
|
|
||||||
// // panelMembership
|
|
||||||
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.panelMembership, "panelMembership");
|
|
||||||
// this.panelMembership.Controls.Add(this.labelMembersOfAppRole);
|
|
||||||
// this.panelMembership.Controls.Add(this.gridRoleMembership);
|
|
||||||
// this.panelMembership.Controls.Add(this.buttonAdd);
|
|
||||||
// this.panelMembership.Controls.Add(this.buttonRemove);
|
|
||||||
// this.panelMembership.Name = "panelMembership";
|
|
||||||
// //
|
|
||||||
// // buttonRemove
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
|
|
||||||
// this.buttonRemove.Name = "buttonRemove";
|
|
||||||
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
|
|
||||||
// //
|
|
||||||
// // buttonAdd
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
|
|
||||||
// this.buttonAdd.Name = "buttonAdd";
|
|
||||||
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
|
||||||
// //
|
|
||||||
// // gridRoleMembership
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
|
|
||||||
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
|
|
||||||
// this.gridRoleMembership.ForceEnabled = false;
|
|
||||||
// this.gridRoleMembership.Name = "gridRoleMembership";
|
|
||||||
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
|
|
||||||
// //
|
|
||||||
// // labelMembersOfAppRole
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelMembersOfAppRole, "labelMembersOfAppRole");
|
|
||||||
// this.labelMembersOfAppRole.Name = "labelMembersOfAppRole";
|
|
||||||
// //
|
|
||||||
// // panelSchema
|
|
||||||
// // Important: For narrator accessibility please make sure all Controls.Add are in order from top to bottom, left to right
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.panelSchema, "panelSchema");
|
|
||||||
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByAppRole);
|
|
||||||
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
|
|
||||||
// this.panelSchema.Name = "panelSchema";
|
|
||||||
// //
|
|
||||||
// // gridSchemasOwned
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
|
|
||||||
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
|
|
||||||
// this.gridSchemasOwned.ForceEnabled = false;
|
|
||||||
// this.gridSchemasOwned.Name = "gridSchemasOwned";
|
|
||||||
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
|
|
||||||
// //
|
|
||||||
// // labelSchemasOwnedByAppRole
|
|
||||||
// //
|
|
||||||
// resources.ApplyResources(this.labelSchemasOwnedByAppRole, "labelSchemasOwnedByAppRole");
|
|
||||||
// this.labelSchemasOwnedByAppRole.Name = "labelSchemasOwnedByAppRole";
|
|
||||||
// //
|
|
||||||
// // AppRoleGeneral
|
|
||||||
// //
|
|
||||||
// this.Controls.Add(this.panelEntireUserControl);
|
|
||||||
// this.Name = "AppRoleGeneral";
|
|
||||||
// resources.ApplyResources(this, "$this");
|
|
||||||
// this.panelEntireUserControl.ResumeLayout(false);
|
|
||||||
// this.panelGeneral.ResumeLayout(false);
|
|
||||||
// this.panelGeneral.PerformLayout();
|
|
||||||
// this.panelMembership.ResumeLayout(false);
|
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
|
|
||||||
// this.panelSchema.ResumeLayout(false);
|
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
|
|
||||||
// this.ResumeLayout(false);
|
|
||||||
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
#region Schemas - general operations with ...
|
|
||||||
HybridDictionary dictSchemas = null;
|
HybridDictionary dictSchemas = null;
|
||||||
StringCollection schemaNames = null;
|
StringCollection schemaNames = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -633,17 +374,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
Enumerator en = new Enumerator();
|
Enumerator en = new Enumerator();
|
||||||
Request req = new Request();
|
Request req = new Request();
|
||||||
req.Fields = new String[] { AppRoleGeneral.schemaNameField, AppRoleGeneral.schemaOwnerField};
|
req.Fields = new String[] { AppRoleGeneral.schemaNameField, AppRoleGeneral.schemaOwnerField };
|
||||||
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
|
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
|
||||||
req.OrderByList = new OrderBy[] { new OrderBy("Name", OrderBy.Direction.Asc)};
|
req.OrderByList = new OrderBy[] { new OrderBy("Name", OrderBy.Direction.Asc) };
|
||||||
|
|
||||||
DataTable dt = en.Process(serverConnection, req);
|
DataTable dt = en.Process(serverConnection, req);
|
||||||
// STrace.Assert((dt != null) && (dt.Rows.Count > 0), "No rows returned from schema enumerator");
|
// STrace.Assert((dt != null) && (dt.Rows.Count > 0), "No rows returned from schema enumerator");
|
||||||
|
|
||||||
foreach (DataRow dr in dt.Rows)
|
foreach (DataRow dr in dt.Rows)
|
||||||
{
|
{
|
||||||
string name = Convert.ToString(dr[AppRoleGeneral.schemaNameField],System.Globalization.CultureInfo.InvariantCulture);
|
string name = Convert.ToString(dr[AppRoleGeneral.schemaNameField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
string owner = Convert.ToString(dr[AppRoleGeneral.schemaOwnerField],System.Globalization.CultureInfo.InvariantCulture);
|
string owner = Convert.ToString(dr[AppRoleGeneral.schemaOwnerField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
dictSchemas.Add(name, owner);
|
dictSchemas.Add(name, owner);
|
||||||
schemaNames.Add(name);
|
schemaNames.Add(name);
|
||||||
@@ -651,82 +392,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// initializes the columns and headers of schema grid - but doesnt populate grid with any data
|
|
||||||
/// </summary>
|
|
||||||
// private void InitializeSchemasGridColumns()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// Microsoft.SqlServer.Management.UI.Grid.DlgGridControl grid = this.gridSchemasOwned;
|
|
||||||
|
|
||||||
// if (grid.RowsNumber != 0)
|
|
||||||
// {
|
|
||||||
// grid.DeleteAllRows();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// while (grid.ColumnsNumber != 0)
|
|
||||||
// {
|
|
||||||
// grid.DeleteColumn(0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// GridColumnInfo colInfo = null;
|
|
||||||
|
|
||||||
// // checkbox owned/not-owned
|
|
||||||
// colInfo = new GridColumnInfo();
|
|
||||||
// colInfo.ColumnWidth = sizeCheckboxColumn;
|
|
||||||
// colInfo.WidthType = GridColumnWidthType.InPixels;
|
|
||||||
// colInfo.ColumnType = GridColumnType.Checkbox;
|
|
||||||
// grid.AddColumn(colInfo);
|
|
||||||
|
|
||||||
// // schema name
|
|
||||||
// colInfo = new GridColumnInfo();
|
|
||||||
// colInfo.ColumnWidth = grid.Width - sizeCheckboxColumn - 2;
|
|
||||||
// colInfo.WidthType = GridColumnWidthType.InPixels;
|
|
||||||
// grid.AddColumn(colInfo);
|
|
||||||
|
|
||||||
// grid.SetHeaderInfo(colSchemasOwnedSchemas, AppRoleSR.HeaderOwnedSchemas, null);
|
|
||||||
|
|
||||||
// grid.SelectionType = GridSelectionType.SingleRow;
|
|
||||||
// grid.UpdateGrid();
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void FillSchemasGrid()
|
|
||||||
// {
|
|
||||||
// if (this.isYukonOrLater)
|
|
||||||
// {
|
|
||||||
// Microsoft.SqlServer.Management.UI.Grid.DlgGridControl grid = this.gridSchemasOwned;
|
|
||||||
|
|
||||||
// grid.DeleteAllRows();
|
|
||||||
// foreach (string schemaName in this.schemaNames)
|
|
||||||
// {
|
|
||||||
// GridCellCollection row = new GridCellCollection();
|
|
||||||
// GridCell cell = null;
|
|
||||||
|
|
||||||
// STrace.Assert(!string.IsNullOrWhiteSpace(schemaName), "schemaName is empty");
|
|
||||||
|
|
||||||
// string owner = this.dictSchemas[schemaName].ToString();
|
|
||||||
|
|
||||||
// STrace.Assert(!string.IsNullOrWhiteSpace(owner), "owner is empty");
|
|
||||||
|
|
||||||
// bool owned = IsPropertiesMode ? (0 == String.Compare(owner, approleName, StringComparison.Ordinal)) : false;
|
|
||||||
|
|
||||||
// // grid is filled either
|
|
||||||
// // a) disabled-checked checkboxes: Indeterminate - if already owning schema - we cannot renounce ownership
|
|
||||||
// // b) enabled-unchecked checkboxes: Unchecked - user can check / uncheck them and we read final state
|
|
||||||
// cell = new GridCell(owned ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Unchecked); row.Add(cell);
|
|
||||||
// cell = new GridCell(schemaName); row.Add(cell);
|
|
||||||
|
|
||||||
// grid.AddRow(row);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (grid.RowsNumber > 0)
|
|
||||||
// {
|
|
||||||
// grid.SelectedRow = 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// sends to server changes related to schema ownership
|
/// sends to server changes related to schema ownership
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -805,9 +470,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Membership - general operations with ...
|
#region Membership - general operations with ...
|
||||||
System.Collections.Specialized.HybridDictionary dictMembership = null;
|
System.Collections.Specialized.HybridDictionary dictMembership = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -823,20 +488,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
Enumerator en = new Enumerator();
|
Enumerator en = new Enumerator();
|
||||||
Request req = new Request();
|
Request req = new Request();
|
||||||
req.Fields = new String [] {AppRoleGeneral.memberNameField, AppRoleGeneral.memberUrnField};
|
req.Fields = new String[] { AppRoleGeneral.memberNameField, AppRoleGeneral.memberUrnField };
|
||||||
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/ApplicationRole[@Name='" + Urn.EscapeString(this.approleName) + "']/Member";
|
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/ApplicationRole[@Name='" + Urn.EscapeString(this.approleName) + "']/Member";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataTable dt = en.Process(serverConnection,req);
|
DataTable dt = en.Process(serverConnection, req);
|
||||||
System.Diagnostics.Debug.Assert(dt!=null, "No results returned from membership query");
|
System.Diagnostics.Debug.Assert(dt != null, "No results returned from membership query");
|
||||||
|
|
||||||
foreach (DataRow dr in dt.Rows)
|
foreach (DataRow dr in dt.Rows)
|
||||||
{
|
{
|
||||||
string name = Convert.ToString(dr[AppRoleGeneral.memberNameField],System.Globalization.CultureInfo.InvariantCulture);
|
string name = Convert.ToString(dr[AppRoleGeneral.memberNameField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
string urn = Convert.ToString(dr[AppRoleGeneral.memberUrnField],System.Globalization.CultureInfo.InvariantCulture);
|
string urn = Convert.ToString(dr[AppRoleGeneral.memberUrnField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
dictMembership.Add(name,urn);
|
dictMembership.Add(name, urn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -922,7 +587,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
if (IsPropertiesMode == true)
|
if (IsPropertiesMode == true)
|
||||||
{
|
{
|
||||||
// members to add
|
// members to add
|
||||||
for (int i=0; i<1; ++i)
|
for (int i = 0; i < 1; ++i)
|
||||||
{
|
{
|
||||||
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
|
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
|
||||||
bool nameExistedInitially = dictMembership.Contains(name);
|
bool nameExistedInitially = dictMembership.Contains(name);
|
||||||
@@ -944,7 +609,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// add only
|
// add only
|
||||||
for (int i=0; i<1; ++i)
|
for (int i = 0; i < 1; ++i)
|
||||||
{
|
{
|
||||||
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
|
string name = "grid.GetCellInfo(i, colMembershipRoleMembers).CellData.ToString()";
|
||||||
// need SMO for: role.Members.Add();
|
// need SMO for: role.Members.Add();
|
||||||
@@ -973,210 +638,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
// private void gridRoleMembership_SelectionChanged(object sender, Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventArgs args)
|
|
||||||
// {
|
|
||||||
// EnableDisableControls();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void buttonAdd_Click(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// DlgGridControl grid = this.gridRoleMembership;
|
|
||||||
|
|
||||||
// using (SqlObjectSearch dlg = new SqlObjectSearch(this.Font,
|
|
||||||
// iconSearchUsers,
|
|
||||||
// this.HelpProvider,
|
|
||||||
// AppRoleSR.SearchUsers,
|
|
||||||
// this.DataContainer.ConnectionInfo,
|
|
||||||
// this.databaseName,
|
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.User),
|
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.User)))
|
|
||||||
// {
|
|
||||||
// DialogResult dr = dlg.ShowDialog(this.FindForm());
|
|
||||||
// if (dr == DialogResult.OK)
|
|
||||||
// {
|
|
||||||
// foreach (SearchableObject principal in dlg.SearchResults)
|
|
||||||
// {
|
|
||||||
// grid = this.gridRoleMembership;
|
|
||||||
|
|
||||||
// GridCellCollection row = new GridCellCollection();
|
|
||||||
// GridCell cell = null;
|
|
||||||
|
|
||||||
// string name = principal.Name;
|
|
||||||
|
|
||||||
// cell = new GridCell(bitmapMember); row.Add(cell); // compute type based on urn
|
|
||||||
// cell = new GridCell(name); row.Add(cell);
|
|
||||||
|
|
||||||
// // row.Tag = urn == de.Value.ToString();
|
|
||||||
|
|
||||||
// grid.AddRow(row);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (grid.RowsNumber > 0)
|
|
||||||
// {
|
|
||||||
// grid.SelectedRow = grid.RowsNumber-1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void buttonRemove_Click(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// DlgGridControl grid = this.gridRoleMembership;
|
|
||||||
|
|
||||||
// int rowNo = grid.SelectedRow;
|
|
||||||
|
|
||||||
// System.Diagnostics.Debug.Assert(rowNo >= 0, "Invalid selected row");
|
|
||||||
// if (rowNo >= 0)
|
|
||||||
// {
|
|
||||||
// grid.DeleteRow(rowNo);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
// #region Bitmaps and Icons
|
|
||||||
// private Bitmap bitmapMember = null;
|
|
||||||
// private Icon iconSearchUsers = null;
|
|
||||||
// private Icon iconSchema = null;
|
|
||||||
// /// <summary>
|
|
||||||
// /// initialize bitmaps used for membership grid
|
|
||||||
// /// </summary>
|
|
||||||
// private void InitializeBitmapAndIcons()
|
|
||||||
// {
|
|
||||||
// CUtils utils = new CUtils();
|
|
||||||
// bitmapMember = utils.LoadIcon("member.ico").ToBitmap();
|
|
||||||
|
|
||||||
// iconSearchUsers = utils.LoadIcon("search_users_roles.ico");
|
|
||||||
// iconSchema = utils.LoadIcon("database_schema.ico");
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
|
|
||||||
// #region General Grid operations - helpers
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// gets status of checkbox
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="grid"></param>
|
|
||||||
// /// <param name="rowno"></param>
|
|
||||||
// /// <param name="colno"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// bool IsEmbeededCheckboxChecked(DlgGridControl grid, int rowno, int colno)
|
|
||||||
// {
|
|
||||||
// // get the storage for the cell
|
|
||||||
// GridCell cell = grid.GetCellInfo(rowno, colno);
|
|
||||||
// GridCheckBoxState state = (GridCheckBoxState) cell.CellData;
|
|
||||||
|
|
||||||
// return(state == GridCheckBoxState.Checked);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// flips on/off checkboxes from grid
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="rowsno"></param>
|
|
||||||
// /// <param name="colno"></param>
|
|
||||||
// void FlipCheckbox(DlgGridControl grid, int rowno, int colno)
|
|
||||||
// {
|
|
||||||
// // get the storage for the cell
|
|
||||||
// GridCell cell = grid.GetCellInfo(rowno, colno);
|
|
||||||
// GridCheckBoxState state = (GridCheckBoxState) cell.CellData;
|
|
||||||
|
|
||||||
// // explicitly invert the cell state
|
|
||||||
// switch (state)
|
|
||||||
// {
|
|
||||||
// case GridCheckBoxState.Checked:
|
|
||||||
// cell.CellData = GridCheckBoxState.Unchecked;
|
|
||||||
// break;
|
|
||||||
// case GridCheckBoxState.Unchecked:
|
|
||||||
// cell.CellData = GridCheckBoxState.Checked;
|
|
||||||
// break;
|
|
||||||
// case GridCheckBoxState.Indeterminate:
|
|
||||||
// // do nothing if Indeterminate - this means that entry is checked and r/o (e.g. schemas already owned)
|
|
||||||
// break;
|
|
||||||
|
|
||||||
// case GridCheckBoxState.None:
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// System.Diagnostics.Debug.Assert(false,"unknown checkbox state");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Non-Grid related Events
|
|
||||||
// private void textBoxRoleName_TextChanged(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// EnableDisableControls();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// bool passwordChanged = false;
|
|
||||||
// private void textBoxPasword_TextChanged(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// passwordChanged = true;
|
|
||||||
// EnableDisableControls();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void textBoxConfirmPassword_TextChanged(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// passwordChanged = true;
|
|
||||||
// EnableDisableControls();
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region ISupportValidation Members
|
|
||||||
|
|
||||||
// bool ISupportValidation.Validate()
|
|
||||||
// {
|
|
||||||
// if (this.textBoxRoleName.Text.Trim().Length == 0)
|
|
||||||
// {
|
|
||||||
// System.Exception e = new System.Exception(AppRoleSR.ErrorApplicationRoleNameMustBeSpecified);
|
|
||||||
// this.DisplayExceptionMessage(e);
|
|
||||||
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if (this.textBoxPasword.Text.Trim().Length == 0)
|
|
||||||
// {
|
|
||||||
// System.Exception e = new System.Exception(AppRoleSR.ErrorPasswordIsBlank);
|
|
||||||
// this.DisplayExceptionMessage(e);
|
|
||||||
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if (this.textBoxPasword.Text != this.textBoxConfirmPassword.Text)
|
|
||||||
// {
|
|
||||||
// System.Exception e = new System.Exception(AppRoleSR.ErrorPasswordMismatch);
|
|
||||||
// this.DisplayExceptionMessage(e);
|
|
||||||
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// private void buttonBrowseSchema_Click(object sender, System.EventArgs e)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // pop up object picker
|
|
||||||
// //
|
|
||||||
// using (SqlObjectSearch dlg = new SqlObjectSearch(this.Font,
|
|
||||||
// this.iconSchema,
|
|
||||||
// this.HelpProvider,
|
|
||||||
// AppRoleSR.BrowseSchemaTitle,
|
|
||||||
// this.DataContainer.ConnectionInfo,
|
|
||||||
// this.databaseName,
|
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.Schema),
|
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.Schema)))
|
|
||||||
// {
|
|
||||||
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
|
|
||||||
// {
|
|
||||||
// this.textBoxDefaultSchema.Text = dlg.SearchResults[0].Name;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class DatabaseRoleGeneral
|
internal class DatabaseRoleGeneral
|
||||||
{
|
{
|
||||||
#region Members
|
#region Members
|
||||||
|
|
||||||
private IServiceProvider serviceProvider = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// data container member that contains data specific information like
|
/// data container member that contains data specific information like
|
||||||
/// connection infor, SMO server object or an AMO server object as well
|
/// connection infor, SMO server object or an AMO server object as well
|
||||||
@@ -39,39 +36,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
//property by the initialization code
|
//property by the initialization code
|
||||||
private ServerConnection serverConnection;
|
private ServerConnection serverConnection;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
#region Trace support
|
||||||
/// execution mode by default for now is success
|
|
||||||
/// </summary>
|
|
||||||
private ExecutionMode m_executionMode = ExecutionMode.Success;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// should UI be enabled?
|
|
||||||
/// </summary>
|
|
||||||
private bool executeEnabled = true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// should script buttons be enabled?
|
|
||||||
/// </summary>
|
|
||||||
private bool scriptEnabled = true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// F1 keyword to be passed to books on-line
|
|
||||||
/// </summary>
|
|
||||||
private string helpF1Keyword = null;
|
|
||||||
private RunType runType;
|
|
||||||
|
|
||||||
//if derived class tries to call a protected method that relies on service provider,
|
|
||||||
//and the service provider hasn't been set yet, we will cache the values and will
|
|
||||||
//propagate them when we get the provider set
|
|
||||||
private System.Drawing.Icon cachedIcon = null;
|
|
||||||
private string cachedCaption = null;
|
|
||||||
|
|
||||||
//whether or not try to auto resize grid columns inside OnLoad method
|
|
||||||
private bool attemtGridAutoResize = true;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Trace support
|
|
||||||
private const string componentName = "DatabaseRoleGeneral";
|
private const string componentName = "DatabaseRoleGeneral";
|
||||||
|
|
||||||
public string ComponentName
|
public string ComponentName
|
||||||
@@ -81,7 +48,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
return componentName;
|
return componentName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private class SchemaOwnership
|
private class SchemaOwnership
|
||||||
{
|
{
|
||||||
@@ -114,15 +81,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Constants - urn fields, etc...
|
#region Constants - urn fields, etc...
|
||||||
private const string ownerField = "Owner";
|
private const string ownerField = "Owner";
|
||||||
private const string schemaOwnerField = "Owner";
|
private const string schemaOwnerField = "Owner";
|
||||||
private const string schemaNameField = "Name";
|
private const string schemaNameField = "Name";
|
||||||
private const string memberNameField = "Name";
|
private const string memberNameField = "Name";
|
||||||
private const string memberUrnField = "Urn";
|
private const string memberUrnField = "Urn";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constants - grid columns positions, etc...
|
#region Constants - grid columns positions, etc...
|
||||||
private const int colSchemasChecked = 0;
|
private const int colSchemasChecked = 0;
|
||||||
private const int colSchemasOwnedSchemas = 1;
|
private const int colSchemasOwnedSchemas = 1;
|
||||||
|
|
||||||
@@ -131,40 +98,39 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
private const int sizeCheckboxColumn = 20;
|
private const int sizeCheckboxColumn = 20;
|
||||||
private const int sizeBitmapColumn = 20;
|
private const int sizeBitmapColumn = 20;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Non-UI variables
|
#region Non-UI variables
|
||||||
|
|
||||||
private System.Xml.XmlDocument document = null;
|
private System.Xml.XmlDocument document = null;
|
||||||
private bool panelInitialized = false;
|
|
||||||
|
|
||||||
// info extracted from context
|
// info extracted from context
|
||||||
private string serverName;
|
private string serverName;
|
||||||
private string databaseName;
|
private string databaseName;
|
||||||
private string dbroleName;
|
private string dbroleName;
|
||||||
private string dbroleUrn;
|
private string dbroleUrn;
|
||||||
|
|
||||||
// initial values loaded from server
|
// initial values loaded from server
|
||||||
private string initialOwner;
|
private string initialOwner;
|
||||||
|
|
||||||
private string ownerName = String.Empty;
|
private string ownerName = String.Empty;
|
||||||
private string roleName = String.Empty;
|
private string roleName = String.Empty;
|
||||||
private HybridDictionary schemaOwnership = null;
|
private HybridDictionary schemaOwnership = null;
|
||||||
private HybridDictionary roleMembers = null;
|
private HybridDictionary roleMembers = null;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties: CreateNew/Properties mode
|
#region Properties: CreateNew/Properties mode
|
||||||
private bool IsPropertiesMode
|
private bool IsPropertiesMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return(dbroleName!=null) && (dbroleName.Trim().Length != 0);
|
return (dbroleName != null) && (dbroleName.Trim().Length != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors / Dispose
|
#region Constructors / Dispose
|
||||||
public DatabaseRoleGeneral()
|
public DatabaseRoleGeneral()
|
||||||
{
|
{
|
||||||
// This call is required by the Windows.Forms Form Designer.
|
// This call is required by the Windows.Forms Form Designer.
|
||||||
@@ -186,9 +152,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Implementation: LoadData(), InitProp(), SendDataToServer()
|
#region Implementation: LoadData(), InitProp(), SendDataToServer()
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -201,18 +167,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
{
|
{
|
||||||
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
|
// STrace.Params(ComponentName, "LoadData", "XmlDocument doc=\"{0}\"", doc.OuterXml);
|
||||||
|
|
||||||
STParameters param;
|
STParameters param;
|
||||||
bool bStatus;
|
bool bStatus;
|
||||||
|
|
||||||
param = new STParameters();
|
param = new STParameters();
|
||||||
|
|
||||||
param.SetDocument(doc);
|
param.SetDocument(doc);
|
||||||
|
|
||||||
bStatus = param.GetParam("servername", ref this.serverName);
|
bStatus = param.GetParam("servername", ref this.serverName);
|
||||||
bStatus = param.GetParam("database", ref this.databaseName);
|
bStatus = param.GetParam("database", ref this.databaseName);
|
||||||
|
|
||||||
bStatus = param.GetParam("role", ref this.dbroleName);
|
bStatus = param.GetParam("role", ref this.dbroleName);
|
||||||
bStatus = param.GetParam("urn", ref this.dbroleUrn);
|
bStatus = param.GetParam("urn", ref this.dbroleUrn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -225,8 +191,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
{
|
{
|
||||||
// STrace.Params(ComponentName, "InitProp", "", null);
|
// STrace.Params(ComponentName, "InitProp", "", null);
|
||||||
|
|
||||||
System.Diagnostics.Debug.Assert(this.serverName!=null);
|
System.Diagnostics.Debug.Assert(this.serverName != null);
|
||||||
System.Diagnostics.Debug.Assert((this.databaseName!=null) && (this.databaseName.Trim().Length!=0));
|
System.Diagnostics.Debug.Assert((this.databaseName != null) && (this.databaseName.Trim().Length != 0));
|
||||||
|
|
||||||
|
|
||||||
// InitializeSchemasGridColumns();
|
// InitializeSchemasGridColumns();
|
||||||
@@ -247,18 +213,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
if (this.IsPropertiesMode == true)
|
if (this.IsPropertiesMode == true)
|
||||||
{
|
{
|
||||||
// initialize from enumerator in properties mode
|
// initialize from enumerator in properties mode
|
||||||
System.Diagnostics.Debug.Assert(this.dbroleName!=null);
|
System.Diagnostics.Debug.Assert(this.dbroleName != null);
|
||||||
System.Diagnostics.Debug.Assert(this.dbroleName.Trim().Length !=0);
|
System.Diagnostics.Debug.Assert(this.dbroleName.Trim().Length != 0);
|
||||||
System.Diagnostics.Debug.Assert(this.dbroleUrn!=null);
|
System.Diagnostics.Debug.Assert(this.dbroleUrn != null);
|
||||||
System.Diagnostics.Debug.Assert(this.dbroleUrn.Trim().Length != 0);
|
System.Diagnostics.Debug.Assert(this.dbroleUrn.Trim().Length != 0);
|
||||||
|
|
||||||
// this.textBoxDbRoleName.Text = this.dbroleName;
|
// this.textBoxDbRoleName.Text = this.dbroleName;
|
||||||
|
|
||||||
Enumerator en = new Enumerator();
|
Enumerator en = new Enumerator();
|
||||||
Request req = new Request();
|
Request req = new Request();
|
||||||
req.Fields = new String [] {DatabaseRoleGeneral.ownerField};
|
req.Fields = new String[] { DatabaseRoleGeneral.ownerField };
|
||||||
|
|
||||||
if ((this.dbroleUrn!=null) && (this.dbroleUrn.Trim().Length != 0))
|
if ((this.dbroleUrn != null) && (this.dbroleUrn.Trim().Length != 0))
|
||||||
{
|
{
|
||||||
req.Urn = this.dbroleUrn;
|
req.Urn = this.dbroleUrn;
|
||||||
}
|
}
|
||||||
@@ -267,17 +233,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Role[@Name='" + Urn.EscapeString(this.dbroleName) + "]";
|
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Role[@Name='" + Urn.EscapeString(this.dbroleName) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTable dt = en.Process(serverConnection,req);
|
DataTable dt = en.Process(serverConnection, req);
|
||||||
System.Diagnostics.Debug.Assert(dt!=null);
|
System.Diagnostics.Debug.Assert(dt != null);
|
||||||
System.Diagnostics.Debug.Assert(dt.Rows.Count==1);
|
System.Diagnostics.Debug.Assert(dt.Rows.Count == 1);
|
||||||
|
|
||||||
if (dt.Rows.Count==0)
|
if (dt.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
throw new Exception("DatabaseRoleSR.ErrorDbRoleNotFound");
|
throw new Exception("DatabaseRoleSR.ErrorDbRoleNotFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
DataRow dr = dt.Rows[0];
|
DataRow dr = dt.Rows[0];
|
||||||
this.initialOwner = Convert.ToString(dr[DatabaseRoleGeneral.ownerField],System.Globalization.CultureInfo.InvariantCulture);
|
this.initialOwner = Convert.ToString(dr[DatabaseRoleGeneral.ownerField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
// this.textBoxOwner.Text = this.initialOwner;
|
// this.textBoxOwner.Text = this.initialOwner;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -344,206 +310,206 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
SendToServerSchemaOwnershipChanges(database, role);
|
SendToServerSchemaOwnershipChanges(database, role);
|
||||||
SendToServerMembershipChanges(database, role);
|
SendToServerMembershipChanges(database, role);
|
||||||
|
|
||||||
this.dataContainer.ObjectName = role.Name;
|
this.dataContainer.ObjectName = role.Name;
|
||||||
this.dataContainer.SqlDialogSubject = role; // needed by extended properties page
|
this.dataContainer.SqlDialogSubject = role; // needed by extended properties page
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// #region Update UI enable/disable controls
|
// #region Update UI enable/disable controls
|
||||||
// private void EnableDisableControls()
|
// private void EnableDisableControls()
|
||||||
// {
|
// {
|
||||||
// if (this.DataContainer.Server.Information.Version.Major<9)
|
// if (this.DataContainer.Server.Information.Version.Major<9)
|
||||||
// {
|
// {
|
||||||
// panelSchema.Enabled = false;
|
// panelSchema.Enabled = false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (this.IsPropertiesMode == true)
|
// if (this.IsPropertiesMode == true)
|
||||||
// {
|
// {
|
||||||
// this.textBoxDbRoleName.Enabled = false;
|
// this.textBoxDbRoleName.Enabled = false;
|
||||||
|
|
||||||
// this.AllUIEnabled = true;
|
// this.AllUIEnabled = true;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// this.textBoxDbRoleName.Enabled = true;
|
// this.textBoxDbRoleName.Enabled = true;
|
||||||
|
|
||||||
// this.AllUIEnabled = (this.textBoxDbRoleName.Text.Trim().Length!=0);
|
// this.AllUIEnabled = (this.textBoxDbRoleName.Text.Trim().Length!=0);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
|
// buttonRemove.Enabled = (gridRoleMembership.SelectedRow>=0);
|
||||||
// }
|
// }
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region ISupportValidation Members
|
// #region ISupportValidation Members
|
||||||
|
|
||||||
// bool ISupportValidation.Validate()
|
// bool ISupportValidation.Validate()
|
||||||
// {
|
// {
|
||||||
// if (IsPropertiesMode == false)
|
// if (IsPropertiesMode == false)
|
||||||
// {
|
// {
|
||||||
// if (this.textBoxDbRoleName.Text.Trim().Length==0)
|
// if (this.textBoxDbRoleName.Text.Trim().Length==0)
|
||||||
// {
|
// {
|
||||||
// System.Exception e = new System.Exception(DatabaseRoleSR.Error_SpecifyAName);
|
// System.Exception e = new System.Exception(DatabaseRoleSR.Error_SpecifyAName);
|
||||||
// this.DisplayExceptionMessage(e);
|
// this.DisplayExceptionMessage(e);
|
||||||
|
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Component Designer generated code
|
// #region Component Designer generated code
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Required method for Designer support - do not modify
|
// /// Required method for Designer support - do not modify
|
||||||
// /// the contents of this method with the code editor.
|
// /// the contents of this method with the code editor.
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
// private void InitializeComponent()
|
// private void InitializeComponent()
|
||||||
// {
|
// {
|
||||||
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatabaseRoleGeneral));
|
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatabaseRoleGeneral));
|
||||||
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
|
// this.panelEntireUserControl = new System.Windows.Forms.Panel();
|
||||||
// this.panelSchema = new System.Windows.Forms.Panel();
|
// this.panelSchema = new System.Windows.Forms.Panel();
|
||||||
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
// this.gridSchemasOwned = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
||||||
// this.labelSchemasOwnedByDbRole = new System.Windows.Forms.Label();
|
// this.labelSchemasOwnedByDbRole = new System.Windows.Forms.Label();
|
||||||
// this.panelMembership = new System.Windows.Forms.Panel();
|
// this.panelMembership = new System.Windows.Forms.Panel();
|
||||||
// this.buttonRemove = new System.Windows.Forms.Button();
|
// this.buttonRemove = new System.Windows.Forms.Button();
|
||||||
// this.buttonAdd = new System.Windows.Forms.Button();
|
// this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
// this.gridRoleMembership = new Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid();
|
||||||
// this.labelMembersOfDbRole = new System.Windows.Forms.Label();
|
// this.labelMembersOfDbRole = new System.Windows.Forms.Label();
|
||||||
// this.panelDbRoleGeneralInfo = new System.Windows.Forms.Panel();
|
// this.panelDbRoleGeneralInfo = new System.Windows.Forms.Panel();
|
||||||
// this.buttonSearchOwner = new System.Windows.Forms.Button();
|
// this.buttonSearchOwner = new System.Windows.Forms.Button();
|
||||||
// this.textBoxOwner = new System.Windows.Forms.TextBox();
|
// this.textBoxOwner = new System.Windows.Forms.TextBox();
|
||||||
// this.labelDbRoleOwner = new System.Windows.Forms.Label();
|
// this.labelDbRoleOwner = new System.Windows.Forms.Label();
|
||||||
// this.textBoxDbRoleName = new System.Windows.Forms.TextBox();
|
// this.textBoxDbRoleName = new System.Windows.Forms.TextBox();
|
||||||
// this.labelDbRoleName = new System.Windows.Forms.Label();
|
// this.labelDbRoleName = new System.Windows.Forms.Label();
|
||||||
// this.panelEntireUserControl.SuspendLayout();
|
// this.panelEntireUserControl.SuspendLayout();
|
||||||
// this.panelSchema.SuspendLayout();
|
// this.panelSchema.SuspendLayout();
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
|
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).BeginInit();
|
||||||
// this.panelMembership.SuspendLayout();
|
// this.panelMembership.SuspendLayout();
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
|
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).BeginInit();
|
||||||
// this.panelDbRoleGeneralInfo.SuspendLayout();
|
// this.panelDbRoleGeneralInfo.SuspendLayout();
|
||||||
// this.SuspendLayout();
|
// this.SuspendLayout();
|
||||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
// //
|
// //
|
||||||
// // panelEntireUserControl
|
// // panelEntireUserControl
|
||||||
// //
|
// //
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
|
// this.panelEntireUserControl.Controls.Add(this.panelSchema);
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
|
// this.panelEntireUserControl.Controls.Add(this.panelMembership);
|
||||||
// this.panelEntireUserControl.Controls.Add(this.panelDbRoleGeneralInfo);
|
// this.panelEntireUserControl.Controls.Add(this.panelDbRoleGeneralInfo);
|
||||||
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
|
// resources.ApplyResources(this.panelEntireUserControl, "panelEntireUserControl");
|
||||||
// this.panelEntireUserControl.Name = "panelEntireUserControl";
|
// this.panelEntireUserControl.Name = "panelEntireUserControl";
|
||||||
// //
|
// //
|
||||||
// // panelSchema
|
// // panelSchema
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.panelSchema, "panelSchema");
|
// resources.ApplyResources(this.panelSchema, "panelSchema");
|
||||||
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
|
// this.panelSchema.Controls.Add(this.gridSchemasOwned);
|
||||||
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByDbRole);
|
// this.panelSchema.Controls.Add(this.labelSchemasOwnedByDbRole);
|
||||||
// this.panelSchema.Name = "panelSchema";
|
// this.panelSchema.Name = "panelSchema";
|
||||||
// //
|
// //
|
||||||
// // gridSchemasOwned
|
// // gridSchemasOwned
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
|
// resources.ApplyResources(this.gridSchemasOwned, "gridSchemasOwned");
|
||||||
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
|
// this.gridSchemasOwned.BackColor = System.Drawing.SystemColors.Window;
|
||||||
// this.gridSchemasOwned.ForceEnabled = false;
|
// this.gridSchemasOwned.ForceEnabled = false;
|
||||||
// this.gridSchemasOwned.Name = "gridSchemasOwned";
|
// this.gridSchemasOwned.Name = "gridSchemasOwned";
|
||||||
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
|
// this.gridSchemasOwned.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.gridSchemasOwned_MouseButtonClicked);
|
||||||
// //
|
// //
|
||||||
// // labelSchemasOwnedByDbRole
|
// // labelSchemasOwnedByDbRole
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.labelSchemasOwnedByDbRole, "labelSchemasOwnedByDbRole");
|
// resources.ApplyResources(this.labelSchemasOwnedByDbRole, "labelSchemasOwnedByDbRole");
|
||||||
// this.labelSchemasOwnedByDbRole.Name = "labelSchemasOwnedByDbRole";
|
// this.labelSchemasOwnedByDbRole.Name = "labelSchemasOwnedByDbRole";
|
||||||
// //
|
// //
|
||||||
// // panelMembership
|
// // panelMembership
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.panelMembership, "panelMembership");
|
// resources.ApplyResources(this.panelMembership, "panelMembership");
|
||||||
// this.panelMembership.Controls.Add(this.buttonRemove);
|
// this.panelMembership.Controls.Add(this.buttonRemove);
|
||||||
// this.panelMembership.Controls.Add(this.buttonAdd);
|
// this.panelMembership.Controls.Add(this.buttonAdd);
|
||||||
// this.panelMembership.Controls.Add(this.gridRoleMembership);
|
// this.panelMembership.Controls.Add(this.gridRoleMembership);
|
||||||
// this.panelMembership.Controls.Add(this.labelMembersOfDbRole);
|
// this.panelMembership.Controls.Add(this.labelMembersOfDbRole);
|
||||||
// this.panelMembership.Name = "panelMembership";
|
// this.panelMembership.Name = "panelMembership";
|
||||||
// //
|
// //
|
||||||
// // buttonRemove
|
// // buttonRemove
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
|
// resources.ApplyResources(this.buttonRemove, "buttonRemove");
|
||||||
// this.buttonRemove.Name = "buttonRemove";
|
// this.buttonRemove.Name = "buttonRemove";
|
||||||
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
|
// this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
|
||||||
// //
|
// //
|
||||||
// // buttonAdd
|
// // buttonAdd
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
|
// resources.ApplyResources(this.buttonAdd, "buttonAdd");
|
||||||
// this.buttonAdd.Name = "buttonAdd";
|
// this.buttonAdd.Name = "buttonAdd";
|
||||||
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
// this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||||
// //
|
// //
|
||||||
// // gridRoleMembership
|
// // gridRoleMembership
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
|
// resources.ApplyResources(this.gridRoleMembership, "gridRoleMembership");
|
||||||
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
|
// this.gridRoleMembership.BackColor = System.Drawing.SystemColors.Window;
|
||||||
// this.gridRoleMembership.ForceEnabled = false;
|
// this.gridRoleMembership.ForceEnabled = false;
|
||||||
// this.gridRoleMembership.Name = "gridRoleMembership";
|
// this.gridRoleMembership.Name = "gridRoleMembership";
|
||||||
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
|
// this.gridRoleMembership.SelectionChanged += new Microsoft.SqlServer.Management.UI.Grid.SelectionChangedEventHandler(this.gridRoleMembership_SelectionChanged);
|
||||||
// //
|
// //
|
||||||
// // labelMembersOfDbRole
|
// // labelMembersOfDbRole
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.labelMembersOfDbRole, "labelMembersOfDbRole");
|
// resources.ApplyResources(this.labelMembersOfDbRole, "labelMembersOfDbRole");
|
||||||
// this.labelMembersOfDbRole.Name = "labelMembersOfDbRole";
|
// this.labelMembersOfDbRole.Name = "labelMembersOfDbRole";
|
||||||
// //
|
// //
|
||||||
// // panelDbRoleGeneralInfo
|
// // panelDbRoleGeneralInfo
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.panelDbRoleGeneralInfo, "panelDbRoleGeneralInfo");
|
// resources.ApplyResources(this.panelDbRoleGeneralInfo, "panelDbRoleGeneralInfo");
|
||||||
// this.panelDbRoleGeneralInfo.Controls.Add(this.buttonSearchOwner);
|
// this.panelDbRoleGeneralInfo.Controls.Add(this.buttonSearchOwner);
|
||||||
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxOwner);
|
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxOwner);
|
||||||
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleOwner);
|
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleOwner);
|
||||||
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxDbRoleName);
|
// this.panelDbRoleGeneralInfo.Controls.Add(this.textBoxDbRoleName);
|
||||||
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleName);
|
// this.panelDbRoleGeneralInfo.Controls.Add(this.labelDbRoleName);
|
||||||
// this.panelDbRoleGeneralInfo.Name = "panelDbRoleGeneralInfo";
|
// this.panelDbRoleGeneralInfo.Name = "panelDbRoleGeneralInfo";
|
||||||
// //
|
// //
|
||||||
// // buttonSearchOwner
|
// // buttonSearchOwner
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.buttonSearchOwner, "buttonSearchOwner");
|
// resources.ApplyResources(this.buttonSearchOwner, "buttonSearchOwner");
|
||||||
// this.buttonSearchOwner.Name = "buttonSearchOwner";
|
// this.buttonSearchOwner.Name = "buttonSearchOwner";
|
||||||
// this.buttonSearchOwner.Click += new System.EventHandler(this.buttonSearchOwner_Click);
|
// this.buttonSearchOwner.Click += new System.EventHandler(this.buttonSearchOwner_Click);
|
||||||
// //
|
// //
|
||||||
// // textBoxOwner
|
// // textBoxOwner
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.textBoxOwner, "textBoxOwner");
|
// resources.ApplyResources(this.textBoxOwner, "textBoxOwner");
|
||||||
// this.textBoxOwner.Name = "textBoxOwner";
|
// this.textBoxOwner.Name = "textBoxOwner";
|
||||||
// //
|
// //
|
||||||
// // labelDbRoleOwner
|
// // labelDbRoleOwner
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.labelDbRoleOwner, "labelDbRoleOwner");
|
// resources.ApplyResources(this.labelDbRoleOwner, "labelDbRoleOwner");
|
||||||
// this.labelDbRoleOwner.Name = "labelDbRoleOwner";
|
// this.labelDbRoleOwner.Name = "labelDbRoleOwner";
|
||||||
// //
|
// //
|
||||||
// // textBoxDbRoleName
|
// // textBoxDbRoleName
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.textBoxDbRoleName, "textBoxDbRoleName");
|
// resources.ApplyResources(this.textBoxDbRoleName, "textBoxDbRoleName");
|
||||||
// this.textBoxDbRoleName.Name = "textBoxDbRoleName";
|
// this.textBoxDbRoleName.Name = "textBoxDbRoleName";
|
||||||
// //
|
// //
|
||||||
// // labelDbRoleName
|
// // labelDbRoleName
|
||||||
// //
|
// //
|
||||||
// resources.ApplyResources(this.labelDbRoleName, "labelDbRoleName");
|
// resources.ApplyResources(this.labelDbRoleName, "labelDbRoleName");
|
||||||
// this.labelDbRoleName.Name = "labelDbRoleName";
|
// this.labelDbRoleName.Name = "labelDbRoleName";
|
||||||
// //
|
// //
|
||||||
// // DatabaseRoleGeneral
|
// // DatabaseRoleGeneral
|
||||||
// //
|
// //
|
||||||
// this.Controls.Add(this.panelEntireUserControl);
|
// this.Controls.Add(this.panelEntireUserControl);
|
||||||
// this.Name = "DatabaseRoleGeneral";
|
// this.Name = "DatabaseRoleGeneral";
|
||||||
// resources.ApplyResources(this, "$this");
|
// resources.ApplyResources(this, "$this");
|
||||||
// this.panelEntireUserControl.ResumeLayout(false);
|
// this.panelEntireUserControl.ResumeLayout(false);
|
||||||
// this.panelSchema.ResumeLayout(false);
|
// this.panelSchema.ResumeLayout(false);
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
|
// ((System.ComponentModel.ISupportInitialize)(this.gridSchemasOwned)).EndInit();
|
||||||
// this.panelMembership.ResumeLayout(false);
|
// this.panelMembership.ResumeLayout(false);
|
||||||
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
|
// ((System.ComponentModel.ISupportInitialize)(this.gridRoleMembership)).EndInit();
|
||||||
// this.panelDbRoleGeneralInfo.ResumeLayout(false);
|
// this.panelDbRoleGeneralInfo.ResumeLayout(false);
|
||||||
// this.panelDbRoleGeneralInfo.PerformLayout();
|
// this.panelDbRoleGeneralInfo.PerformLayout();
|
||||||
// this.ResumeLayout(false);
|
// this.ResumeLayout(false);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
#region Schemas - general operations with ...
|
#region Schemas - general operations with ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// loads initial schemas from server together with information about the schema owner
|
/// loads initial schemas from server together with information about the schema owner
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -553,18 +519,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
Enumerator en = new Enumerator();
|
Enumerator en = new Enumerator();
|
||||||
Request req = new Request();
|
Request req = new Request();
|
||||||
req.Fields = new String [] {DatabaseRoleGeneral.schemaNameField, DatabaseRoleGeneral.schemaOwnerField};
|
req.Fields = new String[] { DatabaseRoleGeneral.schemaNameField, DatabaseRoleGeneral.schemaOwnerField };
|
||||||
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
|
req.Urn = "Server/Database[@Name='" + Urn.EscapeString(this.databaseName) + "']/Schema";
|
||||||
|
|
||||||
DataTable dt = en.Process(serverConnection,req);
|
DataTable dt = en.Process(serverConnection, req);
|
||||||
// STrace.Assert((dt != null) && (0 < dt.Rows.Count), "enumerator did not return schemas");
|
// STrace.Assert((dt != null) && (0 < dt.Rows.Count), "enumerator did not return schemas");
|
||||||
// STrace.Assert(!this.IsPropertiesMode || (this.dbroleName.Length != 0), "role name is not known");
|
// STrace.Assert(!this.IsPropertiesMode || (this.dbroleName.Length != 0), "role name is not known");
|
||||||
|
|
||||||
foreach (DataRow dr in dt.Rows)
|
foreach (DataRow dr in dt.Rows)
|
||||||
{
|
{
|
||||||
string schemaName = Convert.ToString(dr[DatabaseRoleGeneral.schemaNameField],System.Globalization.CultureInfo.InvariantCulture);
|
string schemaName = Convert.ToString(dr[DatabaseRoleGeneral.schemaNameField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
string schemaOwner = Convert.ToString(dr[DatabaseRoleGeneral.schemaOwnerField],System.Globalization.CultureInfo.InvariantCulture);
|
string schemaOwner = Convert.ToString(dr[DatabaseRoleGeneral.schemaOwnerField], System.Globalization.CultureInfo.InvariantCulture);
|
||||||
bool roleOwnsSchema =
|
bool roleOwnsSchema =
|
||||||
this.IsPropertiesMode &&
|
this.IsPropertiesMode &&
|
||||||
(0 == String.Compare(this.dbroleName, schemaOwner, StringComparison.Ordinal));
|
(0 == String.Compare(this.dbroleName, schemaOwner, StringComparison.Ordinal));
|
||||||
|
|
||||||
@@ -661,9 +627,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
enumerator.Reset();
|
enumerator.Reset();
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
DictionaryEntry de = enumerator.Entry;
|
DictionaryEntry de = enumerator.Entry;
|
||||||
string schemaName = de.Key.ToString();
|
string schemaName = de.Key.ToString();
|
||||||
SchemaOwnership ownership = (SchemaOwnership)de.Value;
|
SchemaOwnership ownership = (SchemaOwnership)de.Value;
|
||||||
|
|
||||||
// If we are creating a new role, then no schema will have been initially owned by this role.
|
// If we are creating a new role, then no schema will have been initially owned by this role.
|
||||||
// If we are modifying an existing role, we can only take ownership of roles. (Ownership can't
|
// If we are modifying an existing role, we can only take ownership of roles. (Ownership can't
|
||||||
@@ -692,9 +658,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Membership - general operations with ...
|
#region Membership - general operations with ...
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// loads from server initial membership information
|
/// loads from server initial membership information
|
||||||
@@ -705,15 +671,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
if (this.IsPropertiesMode)
|
if (this.IsPropertiesMode)
|
||||||
{
|
{
|
||||||
Enumerator enumerator = new Enumerator();
|
Enumerator enumerator = new Enumerator();
|
||||||
Urn urn = String.Format(System.Globalization.CultureInfo.InvariantCulture,
|
Urn urn = String.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||||
"Server/Database[@Name='{0}']/Role[@Name='{1}']/Member",
|
"Server/Database[@Name='{0}']/Role[@Name='{1}']/Member",
|
||||||
Urn.EscapeString(this.databaseName),
|
Urn.EscapeString(this.databaseName),
|
||||||
Urn.EscapeString(this.dbroleName));
|
Urn.EscapeString(this.dbroleName));
|
||||||
string[] fields = new string[] { DatabaseRoleGeneral.memberNameField};
|
string[] fields = new string[] { DatabaseRoleGeneral.memberNameField };
|
||||||
OrderBy[] orderBy = new OrderBy[] { new OrderBy(DatabaseRoleGeneral.memberNameField, OrderBy.Direction.Asc)};
|
OrderBy[] orderBy = new OrderBy[] { new OrderBy(DatabaseRoleGeneral.memberNameField, OrderBy.Direction.Asc) };
|
||||||
Request request = new Request(urn, fields, orderBy);
|
Request request = new Request(urn, fields, orderBy);
|
||||||
DataTable dt = enumerator.Process(this.serverConnection, request);
|
DataTable dt = enumerator.Process(this.serverConnection, request);
|
||||||
|
|
||||||
foreach (DataRow dr in dt.Rows)
|
foreach (DataRow dr in dt.Rows)
|
||||||
{
|
{
|
||||||
@@ -812,9 +778,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
|
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
DictionaryEntry entry = enumerator.Entry;
|
DictionaryEntry entry = enumerator.Entry;
|
||||||
string memberName = entry.Key.ToString();
|
string memberName = entry.Key.ToString();
|
||||||
RoleMembership membership = (RoleMembership) entry.Value;
|
RoleMembership membership = (RoleMembership)entry.Value;
|
||||||
|
|
||||||
if (!membership.initiallyAMember && membership.currentlyAMember)
|
if (!membership.initiallyAMember && membership.currentlyAMember)
|
||||||
{
|
{
|
||||||
@@ -832,94 +798,94 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
|||||||
// EnableDisableControls();
|
// EnableDisableControls();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// private void buttonAdd_Click(object sender, System.EventArgs e)
|
// private void buttonAdd_Click(object sender, System.EventArgs e)
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// using (SqlObjectSearch dlg = new SqlObjectSearch(
|
// using (SqlObjectSearch dlg = new SqlObjectSearch(
|
||||||
// this.Font,
|
// this.Font,
|
||||||
// iconSearchRolesAndUsers,
|
// iconSearchRolesAndUsers,
|
||||||
// this.HelpProvider,
|
// this.HelpProvider,
|
||||||
// DatabaseRoleSR.Add_DialogTitle,
|
// DatabaseRoleSR.Add_DialogTitle,
|
||||||
// this.DataContainer.ConnectionInfo,
|
// this.DataContainer.ConnectionInfo,
|
||||||
// this.databaseName,
|
// this.databaseName,
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
|
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
|
||||||
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
|
// new SearchableObjectTypeCollection(SearchableObjectType.User, SearchableObjectType.DatabaseRole),
|
||||||
// false))
|
// false))
|
||||||
// {
|
// {
|
||||||
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
|
// if (DialogResult.OK == dlg.ShowDialog(this.FindForm()))
|
||||||
// {
|
// {
|
||||||
// bool memberAdded = false;
|
// bool memberAdded = false;
|
||||||
|
|
||||||
// this.gridRoleMembership.BeginInit();
|
// this.gridRoleMembership.BeginInit();
|
||||||
|
|
||||||
// foreach (SearchableObject principal in dlg.SearchResults)
|
// foreach (SearchableObject principal in dlg.SearchResults)
|
||||||
// {
|
// {
|
||||||
// if (!this.roleMembers.Contains(principal.Name))
|
// if (!this.roleMembers.Contains(principal.Name))
|
||||||
// {
|
// {
|
||||||
// this.roleMembers[principal.Name] = new RoleMembership(false, true);
|
// this.roleMembers[principal.Name] = new RoleMembership(false, true);
|
||||||
// memberAdded = true;
|
// memberAdded = true;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// RoleMembership membership = (RoleMembership) this.roleMembers[principal.Name];
|
// RoleMembership membership = (RoleMembership) this.roleMembers[principal.Name];
|
||||||
|
|
||||||
// if (!membership.currentlyAMember)
|
// if (!membership.currentlyAMember)
|
||||||
// {
|
// {
|
||||||
// membership.currentlyAMember = true;
|
// membership.currentlyAMember = true;
|
||||||
// memberAdded = true;
|
// memberAdded = true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (memberAdded)
|
// if (memberAdded)
|
||||||
// {
|
// {
|
||||||
// GridCellCollection row = new GridCellCollection();
|
// GridCellCollection row = new GridCellCollection();
|
||||||
// GridCell cell = null;
|
// GridCell cell = null;
|
||||||
|
|
||||||
// cell = new GridCell(bitmapMember);
|
// cell = new GridCell(bitmapMember);
|
||||||
// row.Add(cell);
|
// row.Add(cell);
|
||||||
|
|
||||||
// cell = new GridCell(principal.Name);
|
// cell = new GridCell(principal.Name);
|
||||||
// row.Add(cell);
|
// row.Add(cell);
|
||||||
|
|
||||||
// this.gridRoleMembership.AddRow(row);
|
// this.gridRoleMembership.AddRow(row);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// this.gridRoleMembership.EndInit();
|
// this.gridRoleMembership.EndInit();
|
||||||
|
|
||||||
// if (memberAdded)
|
// if (memberAdded)
|
||||||
// {
|
// {
|
||||||
// this.gridRoleMembership.SelectedRow = this.gridRoleMembership.RowsNumber - 1;
|
// this.gridRoleMembership.SelectedRow = this.gridRoleMembership.RowsNumber - 1;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// private void buttonRemove_Click(object sender, System.EventArgs e)
|
// private void buttonRemove_Click(object sender, System.EventArgs e)
|
||||||
// {
|
// {
|
||||||
// DlgGridControl grid = this.gridRoleMembership;
|
// DlgGridControl grid = this.gridRoleMembership;
|
||||||
|
|
||||||
// int row = this.gridRoleMembership.SelectedRow;
|
// int row = this.gridRoleMembership.SelectedRow;
|
||||||
// STrace.Assert(0 <= row, "unexpected row number");
|
// STrace.Assert(0 <= row, "unexpected row number");
|
||||||
|
|
||||||
// if (0 <= row)
|
// if (0 <= row)
|
||||||
// {
|
// {
|
||||||
// string memberName = this.gridRoleMembership.GetCellInfo(row, colMembershipRoleMembers).CellData.ToString();
|
// string memberName = this.gridRoleMembership.GetCellInfo(row, colMembershipRoleMembers).CellData.ToString();
|
||||||
// RoleMembership membership = (RoleMembership) this.roleMembers[memberName];
|
// RoleMembership membership = (RoleMembership) this.roleMembers[memberName];
|
||||||
|
|
||||||
// if (membership.initiallyAMember)
|
// if (membership.initiallyAMember)
|
||||||
// {
|
// {
|
||||||
// membership.currentlyAMember = false;
|
// membership.currentlyAMember = false;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// this.roleMembers.Remove(memberName);
|
// this.roleMembers.Remove(memberName);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// this.gridRoleMembership.DeleteRow(row);
|
// this.gridRoleMembership.DeleteRow(row);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user