'show_roles( self, trans, id, **kwd ):
* GET /api/libraries/datasets/{encoded_dataset_id}/permissions
Displays information about current or available roles
for a given dataset permission.
:param  encoded_dataset_id:      the encoded id of the dataset to query
:type   encoded_dataset_id:      an encoded id string
:param  scope:      either \'current\' or \'available\'
:type   scope:      string
:rtype:     dictionary
:returns:   either dict of current roles for all permission types or
dict of available roles to choose from (is the same for any permission type)'

@expose_api
def show_roles(self, trans, encoded_dataset_id, **kwd):

    current_user_roles = trans.get_current_user_roles()
    try:
        library_dataset = self.get_library_dataset(trans, id=encoded_dataset_id, check_ownership=False, check_accessible=False)
    except Exception as e:
        raise exceptions.ObjectNotFound(('Requested    dataset    was    not    found.' + str(e)))
    dataset = library_dataset.library_dataset_dataset_association.dataset
    can_manage = (trans.app.security_agent.can_manage_dataset(current_user_roles, dataset) or trans.user_is_admin())
    if (not can_manage):
        raise exceptions.InsufficientPermissionsException('You    do    not    have    proper    permission    to    access    permissions.')
    scope = kwd.get('scope', None)
    if ((scope == 'current') or (scope is None)):
        return self._get_current_roles(trans, library_dataset)
    elif (scope == 'available'):
        page = kwd.get('page', None)
        if (page is not None):
            page = int(page)
        else:
            page = 1
        page_limit = kwd.get('page_limit', None)
        if (page_limit is not None):
            page_limit = int(page_limit)
        else:
            page_limit = 10
        query = kwd.get('q', None)
        (roles, total_roles) = trans.app.security_agent.get_valid_roles(trans, dataset, query, page, page_limit)
        return_roles = []
        for role in roles:
            role_id = trans.security.encode_id(role.id)
            return_roles.append(dict(id=role_id, name=role.name, type=role.type))
        return dict(roles=return_roles, page=page, page_limit=page_limit, total=total_roles)
    else:
        raise exceptions.RequestParameterInvalidException("The    value    of    'scope'    parameter    is    invalid.    Alllowed    values:    current,    available")
