/// <summary> /// Returns a list of users in the specified group. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public Task Consume(ConsumeContext <IListUsersInGroup> context) { var fetcher = RoleBasedDataFetcher.Create( () => _ldapService.GetUsersInGroup(context.Message.UserGroupName), manager => { var allUsers = _ldapService.GetUsersInGroup(context.Message.UserGroupName); var allowed = _ldapService.FindUsersByManager(manager); return(allUsers.Where(x => allowed.Any(y => y.UserName == x.UserName))); }); var users = fetcher.Execute(); return(context.RespondAsync(ListCommand.UsersInGroupResult(users.ToArray()))); }