diff --git a/CloudBuilder.Core/Policy/CoreMessagePolicy.cs b/CloudBuilder.Core/Policy/CoreMessagePolicy.cs index 5a96167..a614ff0 100644 --- a/CloudBuilder.Core/Policy/CoreMessagePolicy.cs +++ b/CloudBuilder.Core/Policy/CoreMessagePolicy.cs @@ -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() diff --git a/CloudBuilder.Core/Policy/CoreMessagePolicy_en.resx b/CloudBuilder.Core/Policy/CoreMessagePolicy_en.resx index a45cf5a..89ea833 100644 --- a/CloudBuilder.Core/Policy/CoreMessagePolicy_en.resx +++ b/CloudBuilder.Core/Policy/CoreMessagePolicy_en.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + No permission has been assigned. + The data has been modified by another user. Please refresh and try again. diff --git a/CloudBuilder.Core/Policy/CoreMessagePolicy_zh-cn.resx b/CloudBuilder.Core/Policy/CoreMessagePolicy_zh-cn.resx index cdabc04..832c2ba 100644 --- a/CloudBuilder.Core/Policy/CoreMessagePolicy_zh-cn.resx +++ b/CloudBuilder.Core/Policy/CoreMessagePolicy_zh-cn.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 没有分配权限. + 数据已被其他用户修改,请刷新后重试. diff --git a/CloudBuilder.Core/Request/ServiceRequest.cs b/CloudBuilder.Core/Request/ServiceRequest.cs index 4d5b578..8673e5a 100644 --- a/CloudBuilder.Core/Request/ServiceRequest.cs +++ b/CloudBuilder.Core/Request/ServiceRequest.cs @@ -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)); } diff --git a/CloudBuilder.Request/Security/SecurityActorRequest.auto.cs b/CloudBuilder.Request/Security/SecurityActorRequest.auto.cs index 6a25c2c..c42c30e 100644 --- a/CloudBuilder.Request/Security/SecurityActorRequest.auto.cs +++ b/CloudBuilder.Request/Security/SecurityActorRequest.auto.cs @@ -34,6 +34,10 @@ return Task.Run(() => serviceRequest.PostAsJsonAsync("/Secu { return Task.Run(() => serviceRequest.PostAsJsonAsync ("/SecurityActor/FindAll")).GetAwaiter().GetResult(); } + public SecurityActorEntity[] FindAllByNoPermission() + { +return Task.Run(() => serviceRequest.PostAsJsonAsync ("/SecurityActor/FindAllByNoPermission")).GetAwaiter().GetResult(); } + public SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria criteria) { return Task.Run(() => serviceRequest.PostAsJsonAsync("/SecurityActor/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); } diff --git a/CloudBuilder.Security.Gui/SecurityActorOperationPage.Designer.cs b/CloudBuilder.Security.Gui/SecurityActorOperationPage.Designer.cs index 0bd971a..9b7fe78 100644 --- a/CloudBuilder.Security.Gui/SecurityActorOperationPage.Designer.cs +++ b/CloudBuilder.Security.Gui/SecurityActorOperationPage.Designer.cs @@ -28,10 +28,10 @@ /// 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); diff --git a/CloudBuilder.Security.Gui/SecurityActorOperationPage.cs b/CloudBuilder.Security.Gui/SecurityActorOperationPage.cs index 178bd83..213a568 100644 --- a/CloudBuilder.Security.Gui/SecurityActorOperationPage.cs +++ b/CloudBuilder.Security.Gui/SecurityActorOperationPage.cs @@ -637,5 +637,41 @@ namespace CloudBuilder.Security.Gui selectedUserGv.AddRow(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(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(deselectedGv.SelectedCells[0].RowIndex); + + DisplayPage(GuiDisplayMode.View, data.GroupName); + } } } diff --git a/CloudBuilder.Security.Gui/SecurityActorOperationPage.resx b/CloudBuilder.Security.Gui/SecurityActorOperationPage.resx index a0a8ae6..d573b74 100644 --- a/CloudBuilder.Security.Gui/SecurityActorOperationPage.resx +++ b/CloudBuilder.Security.Gui/SecurityActorOperationPage.resx @@ -126,4 +126,13 @@ True + + True + + + True + + + True + \ No newline at end of file diff --git a/CloudBuilder.Security.Gui/SecurityGroupOperationPage.Designer.cs b/CloudBuilder.Security.Gui/SecurityGroupOperationPage.Designer.cs index 0a2b928..ded2781 100644 --- a/CloudBuilder.Security.Gui/SecurityGroupOperationPage.Designer.cs +++ b/CloudBuilder.Security.Gui/SecurityGroupOperationPage.Designer.cs @@ -430,6 +430,7 @@ dataGv.Size = new Size(1024, 400); dataGv.TabIndex = 2; dataGv.CellClick += dataGv_CellClick; + dataGv.CellDoubleClick += dataGv_CellDoubleClick; // // permissionNameCol // diff --git a/CloudBuilder.Security.Gui/SecurityGroupOperationPage.cs b/CloudBuilder.Security.Gui/SecurityGroupOperationPage.cs index c606c0f..2c52002 100644 --- a/CloudBuilder.Security.Gui/SecurityGroupOperationPage.cs +++ b/CloudBuilder.Security.Gui/SecurityGroupOperationPage.cs @@ -81,7 +81,7 @@ namespace CloudBuilder.Security.Gui InitPermission(); groupNameTxt.Set(SecurityGroupEntity.GROUP_NAME, groupNameLabel.Text, EnumEditModeColor.Required); - groupEngNameTxt.Set(SecurityGroupEntity.GROUP_ENG_NAME, groupLocalNameLabel.Text,EnumEditModeColor.Required); + groupEngNameTxt.Set(SecurityGroupEntity.GROUP_ENG_NAME, groupLocalNameLabel.Text, EnumEditModeColor.Required); groupLocalNameTxt.Set(SecurityGroupEntity.GROUP_LOCAL_NAME, groupEngNameLabel.Text, EnumEditModeColor.Required); dataGv.InitColumn(false, true); @@ -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(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); + } } } diff --git a/CloudBuilder.Security.Gui/SecurityUserOperationPage.Designer.cs b/CloudBuilder.Security.Gui/SecurityUserOperationPage.Designer.cs index 19f15e9..372908e 100644 --- a/CloudBuilder.Security.Gui/SecurityUserOperationPage.Designer.cs +++ b/CloudBuilder.Security.Gui/SecurityUserOperationPage.Designer.cs @@ -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); } diff --git a/CloudBuilder.Security.Gui/SecurityUserOperationPage.cs b/CloudBuilder.Security.Gui/SecurityUserOperationPage.cs index cd6b0b5..67ea99f 100644 --- a/CloudBuilder.Security.Gui/SecurityUserOperationPage.cs +++ b/CloudBuilder.Security.Gui/SecurityUserOperationPage.cs @@ -76,7 +76,7 @@ namespace CloudBuilder.Security.Gui userTypeCombo.SetDataSource(securityUserTypePolicy.GetDataSource(), true); SecurityActorRequest securityActorRequest = ServiceHelper.GetTypeService(); - 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(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(deselectedGv.SelectedCells[0].RowIndex); + + DisplayPage(GuiDisplayMode.View, data.ActorName); + } } } diff --git a/CloudBuilder.Security.Service/CloudBuilder.Security.Service.csproj b/CloudBuilder.Security.Service/CloudBuilder.Security.Service.csproj index ed9f5e8..f43e9ba 100644 --- a/CloudBuilder.Security.Service/CloudBuilder.Security.Service.csproj +++ b/CloudBuilder.Security.Service/CloudBuilder.Security.Service.csproj @@ -39,6 +39,6 @@ - + diff --git a/CloudBuilder.Security.Service/SecurityActorService.cs b/CloudBuilder.Security.Service/SecurityActorService.cs index 471f69e..120e9f4 100644 --- a/CloudBuilder.Security.Service/SecurityActorService.cs +++ b/CloudBuilder.Security.Service/SecurityActorService.cs @@ -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) { diff --git a/CloudBuilder.Security/CloudBuilder.Security.csproj b/CloudBuilder.Security/CloudBuilder.Security.csproj index 0212446..e111666 100644 --- a/CloudBuilder.Security/CloudBuilder.Security.csproj +++ b/CloudBuilder.Security/CloudBuilder.Security.csproj @@ -39,6 +39,6 @@ - + diff --git a/CloudBuilder.Security/Service/ISecurityActorService.auto.cs b/CloudBuilder.Security/Service/ISecurityActorService.auto.cs index 4b221f6..b78c059 100644 --- a/CloudBuilder.Security/Service/ISecurityActorService.auto.cs +++ b/CloudBuilder.Security/Service/ISecurityActorService.auto.cs @@ -11,6 +11,8 @@ namespace CloudBuilder.Security.Service { SecurityActorEntity[] FindAll(); + SecurityActorEntity[] FindAllByNoPermission(); + SecurityActorResultData FindBySearchCriteria(SecurityActorSearchCriteria tc); dynamic PrintBySearchCriteria(SecurityActorSearchCriteria tc); diff --git a/CloudBuilder.Web.Entry/Controllers/Security/SecurityActorController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Security/SecurityActorController.auto.cs index 6ae4fb8..d44b993 100644 --- a/CloudBuilder.Web.Entry/Controllers/Security/SecurityActorController.auto.cs +++ b/CloudBuilder.Web.Entry/Controllers/Security/SecurityActorController.auto.cs @@ -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")] diff --git a/Data/init.bak b/Data/init.bak new file mode 100644 index 0000000..dc7fe64 Binary files /dev/null and b/Data/init.bak differ