'* GET /api/folders/{id}/permissions
Load all permissions for the given folder id and return it.
:param  encoded_folder_id:     the encoded id of the folder
:type   encoded_folder_id:     an encoded id string
:param  scope:      either \'current\' or \'available\'
:type   scope:      string
:returns:   dictionary with all applicable permissions\' values
:rtype:     dictionary
:raises: InsufficientPermissionsException'

@expose_api
def get_permissions(self, trans, encoded_folder_id, **kwd):

    current_user_roles = trans.get_current_user_roles()
    is_admin = trans.user_is_admin()
    decoded_folder_id = self.folder_manager.cut_and_decode(trans, encoded_folder_id)
    folder = self.folder_manager.get(trans, decoded_folder_id)
    if (not (is_admin or trans.app.security_agent.can_manage_library_item(current_user_roles, folder))):
        raise exceptions.InsufficientPermissionsException('You    do    not    have    proper    permission    to    access    permissions    of    this    folder.')
    scope = kwd.get('scope', None)
    if ((scope == 'current') or (scope is None)):
        return self.folder_manager.get_current_roles(trans, folder)
    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, folder, 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")
