ory / sdk

The place where ORY's SDKs are being auto-generated
Apache License 2.0
139 stars 86 forks source link

expanded_permission_tree.rb issue #244

Closed EvanDaley closed 1 year ago

EvanDaley commented 1 year ago

Preflight checklist

Describe the bug

I've got the ruby gem running locally in a rails project and I'm hitting the latest version of the keto docker container.

When I call check_permission_with_http_info I get back a response in this format:

image

That gets deserialized by this class: ory-client-1.1.4/lib/ory-client/models/expanded_permission_tree.rb

However, that class tries to read tuples and not subject_set.

Replacing the word tuple with subject set across that file allows me to actually access the data.

I can PR a fix for this, but I'm not sure what that process looks like. Let me know 🙏

Reproducing the bug

Spin up the keto docker image from the quickstart: https://www.ory.sh/docs/keto/quickstart

Point your local keto gem at that image by overriding the url in configuration.rb server_settings (we also need to expose a way to configure that, but thats a separate issue):

image

Then try to hit that endpoint. Example rake task:

# frozen_string_literal: true
namespace :ory do

  namespace :keto do
    task expand_permissions: :environment do
      ory_permission_client = OryClient::PermissionApi.new
      result = ory_permission_client.expand_permissions(
        'videos',
        '/cats/1.mp4',
        'view',
        {
          max_depth: 10
        }
      )

      puts JSON.pretty_generate result.to_body
    end
  end
end

Without the fix, you'll see the relationship structure, without any useful tuple or subject set data. It'll look like:

image

Relevant log output

No response

Relevant configuration

No response

Version

Latest

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Docker

Additional Context

No response

EvanDaley commented 1 year ago

Actually, after digging into it a bit more, it looks like the issue was because I was using the quickstart tutorial keto image and not the latest (oryd/keto:v0.7.0-alpha.1-sqlite vs v0.10.0-alpha.0).

aeneasr commented 1 year ago

https://github.com/ory/sdk/issues/243#issuecomment-1372171073