This commit is contained in:
owenchen 2026-05-12 15:00:08 +08:00
parent 4521deaf78
commit 647a1c38ab
18 changed files with 279 additions and 103 deletions

View File

@ -13,12 +13,13 @@ namespace CloudBuilder.Core.Policy
public class CoreMessagePolicy : AbstractPolicy, IPolicy
{
public const string THE_DATA_HAS_BEEN_MODIFIED = "the_data_has_been_modified";
public const string NO_PERMISSION = "no_permission";
public static CoreMessagePolicy instance = null;
public CoreMessagePolicy(IContext context) : base(context)
{
this.values = new string[] { THE_DATA_HAS_BEEN_MODIFIED};
this.values = new string[] { THE_DATA_HAS_BEEN_MODIFIED, NO_PERMISSION };
}
public static CoreMessagePolicy GetInstance()

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="no_permission" xml:space="preserve">
<value>No permission has been assigned.</value>
</data>
<data name="the_data_has_been_modified" xml:space="preserve">
<value>The data has been modified by another user. Please refresh and try again.</value>
</data>

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="no_permission" xml:space="preserve">
<value>没有分配权限.</value>
</data>
<data name="the_data_has_been_modified" xml:space="preserve">
<value>数据已被其他用户修改,请刷新后重试.</value>
</data>

View File

@ -136,6 +136,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -182,6 +186,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -234,6 +242,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -261,6 +273,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -288,6 +304,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -313,6 +333,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}
@ -353,6 +377,10 @@ namespace CloudBuilder.Core.Request
var responseContext = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
string errors = string.Empty;
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden")
throw new Exception(string.Format("{0}\r\n{1}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION), errors));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors));
}

View File

@ -34,6 +34,10 @@ return Task.Run(() => serviceRequest.PostAsJsonAsync<SecurityActorData>("/Secu
{
return Task.Run(() => serviceRequest.PostAsJsonAsync<SecurityActorEntity[]> ("/SecurityActor/FindAll")).GetAwaiter().GetResult(); }
public SecurityActorEntity[] FindAllByNoPermission()
{
return Task.Run(() => serviceRequest.PostAsJsonAsync<SecurityActorEntity[]> ("/SecurityActor/FindAllByNoPermission")).GetAwaiter().GetResult(); }
public SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria criteria)
{
return Task.Run(() => serviceRequest.PostAsJsonAsync<SecurityActorSearchCriteria,SecurityActorResultData>("/SecurityActor/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }

View File

@ -28,10 +28,10 @@
/// </summary>
private void InitializeComponent()
{
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
tableLayoutPanel2 = new TableLayoutPanel();
actorNameLabel = new Krypton.Toolkit.KryptonLabel();
actorLocalNameLabel = new Krypton.Toolkit.KryptonLabel();
@ -44,6 +44,8 @@
tableLayoutPanel3 = new TableLayoutPanel();
tableLayoutPanel4 = new TableLayoutPanel();
selectedGv = new Krypton.Toolkit.KryptonDataGridView();
groupNameSelectedCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
groupLocalNameSelectedCol = new DataGridViewComboBoxColumn();
kryptonHeader1 = new Krypton.Toolkit.KryptonHeader();
tableLayoutPanel5 = new TableLayoutPanel();
deselectedBut = new Krypton.Toolkit.KryptonButton();
@ -51,6 +53,8 @@
tableLayoutPanel6 = new TableLayoutPanel();
kryptonHeader2 = new Krypton.Toolkit.KryptonHeader();
deselectedGv = new Krypton.Toolkit.KryptonDataGridView();
groupNameCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
groupLocalNameCol = new DataGridViewComboBoxColumn();
mainPanel = new TableLayoutPanel();
topPanel = new TableLayoutPanel();
searchPanel = new TableLayoutPanel();
@ -73,6 +77,8 @@
tableLayoutPanel1 = new TableLayoutPanel();
tableLayoutPanel7 = new TableLayoutPanel();
selectedUserGv = new Krypton.Toolkit.KryptonDataGridView();
userNameSelectedCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
userLocalNameSelectedCol = new DataGridViewComboBoxColumn();
kryptonHeader3 = new Krypton.Toolkit.KryptonHeader();
tableLayoutPanel8 = new TableLayoutPanel();
userDeselectedBut = new Krypton.Toolkit.KryptonButton();
@ -80,15 +86,9 @@
tableLayoutPanel9 = new TableLayoutPanel();
kryptonHeader4 = new Krypton.Toolkit.KryptonHeader();
deselectedUserGv = new Krypton.Toolkit.KryptonDataGridView();
kryptonPanel3 = new Krypton.Toolkit.KryptonPanel();
groupNameSelectedCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
groupLocalNameSelectedCol = new DataGridViewComboBoxColumn();
groupNameCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
groupLocalNameCol = new DataGridViewComboBoxColumn();
userNameSelectedCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
userLocalNameSelectedCol = new DataGridViewComboBoxColumn();
userNameCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
userLocalNameCol = new DataGridViewComboBoxColumn();
kryptonPanel3 = new Krypton.Toolkit.KryptonPanel();
tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)kryptonPanel2).BeginInit();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
@ -266,6 +266,24 @@
selectedGv.Name = "selectedGv";
selectedGv.Size = new Size(458, 469);
selectedGv.TabIndex = 2;
selectedGv.CellDoubleClick += selectedGv_CellDoubleClick;
//
// groupNameSelectedCol
//
groupNameSelectedCol.DataPropertyName = "GroupName";
groupNameSelectedCol.DefaultCellStyle = dataGridViewCellStyle6;
groupNameSelectedCol.HeaderText = "组别名";
groupNameSelectedCol.Name = "groupNameSelectedCol";
groupNameSelectedCol.Width = 200;
//
// groupLocalNameSelectedCol
//
groupLocalNameSelectedCol.DataPropertyName = "GroupName";
groupLocalNameSelectedCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
groupLocalNameSelectedCol.HeaderText = "组别中文名";
groupLocalNameSelectedCol.Name = "groupLocalNameSelectedCol";
groupLocalNameSelectedCol.Resizable = DataGridViewTriState.True;
groupLocalNameSelectedCol.Width = 200;
//
// kryptonHeader1
//
@ -360,6 +378,24 @@
deselectedGv.Name = "deselectedGv";
deselectedGv.Size = new Size(506, 469);
deselectedGv.TabIndex = 1;
deselectedGv.CellDoubleClick += deselectedGv_CellDoubleClick;
//
// groupNameCol
//
groupNameCol.DataPropertyName = "GroupName";
groupNameCol.DefaultCellStyle = dataGridViewCellStyle5;
groupNameCol.HeaderText = "组别名";
groupNameCol.Name = "groupNameCol";
groupNameCol.Width = 200;
//
// groupLocalNameCol
//
groupLocalNameCol.DataPropertyName = "GroupName";
groupLocalNameCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
groupLocalNameCol.HeaderText = "组别中文名";
groupLocalNameCol.Name = "groupLocalNameCol";
groupLocalNameCol.Resizable = DataGridViewTriState.True;
groupLocalNameCol.Width = 200;
//
// mainPanel
//
@ -654,6 +690,25 @@
selectedUserGv.Size = new Size(458, 469);
selectedUserGv.TabIndex = 2;
//
// userNameSelectedCol
//
userNameSelectedCol.DataPropertyName = "UserName";
userNameSelectedCol.DefaultCellStyle = dataGridViewCellStyle7;
userNameSelectedCol.HeaderText = "用户名";
userNameSelectedCol.Name = "userNameSelectedCol";
userNameSelectedCol.Resizable = DataGridViewTriState.True;
userNameSelectedCol.Width = 200;
//
// userLocalNameSelectedCol
//
userLocalNameSelectedCol.DataPropertyName = "UserName";
userLocalNameSelectedCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
userLocalNameSelectedCol.HeaderText = "用户中文名";
userLocalNameSelectedCol.Name = "userLocalNameSelectedCol";
userLocalNameSelectedCol.Resizable = DataGridViewTriState.True;
userLocalNameSelectedCol.SortMode = DataGridViewColumnSortMode.Automatic;
userLocalNameSelectedCol.Width = 200;
//
// kryptonHeader3
//
kryptonHeader3.Dock = DockStyle.Top;
@ -748,71 +803,10 @@
deselectedUserGv.Size = new Size(506, 469);
deselectedUserGv.TabIndex = 1;
//
// kryptonPanel3
//
kryptonPanel3.Dock = DockStyle.Fill;
kryptonPanel3.Location = new Point(3, 613);
kryptonPanel3.Name = "kryptonPanel3";
kryptonPanel3.Size = new Size(1018, 5);
kryptonPanel3.TabIndex = 3;
//
// groupNameSelectedCol
//
groupNameSelectedCol.DataPropertyName = "GroupName";
groupNameSelectedCol.DefaultCellStyle = dataGridViewCellStyle1;
groupNameSelectedCol.HeaderText = "组别名";
groupNameSelectedCol.Name = "groupNameSelectedCol";
groupNameSelectedCol.Width = 200;
//
// groupLocalNameSelectedCol
//
groupLocalNameSelectedCol.DataPropertyName = "GroupName";
groupLocalNameSelectedCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
groupLocalNameSelectedCol.HeaderText = "组别中文名";
groupLocalNameSelectedCol.Name = "groupLocalNameSelectedCol";
groupLocalNameSelectedCol.Resizable = DataGridViewTriState.True;
groupLocalNameSelectedCol.Width = 200;
//
// groupNameCol
//
groupNameCol.DataPropertyName = "GroupName";
groupNameCol.DefaultCellStyle = dataGridViewCellStyle2;
groupNameCol.HeaderText = "组别名";
groupNameCol.Name = "groupNameCol";
groupNameCol.Width = 200;
//
// groupLocalNameCol
//
groupLocalNameCol.DataPropertyName = "GroupName";
groupLocalNameCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
groupLocalNameCol.HeaderText = "组别中文名";
groupLocalNameCol.Name = "groupLocalNameCol";
groupLocalNameCol.Resizable = DataGridViewTriState.True;
groupLocalNameCol.Width = 200;
//
// userNameSelectedCol
//
userNameSelectedCol.DataPropertyName = "UserName";
userNameSelectedCol.DefaultCellStyle = dataGridViewCellStyle3;
userNameSelectedCol.HeaderText = "用户名";
userNameSelectedCol.Name = "userNameSelectedCol";
userNameSelectedCol.Resizable = DataGridViewTriState.True;
userNameSelectedCol.Width = 200;
//
// userLocalNameSelectedCol
//
userLocalNameSelectedCol.DataPropertyName = "UserName";
userLocalNameSelectedCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
userLocalNameSelectedCol.HeaderText = "用户中文名";
userLocalNameSelectedCol.Name = "userLocalNameSelectedCol";
userLocalNameSelectedCol.Resizable = DataGridViewTriState.True;
userLocalNameSelectedCol.SortMode = DataGridViewColumnSortMode.Automatic;
userLocalNameSelectedCol.Width = 200;
//
// userNameCol
//
userNameCol.DataPropertyName = "UserName";
userNameCol.DefaultCellStyle = dataGridViewCellStyle4;
userNameCol.DefaultCellStyle = dataGridViewCellStyle8;
userNameCol.HeaderText = "用户名";
userNameCol.Name = "userNameCol";
userNameCol.Resizable = DataGridViewTriState.True;
@ -828,6 +822,14 @@
userLocalNameCol.SortMode = DataGridViewColumnSortMode.Automatic;
userLocalNameCol.Width = 200;
//
// kryptonPanel3
//
kryptonPanel3.Dock = DockStyle.Fill;
kryptonPanel3.Location = new Point(3, 613);
kryptonPanel3.Name = "kryptonPanel3";
kryptonPanel3.Size = new Size(1018, 5);
kryptonPanel3.TabIndex = 3;
//
// SecurityActorOperationPage
//
AutoScaleDimensions = new SizeF(7F, 15F);

View File

@ -637,5 +637,41 @@ namespace CloudBuilder.Security.Gui
selectedUserGv.AddRow<SecurityUserEntity>(securityUsers);
}
private void selectedGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (selectedGv.RowCount <= 0 || selectedGv.SelectedCells.Count <= 0)
{
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
return;
}
SecurityGroupEntity data = selectedGv.GetRowData<SecurityGroupEntity>(selectedGv.SelectedCells[0].RowIndex);
DisplayPage(GuiDisplayMode.View, data.GroupName);
}
private void DisplayPage(GuiDisplayMode mode, string groupName)
{
SecurityGroupOperationLinkup linkupData = new SecurityGroupOperationLinkup();
linkupData.DisplayMode = Convert.ToInt32(mode);
linkupData.GroupName = groupName;
this.DisplayAbstractPage(typeof(SecurityGroupOperationPage).Name, linkupData);
}
private void deselectedGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (deselectedGv.RowCount <= 0 || deselectedGv.SelectedCells.Count <= 0)
{
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
return;
}
SecurityGroupEntity data = deselectedGv.GetRowData<SecurityGroupEntity>(deselectedGv.SelectedCells[0].RowIndex);
DisplayPage(GuiDisplayMode.View, data.GroupName);
}
}
}

