1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

* Added support for group editing to admin client

This commit is contained in:
Adolfo Gómez 2013-03-04 21:43:45 +00:00
parent 38b03f22c0
commit c6b9924098
16 changed files with 622 additions and 564 deletions

View File

@ -29,7 +29,7 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DeployedPanel));
this.splitContainer1 = new SplitContainerEx();
this.splitContainer1 = new UdsAdmin.controls.SplitContainerEx();
this.listView = new System.Windows.Forms.ListView();
this.Id = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.friendlyName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -72,6 +72,7 @@
this.listView.Name = "listView";
this.listView.UseCompatibleStateImageBehavior = false;
this.listView.View = System.Windows.Forms.View.Details;
this.listView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listView_ColumnClick);
this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
this.listView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.listView_KeyUp);
this.listView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView_MouseUp);

View File

@ -228,8 +228,9 @@ namespace UdsAdmin.controls.panel
private void listView_SelectedIndexChanged(object sender, EventArgs e)
{
List<xmlrpc.LogEntry> data = new List<xmlrpc.LogEntry>();
foreach (ListViewItem i in listView.SelectedItems)
if (listView.SelectedItems.Count == 1)
{
ListViewItem i = listView.SelectedItems[0];
try
{
xmlrpc.LogEntry[] logs = xmlrpc.UdsAdminService.GetUserServiceLogs((string)i.Tag);
@ -239,9 +240,8 @@ namespace UdsAdmin.controls.panel
{
gui.UserNotifier.notifyRpcException(ex);
}
logViewer1.setLogs(data.ToArray());
}
logViewer1.setLogs(data.ToArray());
}
}

View File

@ -223,7 +223,7 @@
<value>logViewer1</value>
</data>
<data name="&gt;&gt;logViewer1.Type" xml:space="preserve">
<value>UdsAdmin.controls.panel.LogViewer, UdsAdmin, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>UdsAdmin.controls.panel.LogViewer, UdsAdmin, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;logViewer1.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -259,7 +259,7 @@
<value>splitContainer1</value>
</data>
<data name="&gt;&gt;splitContainer1.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</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

