Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use the attributes from the gRPC Response #121

Open
abhaybhargav opened this issue Jan 27, 2024 · 3 comments
Open

Unable to use the attributes from the gRPC Response #121

abhaybhargav opened this issue Jan 27, 2024 · 3 comments

Comments

@abhaybhargav
Copy link

abhaybhargav commented Jan 27, 2024

Hi there, I am trying to use this with the spicedb serverless product.

I am able to create policies, etc. but when I try to run a CheckPermissionsRequest (which I know works), it doesnt allow me to access the permissionship attribute, as indicated in your examples. What am I possibly doing wrong?

resp = client.CheckPermission(
    CheckPermissionRequest(
        resource=company_ref,
        permission="administrator",
        subject=blah,
    ),
)

print(resp.permissionship)
@jtfidje
Copy link

jtfidje commented Feb 29, 2024

Hitting the same issue:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[36], line 1
----> 1 resp.permissionship

AttributeError: 'UnaryUnaryCall' object has no attribute 'permissionship'

@vroldanbet
Copy link
Contributor

vroldanbet commented Feb 29, 2024

@abhaybhargav do any of those examples help? What version of the SDK are you using? Python version?

def test_check(client):
# Write a basic schema.
write_test_schema(client)
beatrice, emilia, post_one, post_two = write_test_tuples(client)
# Issue some checks.
resp = client.CheckPermission(
CheckPermissionRequest(
resource=post_one,
permission="view",
subject=emilia,
consistency=Consistency(fully_consistent=True),
)
)
assert resp.permissionship == CheckPermissionResponse.PERMISSIONSHIP_HAS_PERMISSION
resp = client.CheckPermission(
CheckPermissionRequest(
resource=post_one,
permission="write",
subject=emilia,
consistency=Consistency(fully_consistent=True),
)
)
assert resp.permissionship == CheckPermissionResponse.PERMISSIONSHIP_HAS_PERMISSION
resp = client.CheckPermission(
CheckPermissionRequest(
resource=post_one,
permission="view",
subject=beatrice,
consistency=Consistency(fully_consistent=True),
)
)
assert resp.permissionship == CheckPermissionResponse.PERMISSIONSHIP_HAS_PERMISSION
resp = client.CheckPermission(
CheckPermissionRequest(
resource=post_one,
permission="write",
subject=beatrice,
consistency=Consistency(fully_consistent=True),
)
)
assert resp.permissionship == CheckPermissionResponse.PERMISSIONSHIP_NO_PERMISSION

@jtfidje
Copy link

jtfidje commented Feb 29, 2024

I've done some digging and it appears that the issue may be related to the grpcio version. After checking out the poetry.lock file from the repository and reinstalling the dependencies, several packages were downgraded, including grpcio from 1.62.0 to 1.59.0.

Here is a list of downgrades that occurred:

  • Downgrading pyasn1 (0.5.1 -> 0.5.0)
  • Downgrading cachetools (5.3.3 -> 5.3.1)
  • Downgrading certifi (2024.2.2 -> 2023.7.22)
  • Downgrading charset-normalizer (3.3.2 -> 3.3.0)
  • Downgrading idna (3.6 -> 3.4)
  • Downgrading urllib3 (2.2.1 -> 2.0.7)
  • Downgrading appier (1.32.0 -> 1.31.4)
  • Downgrading google-auth (2.28.1 -> 2.23.3)
  • Downgrading googleapis-common-protos (1.62.0 -> 1.61.0)
  • Downgrading google-api-core (2.17.1 -> 2.15.0)
  • Downgrading grpcio (1.62.0 -> 1.59.0)

This may just be a coincidence. I'll try to create an environment where I can consistently reproduce the error and post here afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants