This commit is contained in:
owenchen 2026-05-12 15:30:20 +08:00
parent 647a1c38ab
commit a85e87d330
5 changed files with 20 additions and 18 deletions

View File

@ -138,9 +138,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -188,9 +188,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -244,9 +244,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -275,9 +275,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -306,9 +306,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -335,9 +335,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -379,9 +379,9 @@ namespace CloudBuilder.Core.Request
if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11); if (responseContext != null && responseContext.StartsWith("{\"errors\"")) errors = responseContext.Substring(11, responseContext.IndexOf("}") - 11);
if (response.ReasonPhrase == "Forbidden") 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}", CoreMessagePolicy.GetInstance().ComposeMessage(CoreMessagePolicy.NO_PERMISSION)));
throw new Exception(string.Format("{0}\r\n{1}", response.ReasonPhrase, errors)); throw new Exception(string.Format("{0}{1}", response.ReasonPhrase, string.IsNullOrEmpty(errors) ? "" : "\r\n" + errors));
} }
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();

View File

@ -60,6 +60,7 @@ namespace CloudBuilder.Security.Gui
//设置菜单 //设置菜单
InitMenu(); InitMenu();
//设置欢迎页 //设置欢迎页
DisplayAbstractPage(typeof(WelcomePage).Name); DisplayAbstractPage(typeof(WelcomePage).Name);
} }
catch (ValidatedException ex) catch (ValidatedException ex)

View File

@ -22,12 +22,13 @@ namespace CloudBuilder.Security.Gui
private void InitMenu() private void InitMenu()
{ {
if (securityMenuData.SecurityFunctionDisplayDatas == null || securityMenuData.SecurityFunctionDisplayDatas.Count() == 0 || securityMenuData.SecurityFunctionMaps == null || securityMenuData.SecurityFunctionMaps.Count() == 0) this.mainMenu.Items.Clear();
if (securityMenuData == null || securityMenuData.SecurityFunctionDisplayDatas == null || securityMenuData.SecurityFunctionDisplayDatas.Count() == 0 || securityMenuData.SecurityFunctionMaps == null || securityMenuData.SecurityFunctionMaps.Count() == 0)
{ {
return; return;
} }
this.mainMenu.Items.Clear();
Dictionary<string, ToolStripMenuItem> menuItems = new Dictionary<string, ToolStripMenuItem>(); Dictionary<string, ToolStripMenuItem> menuItems = new Dictionary<string, ToolStripMenuItem>();
SetMenuItem(); SetMenuItem();

View File

@ -228,7 +228,7 @@ namespace CloudBuilder.Security.Service
} }
} }
[PermissionOperate(name: SecurityPermissionPolicy.SecurityUser, operate: Operate.None)] [AllowAnonymous]
public SecurityFunctionResultData FindMenuByUsername() public SecurityFunctionResultData FindMenuByUsername()
{ {
string username = service.UserId; string username = service.UserId;

View File

@ -214,7 +214,7 @@ this.securityUserService= securityUserService;
} }
} }
[PermissionOperate(name: "SecurityUser", operate: "None")] [AllowAnonymous]
[HttpPost] [HttpPost]
public dynamic FindMenuByUsername() public dynamic FindMenuByUsername()
{ {