def _user_query(self, search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=self.domain, search_string=search_string, offset=page * limit, limit=limit) return user_es.mobile_users()
def query(self, query_context): user_es = get_search_users_in_domain_es_query( self.domain, query_context.query, limit=query_context.limit, offset=query_context.offset) return self.get_choices_from_es_query(user_es)
def _user_query(self, search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=self.domain, search_string=search_string, offset=page * limit, limit=limit) if not self.can_access_all_locations: loc_ids = (SQLLocation.objects.accessible_to_user(self.domain, self.couch_user) .location_ids()) user_es = user_es.location(list(loc_ids)) return user_es.mobile_users()
def _user_query(self, search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=self.domain, search_string=search_string, offset=page * limit, limit=limit) if not self.can_access_all_locations: loc_ids = (SQLLocation.objects.accessible_to_user(self.domain, self.couch_user) .location_ids()) user_es = user_es.location(list(loc_ids)) return user_es.mobile_users()
def _user_query(search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=domain, search_string=search_string, offset=page * limit, limit=limit) if not request.couch_user.has_permission(domain, 'access_all_locations'): loc_ids = (SQLLocation.objects.accessible_to_user(domain, request.couch_user) .location_ids()) user_es = user_es.location(list(loc_ids)) return user_es.mobile_users()
def _user_query(search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=domain, search_string=search_string, offset=page * limit, limit=limit) if not request.couch_user.has_permission(domain, 'access_all_locations'): loc_ids = (SQLLocation.objects.accessible_to_user(domain, request.couch_user) .location_ids()) user_es = user_es.location(list(loc_ids)) return user_es.mobile_users()
def schedule_user_recipients_response(self): domain = self.request.domain query = self.data.get('searchString') users = get_search_users_in_domain_es_query(domain, query, 10, 0) users = users.mobile_users().source(('_id', 'base_username')).run().hits ret = [ {'id': user['_id'], 'text': user['base_username']} for user in users ] return ret
def schedule_user_recipients_response(self): domain = self.request.domain query = self.data.get('searchString') users = get_search_users_in_domain_es_query(domain, query, 10, 0) users = users.mobile_users().source(('_id', 'base_username')).run().hits ret = [ {'id': user['_id'], 'text': user['base_username']} for user in users ] return ret
def get(self, request, domain): q = self.request.GET.get('q', None) users_query = (get_search_users_in_domain_es_query(domain, q, self._page_limit(), self._offset()) .show_inactive() .remove_default_filter("not_deleted") .source("username") ) values = [x['username'].split("@")[0] for x in users_query.run().hits] count = users_query.count() return self.render_json_response({ 'results': [{'id': v, 'text': v} for v in values], 'total': count, })
def get(self, request, domain): q = self.request.GET.get('q', None) users_query = (get_search_users_in_domain_es_query(domain, q, self._page_limit(), self._offset()) .show_inactive() .remove_default_filter("not_deleted") .source("username") ) values = [x['username'].split("@")[0] for x in users_query.run().hits] count = users_query.count() return self.render_json_response({ 'results': [{'id': v, 'text': v} for v in values], 'total': count, })
def query_count(self, query, user=None): user_es = get_search_users_in_domain_es_query(self.domain, query, limit=0, offset=0) return user_es.run().total
def _user_query(self, search_string, page, limit): user_es = get_search_users_in_domain_es_query( domain=self.domain, search_string=search_string, offset=page * limit, limit=limit) return user_es.mobile_users()
def query_count(self, query, user=None): user_es = get_search_users_in_domain_es_query(self.domain, query, limit=0, offset=0) return user_es.run().total
def query(self, query_context): user_es = get_search_users_in_domain_es_query( self.domain, query_context.query, limit=query_context.limit, offset=query_context.offset) return self.get_choices_from_es_query(user_es)