diff --git a/Bootstrap.Admin/Controllers/DictsController.cs b/Bootstrap.Admin/Controllers/DictsController.cs index ddc8da59..6aca510a 100644 --- a/Bootstrap.Admin/Controllers/DictsController.cs +++ b/Bootstrap.Admin/Controllers/DictsController.cs @@ -73,7 +73,7 @@ namespace Bootstrap.Admin.Controllers [HttpDelete] public dynamic Delete([FromBody]string value) { - if (!LgbPrincipal.IsAdmin(User.Identity.Name) && !User.IsInRole("Administrators")) return new { result = false, msg = "当前用户权限不够" }; + if (!LgbPrincipal.IsAdmin(User)) return new { result = false, msg = "当前用户权限不够" }; var result = DictHelper.DeleteDict(value); return new { result = result, msg = result ? "成功!" : "失败" }; } diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs index a05de20e..f6b5930d 100644 --- a/Bootstrap.Admin/Controllers/HomeController.cs +++ b/Bootstrap.Admin/Controllers/HomeController.cs @@ -50,7 +50,7 @@ namespace Bootstrap.Admin.Controllers var model = new LoginModel(); if (string.IsNullOrEmpty(userName)) return View(model); model.UserName = userName; - if (LgbPrincipal.IsAdmin(userName, password) || BootstrapUser.Authenticate(userName, password)) + if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password)) { FormsAuthentication.RedirectFromLoginPage(userName, remember == "true"); return new EmptyResult(); diff --git a/Bootstrap.Admin/Controllers/InfosController.cs b/Bootstrap.Admin/Controllers/InfosController.cs index 42482fe6..6eed095b 100644 --- a/Bootstrap.Admin/Controllers/InfosController.cs +++ b/Bootstrap.Admin/Controllers/InfosController.cs @@ -16,9 +16,9 @@ namespace Bootstrap.Admin.Controllers { var ret = string.Empty; var userName = User.Identity.Name; - if (LgbPrincipal.IsAdmin(userName)) userName = "default"; + if (LgbPrincipal.IsWebAdmin(userName)) userName = "default"; var files = HttpContext.Current.Request.Files; - if (files.Count > 0 && !LgbPrincipal.IsAdmin(userName)) + if (files.Count > 0) { var webSiteUrl = DictHelper.RetrieveIconFolderPath().Code; var fileName = string.Format("{0}{1}", userName, Path.GetExtension(files[0].FileName)); diff --git a/Bootstrap.Admin/Controllers/LoginController.cs b/Bootstrap.Admin/Controllers/LoginController.cs index c2e6f88e..59db2c19 100644 --- a/Bootstrap.Admin/Controllers/LoginController.cs +++ b/Bootstrap.Admin/Controllers/LoginController.cs @@ -34,7 +34,7 @@ namespace Bootstrap.Admin.Controllers dynamic user = value; string userName = user.userName; string password = user.password; - if (LgbPrincipal.IsAdmin(userName, password) || BootstrapUser.Authenticate(userName, password)) + if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password)) { var interval = int.Parse(Math.Round(FormsAuthentication.Timeout.TotalSeconds).ToString()); var token = CacheManager.AddOrUpdate(string.Format("WebApi-{0}", userName), interval, k => new LoginInfo() { UserName = userName, Token = Guid.NewGuid().ToString() }, (k, info) => info, "WebApi 数据缓存"); diff --git a/Bootstrap.Admin/Controllers/UsersController.cs b/Bootstrap.Admin/Controllers/UsersController.cs index 937b7219..2df7c950 100644 --- a/Bootstrap.Admin/Controllers/UsersController.cs +++ b/Bootstrap.Admin/Controllers/UsersController.cs @@ -37,8 +37,7 @@ namespace Bootstrap.Admin.Controllers return UserHelper.RetrieveUsersByName(value.UserName) == null; } var ret = false; - var userName = User.Identity.Name; - if (value.UserName.Equals(userName, System.StringComparison.OrdinalIgnoreCase) || LgbPrincipal.IsAdmin(userName)) + if (value.UserName.Equals(User.Identity.Name, System.StringComparison.OrdinalIgnoreCase) || LgbPrincipal.IsAdmin(User)) { if (value.UserStatus == 1) ret = UserHelper.SaveUserInfoByName(value); diff --git a/Bootstrap.Admin/Views/Admin/Infos.cshtml b/Bootstrap.Admin/Views/Admin/Infos.cshtml index 5c7dfede..fe089427 100644 --- a/Bootstrap.Admin/Views/Admin/Infos.cshtml +++ b/Bootstrap.Admin/Views/Admin/Infos.cshtml @@ -33,7 +33,7 @@
@@ -57,7 +57,7 @@ diff --git a/Bootstrap.Admin/Views/Admin/Profiles.cshtml b/Bootstrap.Admin/Views/Admin/Profiles.cshtml index 10e972dd..35778c53 100644 --- a/Bootstrap.Admin/Views/Admin/Profiles.cshtml +++ b/Bootstrap.Admin/Views/Admin/Profiles.cshtml @@ -63,7 +63,7 @@