@ -131,6 +131,7 @@ namespace UdsAdmin.controls.panel
{
xmlrpc.LogEntry[] logs = xmlrpc.UdsAdminService.GetDeployedServiceLogs((string)i.Tag);
data.AddRange(logs);
break;
}
catch (CookComputing.XmlRpc.XmlRpcFaultException ex)
{

View File

@ -56,6 +56,7 @@ namespace UdsAdmin.controls.panel
_emptyMenu = new ContextMenuStrip();
_fullMenu = new ContextMenuStrip();
ToolStripMenuItem modify = new ToolStripMenuItem(Strings.modifyItem); modify.Click += modifyItem; modify.Image = Images.groups16;
ToolStripMenuItem enable = new ToolStripMenuItem(Strings.enable); enable.Click += enableItem; enable.Image = Images.apply16;
ToolStripMenuItem disable = new ToolStripMenuItem(Strings.disable); disable.Click += disableItem; disable.Image = Images.cancel16;
ToolStripSeparator sep = new ToolStripSeparator();
@ -64,7 +65,7 @@ namespace UdsAdmin.controls.panel
ToolStripMenuItem delete = new ToolStripMenuItem(Strings.deleteItem); delete.Click += deleteItem; delete.Image = Images.delete16;
_emptyMenu.Items.Add(newG1);
_fullMenu.Items.AddRange(new ToolStripItem[] { enable, disable, sep, newG2, delete });
_fullMenu.Items.AddRange(new ToolStripItem[] { modify, enable, disable, sep, newG2, delete });
listView.Columns[0].Text = _authType.groupNameLabel;
@ -105,7 +106,18 @@ namespace UdsAdmin.controls.panel
private void newItem(object sender, EventArgs e)
{
UdsAdmin.forms.GroupForm form = new UdsAdmin.forms.GroupForm(_auth, _authType);
UdsAdmin.forms.GroupForm form = new UdsAdmin.forms.GroupForm(_auth, _authType, null);
if (form.ShowDialog() == DialogResult.OK)
{
updateList();
}
}
private void modifyItem(object sender, EventArgs e)
{
if (listView.SelectedItems.Count != 1)
return;
UdsAdmin.forms.GroupForm form = new UdsAdmin.forms.GroupForm(_auth, _authType, (string)listView.SelectedItems[0].Tag);
if (form.ShowDialog() == DialogResult.OK)
{
updateList();

View File

@ -279,6 +279,7 @@ namespace UdsAdmin.controls.panel
{
xmlrpc.LogEntry[] logs = xmlrpc.UdsAdminService.GetUserLogs((string)i.Tag);
data.AddRange(logs);
break;
}
catch (CookComputing.XmlRpc.XmlRpcFaultException ex)
{

View File

@ -62,25 +62,21 @@
// labelProductName
//
resources.ApplyResources(this.labelProductName, "labelProductName");
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
this.labelProductName.Name = "labelProductName";
//
// labelVersion
//
resources.ApplyResources(this.labelVersion, "labelVersion");
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
this.labelVersion.Name = "labelVersion";
//
// labelCopyright
//
resources.ApplyResources(this.labelCopyright, "labelCopyright");
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
this.labelCopyright.Name = "labelCopyright";
//
// labelCompanyName
//
resources.ApplyResources(this.labelCompanyName, "labelCompanyName");
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
this.labelCompanyName.Name = "labelCompanyName";
//
// textBoxDescription

View File

@ -73,7 +73,11 @@ namespace UdsAdmin.forms
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
Version ver = Assembly.GetExecutingAssembly().GetName().Version;
string v = ver.Build.ToString() + '.' + ver.Major.ToString();
if (ver.Minor != 0)
v += " update " + ver.Minor.ToString();
return v;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -42,11 +42,13 @@ namespace UdsAdmin.forms
{
private xmlrpc.Authenticator _auth;
private xmlrpc.AuthenticatorType _authType;
private string _id;
public GroupForm(xmlrpc.Authenticator auth, xmlrpc.AuthenticatorType authType)
public GroupForm(xmlrpc.Authenticator auth, xmlrpc.AuthenticatorType authType, string groupId)
{
_auth = auth;
_authType = authType;
_id = groupId;
InitializeComponent();
Text = Strings.titleGroup;
}
@ -66,6 +68,22 @@ namespace UdsAdmin.forms
check.Visible = false;
}
groupLabel.Text = _authType.groupNameLabel;
if (_id != null)
{
try
{
xmlrpc.Group grp = xmlrpc.UdsAdminService.GetGroup(_id);
name.Text = grp.name;
comments.Text = grp.comments;
active.Checked = grp.active;
}
catch (CookComputing.XmlRpc.XmlRpcFaultException ex)
{
gui.UserNotifier.notifyRpcException(ex);
Close();
}
}
Location = MainForm.centerLocation(this);
}
@ -85,9 +103,18 @@ namespace UdsAdmin.forms
}
xmlrpc.Group grp = new xmlrpc.Group();
grp.idParent = _auth.id; grp.id = ""; grp.name = name.Text; grp.comments = comments.Text; grp.active = active.Checked;
try
{
xmlrpc.UdsAdminService.CreateGroup(grp);
if (_id == null)
{
xmlrpc.UdsAdminService.CreateGroup(grp);
}
else
{
grp.id = _id;
xmlrpc.UdsAdminService.ModifyGroup(grp);
}
DialogResult = System.Windows.Forms.DialogResult.OK;
}
catch (CookComputing.XmlRpc.XmlRpcFaultException ex)

View File

@ -193,7 +193,7 @@
<value>71, 3</value>
</data>
<data name="name.Size" type="System.Drawing.Size, System.Drawing">
<value>229, 20</value>
<value>228, 20</value>
</data>
<data name="name.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -235,7 +235,7 @@
<value>3</value>
</data>
<data name="searchButton.Location" type="System.Drawing.Point, System.Drawing">
<value>306, 3</value>
<value>305, 3</value>
</data>
<data name="searchButton.Size" type="System.Drawing.Size, System.Drawing">
<value>30, 19</value>
@ -349,7 +349,7 @@
<value>1</value>
</data>
<data name="tableLayoutPanel1.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="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="comments" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="searchButton" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="groupLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="active" Row="2" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,22,52252,Percent,77,47748,Absolute,69" /&gt;&lt;Rows Styles="Percent,30,Percent,30,Percent,40" /&gt;&lt;/TableLayoutSettings&gt;</value>
<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="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="comments" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="searchButton" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="groupLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="active" Row="2" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,22,52252,Percent,77,47748,Absolute,70" /&gt;&lt;Rows Styles="Percent,30,Percent,30,Percent,40" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="tableLayoutPanel2.ColumnCount" type="System.Int32, mscorlib">
<value>3</value>

View File

@ -525,7 +525,7 @@ namespace UdsAdmin.forms
}
else
{
forms.GroupForm dlg = new GroupForm(auth, type);
forms.GroupForm dlg = new GroupForm(auth, type, null);
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
treeActions_AfterSelect(null, null);
}

View File

@ -237,11 +237,29 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>133, 17</value>
</metadata>
<data name="exitToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 22</value>
<data name="menuStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
<value>Exit</value>
<data name="menuStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>610, 25</value>
</data>
<data name="menuStrip1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="menuStrip1.Text" xml:space="preserve">
<value>topMenu</value>
</data>
<data name="&gt;&gt;menuStrip1.Name" xml:space="preserve">
<value>menuStrip1</value>
</data>
<data name="&gt;&gt;menuStrip1.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuStrip1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;menuStrip1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="fileToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>42, 21</value>
@ -249,6 +267,24 @@
<data name="fileToolStripMenuItem.Text" xml:space="preserve">
<value>File</value>
</data>
<data name="exitToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 22</value>
</data>
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
<value>Exit</value>
</data>
<data name="toolsToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>52, 21</value>
</data>
<data name="toolsToolStripMenuItem1.Text" xml:space="preserve">
<value>Tools</value>
</data>
<data name="languageToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 22</value>
</data>
<data name="languageToolStripMenuItem1.Text" xml:space="preserve">
<value>Language</value>
</data>
<data name="englishToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>127, 22</value>
</data>
@ -273,12 +309,6 @@
<data name="germanToolStripMenuItem.Text" xml:space="preserve">
<value>German</value>
</data>
<data name="languageToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 22</value>
</data>
<data name="languageToolStripMenuItem1.Text" xml:space="preserve">
<value>Language</value>
</data>
<data name="configurationToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 22</value>
</data>
@ -291,35 +321,11 @@
<data name="aboutToolStripMenuItem1.Text" xml:space="preserve">
<value>About</value>
</data>
<data name="toolsToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>52, 21</value>
<data name="serviceProviderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>103, 20</value>
</data>
<data name="toolsToolStripMenuItem1.Text" xml:space="preserve">
<value>Tools</value>
</data>
<data name="menuStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="menuStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>610, 25</value>
</data>
<data name="menuStrip1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="menuStrip1.Text" xml:space="preserve">
<value>topMenu</value>
</data>
<data name="&gt;&gt;menuStrip1.Name" xml:space="preserve">
<value>menuStrip1</value>
</data>
<data name="&gt;&gt;menuStrip1.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuStrip1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;menuStrip1.ZOrder" xml:space="preserve">
<value>3</value>
<data name="serviceProviderToolStripMenuItem.Text" xml:space="preserve">
<value>Service Provider</value>
</data>
<data name="newServiceProviderMenu.Size" type="System.Drawing.Size, System.Drawing">
<value>106, 22</value>
@ -330,15 +336,15 @@
<data name="testToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>106, 22</value>
</data>
<data name="serviceProviderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>103, 20</value>
</data>
<data name="serviceProviderToolStripMenuItem.Text" xml:space="preserve">
<value>Service Provider</value>
</data>
<data name="toolsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 19</value>
</data>
<data name="languageToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 22</value>
</data>
<data name="languageToolStripMenuItem.Text" xml:space="preserve">
<value>Language</value>
</data>
<data name="spanishToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 22</value>
</data>
@ -351,12 +357,6 @@
<data name="englishToolStripMenuItem.Text" xml:space="preserve">
<value>English</value>
</data>
<data name="languageToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 22</value>
</data>
<data name="languageToolStripMenuItem.Text" xml:space="preserve">
<value>Language</value>
</data>
<data name="aboutToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 22</value>
</data>
@ -366,18 +366,6 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>248, 17</value>
</metadata>
<data name="toolStripButton1.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripButton1.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 22</value>
</data>
<data name="toolStripButton1.Text" xml:space="preserve">
<value>Flush Cache</value>
</data>
<data name="toolStripButton1.ToolTipText" xml:space="preserve">
<value>Clears the cache</value>
</data>
<data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 25</value>
</data>
@ -402,6 +390,18 @@
<data name="&gt;&gt;toolStrip1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="toolStripButton1.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="toolStripButton1.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 22</value>
</data>
<data name="toolStripButton1.Text" xml:space="preserve">
<value>Flush Cache</value>
</data>
<data name="toolStripButton1.ToolTipText" xml:space="preserve">
<value>Clears the cache</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View File

@ -55,6 +55,7 @@ namespace UdsAdmin.gui
public const string SERVICE = "Service";
public const string USERS = "Users";
public const string GROUPS = "Groups";
public const string METAGROUPS = "MGroups";
public const string ALLOWED_GROUPS = "AllowGroups";
public const string ASSIGNED_SERVICES = "AssignService";
public const string ASSIGNED_TRANSPORTS = "AssignedTransports";

View File

@ -147,6 +147,9 @@ namespace UdsAdmin.xmlrpc
[XmlRpcMethod("createGroup")]
bool CreateGroup(string credentials, Group group);
[XmlRpcMethod("modifyGroup")]
bool ModifyGroup(string credentials, Group group);
[XmlRpcMethod("changeGroupsState")]
bool ChangeGroupsState(string credentials, string[] ids, bool newState);

View File

@ -366,6 +366,11 @@ namespace UdsAdmin.xmlrpc
return s.CreateGroup(credentials, grp);
}
public static bool ModifyGroup(Group grp)
{
return s.ModifyGroup(credentials, grp);
}
public static bool ChangeGroupsState(string[] ids, bool newState)
{
return s.ChangeGroupsState(credentials, ids, newState);