View File

@ -126,4 +126,13 @@
<metadata name="searchBut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="createBut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="resetBut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="searchBut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -430,6 +430,7 @@
dataGv.Size = new Size(1024, 400);
dataGv.TabIndex = 2;
dataGv.CellClick += dataGv_CellClick;
dataGv.CellDoubleClick += dataGv_CellDoubleClick;
//
// permissionNameCol
//

View File

@ -837,5 +837,27 @@ namespace CloudBuilder.Security.Gui
AddDs(d);
}
private void dataGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
{
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
return;
}
SecurityGroupPermissionViewDisplayData data = dataGv.GetRowData<SecurityGroupPermissionViewDisplayData>(dataGv.SelectedCells[0].RowIndex);
DisplayPage(GuiDisplayMode.View, data.PermissionName);
}
private void DisplayPage(GuiDisplayMode mode, string permissionName)
{
SecurityPermissionOperationLinkup linkupData = new SecurityPermissionOperationLinkup();
linkupData.DisplayMode = Convert.ToInt32(mode);
linkupData.PermissionName = permissionName;
this.DisplayAbstractPage(typeof(SecurityPermissionOperationPage).Name, linkupData);
}
}
}

View File

@ -56,6 +56,8 @@
userNameTxt = new Krypton.Toolkit.KryptonTextBox();
userLocalNameTxt = new Krypton.Toolkit.KryptonTextBox();
userMobileTxt = new Krypton.Toolkit.KryptonTextBox();
userTypeLabel = new Krypton.Toolkit.KryptonLabel();
userTypeCombo = new Krypton.Toolkit.KryptonComboBox();
kryptonPanel2 = new Krypton.Toolkit.KryptonPanel();
splitContainer1 = new SplitContainer();
tableLayoutPanel3 = new TableLayoutPanel();
@ -72,8 +74,6 @@
deselectedGv = new Krypton.Toolkit.KryptonDataGridView();
actorNameCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
actorLocalNameCol = new DataGridViewComboBoxColumn();
userTypeLabel = new Krypton.Toolkit.KryptonLabel();
userTypeCombo = new Krypton.Toolkit.KryptonComboBox();
mainPanel.SuspendLayout();
topPanel.SuspendLayout();
searchPanel.SuspendLayout();
@ -83,6 +83,7 @@
operationPanel.SuspendLayout();
contentPanel.SuspendLayout();
tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)userTypeCombo).BeginInit();
((System.ComponentModel.ISupportInitialize)kryptonPanel2).BeginInit();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
@ -94,7 +95,6 @@
tableLayoutPanel5.SuspendLayout();
tableLayoutPanel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)deselectedGv).BeginInit();
((System.ComponentModel.ISupportInitialize)userTypeCombo).BeginInit();
SuspendLayout();
//
// mainPanel
@ -407,6 +407,26 @@
userMobileTxt.Size = new Size(300, 23);
userMobileTxt.TabIndex = 3;
//
// userTypeLabel
//
userTypeLabel.Location = new Point(3, 90);
userTypeLabel.Name = "userTypeLabel";
userTypeLabel.Size = new Size(65, 20);
userTypeLabel.TabIndex = 1;
userTypeLabel.Values.Text = "用户类型:";
//
// userTypeCombo
//
userTypeCombo.Dock = DockStyle.Fill;
userTypeCombo.DropDownStyle = ComboBoxStyle.DropDownList;
userTypeCombo.DropDownWidth = 300;
userTypeCombo.IntegralHeight = false;
userTypeCombo.Location = new Point(74, 90);
userTypeCombo.Name = "userTypeCombo";
userTypeCombo.Size = new Size(300, 22);
userTypeCombo.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near;
userTypeCombo.TabIndex = 4;
//
// kryptonPanel2
//
kryptonPanel2.Dock = DockStyle.Fill;
@ -490,6 +510,7 @@
selectedGv.Name = "selectedGv";
selectedGv.Size = new Size(458, 505);
selectedGv.TabIndex = 2;
selectedGv.CellDoubleClick += selectedGv_CellDoubleClick;
//
// actorNameSelectedCol
//
@ -589,6 +610,7 @@
deselectedGv.Name = "deselectedGv";
deselectedGv.Size = new Size(506, 477);
deselectedGv.TabIndex = 1;
deselectedGv.CellDoubleClick += deselectedGv_CellDoubleClick;
//
// actorNameCol
//
@ -607,26 +629,6 @@
actorLocalNameCol.Resizable = DataGridViewTriState.True;
actorLocalNameCol.Width = 200;
//
// userTypeLabel
//
userTypeLabel.Location = new Point(3, 90);
userTypeLabel.Name = "userTypeLabel";
userTypeLabel.Size = new Size(65, 20);
userTypeLabel.TabIndex = 1;
userTypeLabel.Values.Text = "用户类型:";
//
// userTypeCombo
//
userTypeCombo.Dock = DockStyle.Fill;
userTypeCombo.DropDownStyle = ComboBoxStyle.DropDownList;
userTypeCombo.DropDownWidth = 300;
userTypeCombo.IntegralHeight = false;
userTypeCombo.Location = new Point(74, 90);
userTypeCombo.Name = "userTypeCombo";
userTypeCombo.Size = new Size(300, 22);
userTypeCombo.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near;
userTypeCombo.TabIndex = 4;
//
// SecurityUserOperationPage
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -647,6 +649,7 @@
contentPanel.PerformLayout();
tableLayoutPanel2.ResumeLayout(false);
tableLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)userTypeCombo).EndInit();
((System.ComponentModel.ISupportInitialize)kryptonPanel2).EndInit();
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel2.ResumeLayout(false);
@ -661,7 +664,6 @@
tableLayoutPanel6.ResumeLayout(false);
tableLayoutPanel6.PerformLayout();
((System.ComponentModel.ISupportInitialize)deselectedGv).EndInit();
((System.ComponentModel.ISupportInitialize)userTypeCombo).EndInit();
ResumeLayout(false);
}

