1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

* Added support for authenticator small names

* Updated version to 1.1.1
* Several minor bugs fixed (potentially bugs)
This commit is contained in:
Adolfo Gómez 2013-02-27 12:16:08 +00:00
parent eedef4aa11
commit 510c69e6fc
10 changed files with 151 additions and 30 deletions

View File

@ -33,6 +33,6 @@ using System.Resources;
// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión
// mediante el asterisco ('*'), como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View File

@ -843,6 +843,15 @@ namespace UdsAdmin {
}
}
/// <summary>
/// Busca una cadena traducida similar a An small name with at most 8 chars and using A-Z,a-z,0-9 -_ chars is required.
/// </summary>
internal static string smallNameRequired {
get {
return ResourceManager.GetString("smallNameRequired", resourceCulture);
}
}
/// <summary>
/// Busca una cadena traducida similar a Src Host.
/// </summary>

View File

@ -510,4 +510,7 @@
<data name="legend" xml:space="preserve">
<value>Legend</value>
</data>
<data name="smallNameRequired" xml:space="preserve">
<value>An small name with at most 8 chars and using A-Z,a-z,0-9 -_ chars is required</value>
</data>
</root>

View File

@ -33,12 +33,14 @@
this.dataPanel = new System.Windows.Forms.TableLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comments = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.name = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.priority = new System.Windows.Forms.NumericUpDown();
this.smallName = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.accept = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
@ -74,14 +76,21 @@
// tableLayoutPanel2
//
resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2");
this.tableLayoutPanel2.Controls.Add(this.label4, 0, 3);
this.tableLayoutPanel2.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel2.Controls.Add(this.comments, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.name, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.priority, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.smallName, 1, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
@ -127,6 +136,11 @@
0,
0});
//
// smallName
//
resources.ApplyResources(this.smallName, "smallName");
this.smallName.Name = "smallName";
//
// tableLayoutPanel1
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
@ -202,6 +216,8 @@
private System.Windows.Forms.Button test;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown priority;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox smallName;
}
}

View File

