'GET /api/users
GET /api/users/deleted
Displays a collection (list) of users.
:param deleted: (optional) If true, show deleted users
:type  deleted: bool
:param f_email: (optional) An email address to filter on. (Non-admin
users can only use this if ``expose_user_email`` is ``True`` in
galaxy.ini)
:type  f_email: str
:param f_name: (optional) A username to filter on. (Non-admin users
can only use this if ``expose_user_name`` is ``True`` in
galaxy.ini)
:type  f_name: str
:param f_any: (optional) Filter on username OR email. (Non-admin users
can use this, the email filter and username filter will
only be active if their corresponding ``expose_user_*`` is
``True`` in galaxy.ini)
:type  f_any: str'

@expose_api
def index(self, trans, deleted='False', f_email=None, f_name=None, f_any=None, **kwd):

    rval = []
    query = trans.sa_session.query(trans.app.model.User)
    deleted = util.string_as_bool(deleted)
    if (f_email and (trans.user_is_admin() or trans.app.config.expose_user_email)):
        query = query.filter(trans.app.model.User.email.like(('%%%s%%' % f_email)))
    if (f_name and (trans.user_is_admin() or trans.app.config.expose_user_name)):
        query = query.filter(trans.app.model.User.username.like(('%%%s%%' % f_name)))
    if f_any:
        if trans.user_is_admin():
            query = query.filter(or_(trans.app.model.User.email.like(('%%%s%%' % f_any)), trans.app.model.User.username.like(('%%%s%%' % f_any))))
        elif (trans.app.config.expose_user_email and trans.app.config.expose_user_name):
            query = query.filter(or_(trans.app.model.User.email.like(('%%%s%%' % f_any)), trans.app.model.User.username.like(('%%%s%%' % f_any))))
        elif trans.app.config.expose_user_email:
            query = query.filter(trans.app.model.User.email.like(('%%%s%%' % f_any)))
        elif trans.app.config.expose_user_name:
            query = query.filter(trans.app.model.User.username.like(('%%%s%%' % f_any)))
    if deleted:
        query = query.filter((trans.app.model.User.table.c.deleted == true()))
        if (not trans.user_is_admin()):
            return []
    else:
        query = query.filter((trans.app.model.User.table.c.deleted == false()))
        if ((not trans.user_is_admin()) and (not trans.app.config.expose_user_name) and (not trans.app.config.expose_user_email)):
            item = trans.user.to_dict(value_mapper={'id': trans.security.encode_id})
            return [item]
    for user in query:
        item = user.to_dict(value_mapper={'id': trans.security.encode_id})
        if ((user is not trans.user) and (not trans.user_is_admin())):
            expose_keys = ['id']
            if trans.app.config.expose_user_name:
                expose_keys.append('username')
            if trans.app.config.expose_user_email:
                expose_keys.append('email')
            new_item = {}
            for (key, value) in item.items():
                if (key in expose_keys):
                    new_item[key] = value
            item = new_item
        rval.append(item)
    return rval