View File

@ -76,7 +76,7 @@ namespace CloudBuilder.Security.Gui
userTypeCombo.SetDataSource(securityUserTypePolicy.GetDataSource(), true);
SecurityActorRequest securityActorRequest = ServiceHelper.GetTypeService<SecurityActorRequest>();
securityActors = securityActorRequest.FindAll();
securityActors = securityActorRequest.FindAllByNoPermission();
deselectedGv.SetColumnDataSource(actorLocalNameCol, securityActors, SecurityActorEntity.ACTOR_LOCAL_NAME, SecurityActorEntity.ACTOR_NAME, true);
selectedGv.SetColumnDataSource(actorLocalNameSelectedCol, securityActors, SecurityActorEntity.ACTOR_LOCAL_NAME, SecurityActorEntity.ACTOR_NAME, true);
@ -337,7 +337,7 @@ namespace CloudBuilder.Security.Gui
SecurityActorEntity[] allActors = securityActors;
SecurityActorEntity[] deselecteds = null;
SecurityActorEntity[] selecteds = null;
if (data.SecurityUserActors != null)
if (data.SecurityUserActors != null && securityActors != null)
{
deselecteds = allActors.Where(x => !data.SecurityUserActors.Select(y => y.ActorName).Contains(x.ActorName)).ToArray();
selecteds = allActors.Where(x => data.SecurityUserActors.Select(y => y.ActorName).Contains(x.ActorName)).ToArray();
@ -546,5 +546,41 @@ namespace CloudBuilder.Security.Gui
ShowMessageBox.ShowError(ex.Message);
}
}
private void selectedGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (selectedGv.RowCount <= 0 || selectedGv.SelectedCells.Count <= 0)
{
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
return;
}
SecurityActorEntity data = selectedGv.GetRowData<SecurityActorEntity>(selectedGv.SelectedCells[0].RowIndex);
DisplayPage(GuiDisplayMode.View, data.ActorName);
}
private void DisplayPage(GuiDisplayMode mode, string actorName)
{
SecurityActorOperationLinkup linkupData = new SecurityActorOperationLinkup();
linkupData.DisplayMode = Convert.ToInt32(mode);
linkupData.ActorName = actorName;
this.DisplayAbstractPage(typeof(SecurityActorOperationPage).Name, linkupData);
}
private void deselectedGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (deselectedGv.RowCount <= 0 || deselectedGv.SelectedCells.Count <= 0)
{
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
return;
}
SecurityActorEntity data = deselectedGv.GetRowData<SecurityActorEntity>(deselectedGv.SelectedCells[0].RowIndex);
DisplayPage(GuiDisplayMode.View, data.ActorName);
}
}
}

