'GET /api/groups/{encoded_group_id}/roles
Displays a collection (list) of groups.'

@web.expose_api
@web.require_admin
def index(self, trans, group_id, **kwd):

    decoded_group_id = trans.security.decode_id(group_id)
    try:
        group = trans.sa_session.query(trans.app.model.Group).get(decoded_group_id)
    except:
        group = None
    if (not group):
        trans.response.status = 400
        return ('Invalid    group    id    (    %s    )    specified.' % str(group_id))
    rval = []
    try:
        for gra in group.roles:
            role = gra.role
            encoded_id = trans.security.encode_id(role.id)
            rval.append(dict(id=encoded_id, name=role.name, url=url_for('group_role', group_id=group_id, id=encoded_id)))
    except Exception as e:
        rval = 'Error    in    group    API    at    listing    roles'
        log.error((rval + (':    %s' % str(e))))
        trans.response.status = 500
    return rval
