internal IDictionary <string, bool> GetMemberGroupValue(string username)
        {
            IEnumerable <string> userRoles = username.IsNullOrWhiteSpace() ? null : _memberService.GetAllRoles(username);

            // create a dictionary of all roles (except internal roles) + "false"
            var result = _memberGroupService.GetAll()
                         .Select(x => x.Name)
                         // if a role starts with __umbracoRole we won't show it as it's an internal role used for public access
                         .Where(x => x.StartsWith(Constants.Conventions.Member.InternalRolePrefix) == false)
                         .OrderBy(x => x, StringComparer.OrdinalIgnoreCase)
                         .ToDictionary(x => x, x => false);

            // if user has no roles, just return the dictionary
            if (userRoles == null)
            {
                return(result);
            }

            // else update the dictionary to "true" for the user roles (except internal roles)
            foreach (var userRole in userRoles.Where(x => x.StartsWith(Constants.Conventions.Member.InternalRolePrefix) == false))
            {
                result[userRole] = true;
            }

            return(result);
        }
 public IDictionary <int, string> GetMemberGroups()
 {
     return(memberGroupService
            .GetAll()
            .OrderBy(g => g.Id)
            .ToDictionary(g => g.Id, g => g.Name));
 }
 public IEnumerable <DataListItem> GetItems(Dictionary <string, object> config)
 {
     return(_memberGroupService
            .GetAll()
            .Select(x => new DataListItem
     {
         Name = x.Name,
         Value = x.Key.ToString(),
         Icon = UmbConstants.Icons.MemberGroup,
         Description = Udi.Create(UmbConstants.UdiEntityType.MemberGroup, x.Key).ToString()
     }));
 }
Пример #4
0
 public IEnumerable <MemberGroupDisplay> GetAllGroups()
 => _memberGroupService.GetAll()
 .Select(_umbracoMapper.Map <IMemberGroup, MemberGroupDisplay>);
Пример #5
0
 public IEnumerable <IMemberGroup> GetAll()
 {
     return(_memberGroupService.GetAll());
 }
Пример #6
0
 public Task <IEnumerable <string> > GetAll()
 {
     return(Task.FromResult(_memberGroupService.GetAll().Select(x => x.Name)));
 }
 protected virtual IEnumerable <IntranetMemberGroup> CurrentCache()
 {
     return(_cacheService.GetOrSet(IntranetMemberGroupCacheKey, () => _memberGroupService.GetAll().Map <IEnumerable <IntranetMemberGroup> >()));
 }