Return a list of users matching a filter (if provided).
763012
def describe_users(self, users_filter=None):
        """"""
        user_list = Users(oktypes=User)
        for user in self._user_list:
            if users_filter and (users_filter.get('name') == user.name or users_filter.get('uid') == user.uid):
                user_list.append(user)
        return user_list
1322115
def get_groups(self, username):
        """"""
        username = ldap.filter.escape_filter_chars(self._byte_p2(username))
        userdn = self._get_user(username, NO_ATTR)

        searchfilter = self.group_filter_tmpl % {
            'userdn': userdn,
            'username': username
        }

        groups = self._search(searchfilter, NO_ATTR, self.groupdn)
        ret = []
        for entry in groups:
            ret.append(self._uni(entry[0]))
        return ret
1127734
def list(self, **filters):
        
        LOG.debug(u'Querying %s by filters=%s', self.model_class.__name__, filters)
        query = self.__queryset__()
        perm = build_permission_name(self.model_class, 'view')
        LOG.debug(u"Checking if user %s has_perm %s" % (self.user, perm))
        query_with_permission = filter(lambda o: self.user.has_perm(perm, obj=o), query)
        ids = map(lambda o: o.pk, query_with_permission)

        # FIXME: Return to query again without use database
        queryset = self.__queryset__().filter(pk__in=ids)
        related = getattr(self, 'select_related', None)
        if related:
            queryset = queryset.select_related(*related)

        return queryset
480099
def get_users_for_assigned_to():
    
    User = get_user_model()
    return User.objects.filter(is_active=True, is_staff=True)
484847
def getPeopleFilters(self):
        
        yield AllPeopleFilter()
        yield VIPPeopleFilter()
        for getPeopleFilters in self._gatherPluginMethods('getPeopleFilters'):
            for peopleFilter in getPeopleFilters():
                yield peopleFilter
        for tag in sorted(self.getPeopleTags()):
            yield TaggedPeopleFilter(tag)
17885
def _parse_users(self, match):
        ''''''

        # Don't parse lists here
        if match.group(2) is not None:
            return match.group(0)

        mat = match.group(0)
        if self._include_spans:
            self._users.append((mat[1:], match.span(0)))
        else:
            self._users.append(mat[1:])

        if self._html:
            return self.format_username(mat[0:1], mat[1:])
1240227
def get_users(self, filter=None, sortBy=None, sortOrder=None,
            startIndex=None, count=None):
        
        self.assert_has_permission('scim.read')

        params = {}
        if filter:
            params['filter'] = filter

        if sortBy:
            params['sortBy'] = sortBy

        if sortOrder:
            params['sortOrder'] = sortOrder

        if startIndex:
            params['startIndex'] = startIndex

        if count:
            params['count'] = count

        return self._get(self.uri + '/Users', params=params)
1246602
def count(cls, *criteria, **filters):
        """"""
        return cls.query.filter(*criteria).filter_by(**filters).count()
592194
def filter(self, search):
        '''
        
        '''
        if not self._filters:
            return search
        filters = Q('match_all')
        for f in self._filters.values():
            filters &= f
        return search.filter(filters)
555893
def _filter_queryset(self, perms, queryset):
        """"""
        user = self.request.user if self.request else AnonymousUser()
        return get_objects_for_user(user, perms, queryset)
367514
def getUsers(context, roles, allow_empty=True):
    
    mtool = getToolByName(context, 'portal_membership')
    pairs = allow_empty and [['', '']] or []
    users = mtool.searchForMembers(roles=roles)
    for user in users:
        uid = user.getId()
        fullname = user.getProperty('fullname')
        if not fullname:
            fullname = uid
        pairs.append((uid, fullname))
    pairs.sort(lambda x, y: cmp(x[1], y[1]))
    return DisplayList(pairs)
282218
def list_users(self, instance, limit=None, marker=None):
        """"""
        return instance.list_users(limit=limit, marker=marker)
338152
def list_users(ctx, search, uuid, active):
    """"""

    users = ctx.obj['db'].objectmodels['user']

    for found_user in users.find():
        if not search or (search and search in found_user.name):
            # TODO: Not 2.x compatible
            print(found_user.name, end=' ' if active or uuid else '\n')
            if uuid:
                print(found_user.uuid, end=' ' if active else '\n')
            if active:
                print(found_user.active)

    log("Done")
182095
def filter_query(filter_dict, required_keys):
    """"""
    if not isinstance(filter_dict, dict):
        raise TypeError("dict_list is not a list. Please try again")

    if not isinstance(required_keys, list):
        raise TypeError("dict_list is not a list. Please try again")

    available = []
    for k,v in filter_dict.items():
        # print(k, v)
        if k in required_keys:
            available.append(k)
    return available
841515
def filtered_entries(self):
        """"""
        return [
            e for e in self.entries if not any(fnmatch.fnmatch(e.name.lower(), p.lower()) for p in self.exclude_list)
        ]
1285253
def list_users(self, limit=None, marker=None):
        """"""
        return self._user_manager.list(limit=limit, marker=marker)
182616
def users(self):
        
        existing_users = self.existing_users()
        existing_user_ids = [x['id'] for x in existing_users]

        # Only add search results that are not already members
        sharing = getMultiAdapter((self.my_workspace(), self.request),
                                  name='sharing')
        search_results = sharing.user_search_results()
        users = existing_users + [x for x in search_results
                                  if x['id'] not in existing_user_ids]

        users.sort(key=lambda x: safe_unicode(x["title"]))
        return users