fix(#I188NA): 角色保存时判断内置角色名称不重复

#Issue
link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I188NA
This commit is contained in:
Argo-2016 2020-01-11 19:43:52 +08:00
parent 0d01ea8c0e
commit fe5aac13fd
1 changed files with 1 additions and 2 deletions

View File

@ -89,8 +89,7 @@ namespace Bootstrap.DataAccess
{
// 内置两个角色禁止修改
var roles = new string[] { "Administrators", "Default" };
var rs = Retrieves().Where(r => roles.Any(rl => rl.Equals(r.RoleName, StringComparison.OrdinalIgnoreCase)));
if (rs.Any()) return true;
if (roles.Any(r => r.Equals(p.RoleName, 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 });