View File

@ -39,6 +39,6 @@
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="D:\NET8\CloudBuilder\CodeGenerator\bin\Debug\net8.0-windows\CodeGenerator.exe $(TargetPath)" />
<Exec Command="D:\MAFAI\CodeGenerator\CodeGenerator\bin\Debug\net8.0-windows\CodeGenerator.exe $(TargetPath)" />
</Target>
</Project>

View File

@ -52,6 +52,13 @@ namespace CloudBuilder.Security.Service
return repository.DetachedEntities.ToArray();
}
[AllowAnonymous]
[HttpPost]
public SecurityActorEntity[] FindAllByNoPermission()
{
return repository.DetachedEntities.ToArray();
}
[PermissionOperate(name: SecurityPermissionPolicy.SecurityActor, operate: Operate.Find)]
public SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria criteria)
{

View File

@ -39,6 +39,6 @@
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="D:\NET8\CloudBuilder\CodeGenerator\bin\Debug\net8.0-windows\CodeGenerator.exe $(TargetPath)" />
<Exec Command="D:\MAFAI\CodeGenerator\CodeGenerator\bin\Debug\net8.0-windows\CodeGenerator.exe $(TargetPath)" />
</Target>
</Project>

View File

@ -11,6 +11,8 @@ namespace CloudBuilder.Security.Service
{
SecurityActorEntity[] FindAll();
SecurityActorEntity[] FindAllByNoPermission();
SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria tc);
dynamic PrintBySearchCriteria(SecurityActorSearchCriteria tc);

View File

@ -70,6 +70,26 @@ this.securityActorService= securityActorService;
{
return new ServiceErrorException(ex);
}
}
[AllowAnonymous]
[HttpPost]
public dynamic FindAllByNoPermission()
{
try
{
var result = securityActorService.FindAllByNoPermission();
return result;
}
catch (ValidatedException vex)
{
return vex;
}
catch (Exception ex)
{
return new ServiceErrorException(ex);
}
}
[PermissionOperate(name: "SecurityActor", operate: "Find")]

BIN
Data/init.bak Normal file

Binary file not shown.