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

Revert "backports changes back to feature-rebac (#1003)" #1030

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Aug 22, 2023

Description

Reverts #1003 the backport introduced a regression where we query Postgres for user access to models instead of OpenFGA. I think the best way forward is simply to revert the commit, which is all this PR does.

Fixes CSS-5254

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

@kian99 kian99 requested review from mina1460, alesstimec, ale8k and babakks and removed request for mina1460 and alesstimec August 22, 2023 09:01
@mina1460
Copy link
Contributor

I thought we will just change the call from the old method to the new method that we already had.

@kian99
Copy link
Contributor Author

kian99 commented Aug 22, 2023

I thought we will just change the call from the old method to the new method that we already had.

@mina1460 So I tried just changing the call, but the OpenFGA method for retrieving the list of models a user has access to only returns a list of UUID so I thought it would be better to just revert the entire commit. But thinking about it, maybe I should just grab all the models and then do things similar to the way it was before.

@kian99 kian99 force-pushed the CSS-5254-revert-cross-model-query-using-postgres branch from edc6952 to fb64886 Compare August 22, 2023 11:29
@kian99
Copy link
Contributor Author

kian99 commented Aug 22, 2023

@mina1460 I've switched it as I realised it's probably better to get all the models first, ptal

Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me reverting

@kian99
Copy link
Contributor Author

kian99 commented Aug 22, 2023

@ale8k sorry the original description is misleading, if you read the follow-up comments you'll see I discussed with Mina and changed it not to be a simple revert.

@mina1460
Copy link
Contributor

code looks good, but there are some failing tests

internal/db/model.go Outdated Show resolved Hide resolved
internal/db/model.go Outdated Show resolved Hide resolved
internal/db/model_test.go Show resolved Hide resolved
models[i] = m.Model_
// UUIDs are returned in the form "model:uuid"
for i, uuid := range modelUUIDs {
modelUUIDs[i] = strings.Split(uuid, ":")[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.Split bit assumes we will never change the format.. which might be ok.. also assumes there will be a : in the string..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we need a function that will split the tag type from the value in jaas tags...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to do this in a follow up PR, I believe we should be returning ofga entities from ofga related queries, not strings. Then we won't have this parsing problem.

@kian99 kian99 merged commit 8be3742 into canonical:feature-rebac Aug 23, 2023
@kian99 kian99 deleted the CSS-5254-revert-cross-model-query-using-postgres branch August 23, 2023 09:35
@kian99 kian99 mentioned this pull request Aug 23, 2023
3 tasks
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

Successfully merging this pull request may close these issues.

4 participants