@ -45,6 +45,7 @@ namespace UdsAdmin.forms
xmlrpc.GuiFieldValue[] _fldValues;
string _authenticatorName;
string _authenticatorType;
System.Text.RegularExpressions.Regex smallNameRe;
public AuthenticatorForm(string providerName, string providerType, Icon icon)
{
@ -56,12 +57,14 @@ namespace UdsAdmin.forms
_authenticatorType = providerType;
Icon = icon;
Text = Strings.titleAuthenticator;
smallNameRe = new System.Text.RegularExpressions.Regex("^[A-Za-z0-9_:.-]+$");
}
public void setData(string name, string comments, string id, xmlrpc.GuiFieldValue[] data)
public void setData(string name, string comments, string id, string smallName, xmlrpc.GuiFieldValue[] data)
{
this.name.Text = name;
this.comments.Text = comments;
this.smallName.Text = smallName;
this._id = id;
this.priority.Value = Convert.ToInt32(xmlrpc.GuiFieldValue.getData(data, "priority"));
_fldValues = data;
@ -71,6 +74,8 @@ namespace UdsAdmin.forms
{
_flds = xmlrpc.UdsAdminService.GetAuthenticatorGui(_authenticatorType);
Size sz = gui.DinamycFieldsManager.PutFields(dataPanel, _flds, _fldValues);
if (sz.Width < groupData.Size.Width)
sz.Width = groupData.Size.Width;
groupData.Size = new Size(sz.Width, 32 + sz.Height);
Size wSize = new Size();
wSize.Width = Size.Width;
@ -95,6 +100,22 @@ namespace UdsAdmin.forms
gui.UserNotifier.notifyError(Strings.nameRequired);
return;
}
if (smallName.Text.Trim().Length == 0)
{
Random rnd = new Random();
string str = "";
for (int i = 0; i < 8; i++)
str += (char)('A' + rnd.Next(0, 26));
smallName.Text = str;
}
if (smallNameRe.IsMatch(smallName.Text) == false)
{
gui.UserNotifier.notifyError(Strings.smallNameRequired);
return;
}
xmlrpc.GuiFieldValue[] data;
try {
data = gui.DinamycFieldsManager.ReadFields(dataPanel, _flds);
@ -107,10 +128,10 @@ namespace UdsAdmin.forms
try {
if (_id == null)
xmlrpc.UdsAdminService.CreateAuthenticator(name.Text, comments.Text, _authenticatorType, Convert.ToInt32(priority.Value), data);
xmlrpc.UdsAdminService.CreateAuthenticator(name.Text, comments.Text, _authenticatorType, Convert.ToInt32(priority.Value), smallName.Text, data);
else
{
xmlrpc.UdsAdminService.ModifyAuthenticator(name.Text, comments.Text, Convert.ToInt32(priority.Value), _id, data);
xmlrpc.UdsAdminService.ModifyAuthenticator(name.Text, comments.Text, Convert.ToInt32(priority.Value), _id, smallName.Text, data);
}
DialogResult = System.Windows.Forms.DialogResult.OK;
}

View File

@ -130,13 +130,13 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="dataPanel.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 16</value>
<value>8, 21</value>
</data>
<data name="dataPanel.RowCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="dataPanel.Size" type="System.Drawing.Size, System.Drawing">
<value>443, 157</value>
<value>433, 120</value>
</data>
<data name="dataPanel.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -157,10 +157,13 @@
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls /&gt;&lt;Columns Styles="Percent,50,Percent,50" /&gt;&lt;Rows Styles="Percent,50,Percent,50" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="groupData.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 125</value>
<value>12, 152</value>
</data>
<data name="groupData.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>8, 8, 8, 8</value>
</data>
<data name="groupData.Size" type="System.Drawing.Size, System.Drawing">
<value>449, 176</value>
<value>449, 149</value>
</data>
<data name="groupData.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
@ -186,6 +189,39 @@
<data name="tableLayoutPanel2.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="label4.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 92</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Small Name</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
@ -196,7 +232,7 @@
<value>NoControl</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 57</value>
<value>3, 63</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>38, 13</value>
@ -217,10 +253,10 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="comments.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 28</value>
<value>82, 31</value>
</data>
<data name="comments.Size" type="System.Drawing.Size, System.Drawing">
<value>320, 20</value>
@ -238,7 +274,7 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;comments.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="label2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
@ -247,7 +283,7 @@
<value>True</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 31</value>
<value>3, 35</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@ -268,7 +304,7 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="name.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 3</value>
@ -289,7 +325,7 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;name.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="label1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
@ -298,7 +334,7 @@
<value>True</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 6</value>
<value>3, 7</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>35, 13</value>
@ -319,10 +355,10 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<data name="priority.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 53</value>
<value>82, 59</value>
</data>
<data name="priority.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 20</value>
@ -340,16 +376,40 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;priority.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="smallName.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 87</value>
</data>
<data name="smallName.MaxLength" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="smallName.Size" type="System.Drawing.Size, System.Drawing">
<value>132, 20</value>
</data>
<data name="smallName.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;smallName.Name" xml:space="preserve">
<value>smallName</value>
</data>
<data name="&gt;&gt;smallName.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;smallName.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;smallName.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="tableLayoutPanel2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 19</value>
</data>
<data name="tableLayoutPanel2.RowCount" type="System.Int32, mscorlib">
<value>3</value>
<value>4</value>
</data>
<data name="tableLayoutPanel2.Size" type="System.Drawing.Size, System.Drawing">
<value>414, 77</value>
<value>414, 114</value>
</data>
<data name="tableLayoutPanel2.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -367,13 +427,13 @@
<value>0</value>
</data>
<data name="tableLayoutPanel2.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="label3" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="comments" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="name" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="priority" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,19,29825,Percent,80,70175" /&gt;&lt;Rows Styles="Percent,33,Percent,33,Percent,34" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="label4" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="label3" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="comments" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="name" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="priority" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="smallName" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,19,29825,Percent,80,70175" /&gt;&lt;Rows Styles="Percent,25,Percent,25,Percent,25,Percent,25" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 7</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>449, 112</value>
<value>449, 139</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>6</value>

View File

@ -330,7 +330,7 @@ namespace UdsAdmin.forms
{
xmlrpc.Authenticator auth = (xmlrpc.Authenticator)treeActions.SelectedNode.Tag;
AuthenticatorForm dlg = new AuthenticatorForm(auth.typeName, auth.type, getIcon(_authenticatorsTypes, auth.type));
dlg.setData(auth.name, auth.comments, auth.id, xmlrpc.UdsAdminService.GetAuthenticator(auth.id));
dlg.setData(auth.name, auth.comments, auth.id, auth.smallName, xmlrpc.UdsAdminService.GetAuthenticator(auth.id));
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
updateAuthenticatorsTree();
break;

View File

@ -199,7 +199,7 @@
<value>splitContainer1</value>
</data>
<data name="&gt;&gt;splitContainer1.Type" xml:space="preserve">
<value>UdsAdmin.controls.SplitContainerEx, UdsAdmin, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>UdsAdmin.controls.SplitContainerEx, UdsAdmin, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;splitContainer1.Parent" xml:space="preserve">
<value>$this</value>

View File

@ -66,6 +66,17 @@ namespace UdsAdmin.xmlrpc
data[len + 2] = new GuiFieldValue("priority", priority.ToString());
}
private static void insertNameCommentsPrioritySmallName(string name, string comments, int priority, string smallName, ref GuiFieldValue[] data)
{
int len = data.Length;
Array.Resize(ref data, len + 4);
data[len] = new GuiFieldValue("name", name);
data[len + 1] = new GuiFieldValue("comments", comments);
data[len + 2] = new GuiFieldValue("priority", priority.ToString());
data[len + 3] = new GuiFieldValue("smallName", smallName);
}
private static void insertNameComments(string name, string comments, ref GuiFieldValue[] data)
{
int len = data.Length;
@ -304,16 +315,16 @@ namespace UdsAdmin.xmlrpc
return s.GetAuthenticatorGroups(credentials, id);
}
public static bool CreateAuthenticator(string name, string comments, string type, int priority, GuiFieldValue[] data)
public static bool CreateAuthenticator(string name, string comments, string type, int priority, string smallName, GuiFieldValue[] data)
{
insertNameCommentsPriority(name, comments, priority, ref data);
insertNameCommentsPrioritySmallName(name, comments, priority, smallName, ref data);
return s.CreateAuthenticator(credentials, type, data);
}
public static bool ModifyAuthenticator(string name, string comments, int priority, string id, GuiFieldValue[] data)
public static bool ModifyAuthenticator(string name, string comments, int priority, string id, string smallName, GuiFieldValue[] data)
{
insertNameCommentsPriority(name, comments, priority, ref data);
insertNameCommentsPrioritySmallName(name, comments, priority, smallName, ref data);
return s.ModifyAuthenticator(credentials, id, data);
}

View File

@ -225,6 +225,7 @@ namespace UdsAdmin.xmlrpc
public class Authenticator : BaseItemData
{
public string priority;
public string smallName;
}
public class Group