def get_user_list(cursor):
    """
    Get the list of the users and their roles/permissions

    Parameters:
    -----------
    cursor: Psycopg2 cursor
        cursor in the connection to the postgres database
    Returns:
    --------
    res: List
        List of dictionaries with the following elements:
        uid: Int
            identifier of the user in the database
        username: Str
            name of the user
        roles: List(Str)
            roles/permissions of the user (admin, edit, user)
    """
    SQL = "SELECT id as uid, username,apiuser AS user,edit_auth AS edit, admin FROM users"
    cursor.execute(SQL)
    res=cursor.fetchall()
    for i in res:
        i['roles']=[]
        if i.pop('user'):
            i['roles']+=['user']
        if i.pop('admin'):
            i['roles']+=['admin']
        if i.pop('edit'):
            i['roles']+=['edit']
    return res