增加功能:增加RetrieveGroupsByUserName方法,本方法系统暂时未使用,用于依靠部门进行权限管理体系
This commit is contained in:
parent
ce76c59aa6
commit
a6d971c3a9
|
@ -124,5 +124,21 @@ namespace Bootstrap.DataAccess.MongoDB
|
||||||
});
|
});
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue