diff --git a/Bootstrap.DataAccess.MongoDB/Group.cs b/Bootstrap.DataAccess.MongoDB/Group.cs index b7acebab..f799e6c1 100644 --- a/Bootstrap.DataAccess.MongoDB/Group.cs +++ b/Bootstrap.DataAccess.MongoDB/Group.cs @@ -124,5 +124,21 @@ namespace Bootstrap.DataAccess.MongoDB }); return true; } + + /// + /// + /// + /// + /// + public override IEnumerable RetrieveGroupsByUserName(string userName) + { + var groups = new List(); + var user = UserHelper.RetrieveUsers().Cast().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; + } } }