增加功能:增加RetrieveGroupsByUserName方法,本方法系统暂时未使用,用于依靠部门进行权限管理体系

This commit is contained in:
Argo-MacBookPro 2018-10-31 17:47:50 +08:00
parent ce76c59aa6
commit a6d971c3a9
1 changed files with 16 additions and 0 deletions

View File

@ -124,5 +124,21 @@ namespace Bootstrap.DataAccess.MongoDB
});
return true;
}
/// <summary>
///
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public override IEnumerable<string> RetrieveGroupsByUserName(string userName)
{
var groups = new List<string>();
var user = UserHelper.RetrieveUsers().Cast<User>().FirstOrDefault(u => u.UserName == userName);
var group = GroupHelper.RetrieveGroups();
groups.AddRange(user.Groups.Select(r => group.FirstOrDefault(rl => rl.Id == r).GroupName));
if (groups.Count == 0) groups.Add("Default");
return groups;
}
}
}