-
Notifications
You must be signed in to change notification settings - Fork 438
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
fix: remove non-existent colums in getMembershipFromQuery queries #7869
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@doncicuto I'm a bit on the fence on this, in my opinion the correct way to solve this would be a bit different, so that you query for the specific columns of the sub-tables. Would that not be solvable if you use for example
instead of
and then
so that you have all shared columns like
Does that make sense? |
Hi @stebenz, I've tried to fix the code with your suggestion. I've tried to run some manual tests against the API and all seems fine: I hope I've understood the suggestion correctly, and my apologies as I'll need a lot of time to understand how the backend works so thanks for your time. |
@doncicuto No problem at all. |
Sure @stebenz Just to confirm, as defined by proto file, you can only use one query method in getMembershipFromQuery so I'm not sure how could I add a test like that to user_membership_test.go to check that proto error is returned: Docs seem to imply that you can use several queries for project, org... but I don't know how can descriptions like "one of type use iam, org id, project id or project grant id" can be added to docs If you can give me a hint to implement those tests I'd appreciate it |
@doncicuto The query would be like so:
Unfortunately, the docs are wrongly generated, but that was already in issue #5352. |
I see @stebenz, but my doubt was that the grpc definition for MembershipQuery says that it uses oneof and therefore if I try to use several queries (one OrgQuery and one ProjectQuery) as the example you propose I get an error from GRPC specifying that I can't use more than one query
In summary you wanted me to test combined queries like projectID and orgID but I don't know how I can test that if GRPC says that I can't use combined queries due to the oneof specification Thanks @stebenz |
@doncicuto Maybe the PR #8002 I just created helps. |
Hm, but the queries are a repeated list on the request:
The idea here is that you can have a list of query parameters, where each one is a oneof so that you only can query with specific types. |
Ok I think I understand you but I don't explain myself so I feel a little dumb here. My point, you want me to try a test like this:
But if I execute that query against my code I get a GRPC error parsing the query not accepting it, and that error I assume is because the GRPC doesn't like that I include more than one query type and that error is not part of my code. As always I don't want to waste your time so if you prefer it I can close this PR as I don't know how I can fix that GRPC error to fullfil your requirements. Thanks! |
The screenshot you sent here, should that contain the example I provided?
And not use different objects in the array:
|
Thanks @stebenz, it's clear that I'm dumb enough |
In issue #7841 @mahmoodfathy commented an issue when the API call for Listing My ZITADEL Manager Roles is called with any kind of query (orgQuery, projectQuery, projectGrantQuery...). A column XXXXXX does not exist (SQLSTATE 42703) error is thrown.
The issue was focused in getMembershipFromQuery where filtering queries functions are called: prepareOrgMember, prepareIAMMember, prepareProjectMember and prepareProjectGrantMember
Those functions allow queries for columns that are not members of the table to be queried so I've added a conditional clause to avoid using the queries that cannot be called.
For example, for prepareOrgMember, member.id, member.project_id and member.grant_id columns are not added to the filter queries
Here I show one screenshot where the error "column XXXXXX does not exist (SQLSTATE 42703)" is no longer thrown using an orgQuery.
Should close #7841
Definition of Ready