fix(#I1AL3V): 修复角色维护中可以更改角色名称问题

#Comment
comment #I1AL3V

#Issue
close https://gitee.com/LongbowEnterprise/dashboard/issues?id=I1AL3V
This commit is contained in:
Argo Zhang 2020-03-02 15:47:32 +08:00
parent 819890dff2
commit daf3e32724
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 2 additions and 2 deletions

View File

@ -88,8 +88,8 @@ namespace Bootstrap.DataAccess
public static bool Save(Role p)
{
// 内置两个角色禁止修改
var roles = new string[] { "Administrators", "Default" };
if (roles.Any(r => r.Equals(p.RoleName, StringComparison.OrdinalIgnoreCase))) return true;
var roles = Retrieves().Where(r => new string[] { "Administrators", "Default" }.Any(s => s.Equals(r.RoleName, StringComparison.OrdinalIgnoreCase))).Select(r => r.Id ?? "");
if (!string.IsNullOrEmpty(p.Id) && roles.Any(r => r.Equals(p.Id, StringComparison.OrdinalIgnoreCase))) return true;
var ret = DbContextManager.Create<Role>()?.Save(p) ?? false;
if (ret) CacheCleanUtility.ClearCache(roleIds: string.IsNullOrEmpty(p.Id) ? new List<string>() : new List<string> { p.Id });