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

Remove v2 + query for relation types #58

Merged
merged 6 commits into from
Oct 29, 2024
Merged

Remove v2 + query for relation types #58

merged 6 commits into from
Oct 29, 2024

Conversation

ronenh
Copy link
Contributor

@ronenh ronenh commented Oct 29, 2024

In addition to removing utilities that support the v2 directory, this PR adds a new Cache.AssignableRelations() function that searches the model for relation types that can exist between an object type and a subject type (optionally with subject relations).

For example:

# Get relation types that can have a 'group' as the object and a 'user' as subject.
cache.AssignableRelations("group", "user")  )  # returns ["member"]

# Get relation types that can have 'tenant' as the object and `machine_account#user` as the subject.
cache.AssignableRelations("tenant", "machine_account", "user")  # returns ["decision-log-reader", 
                                                                #          "directory-client-reader", ...]

It can be used to query the model for relations that may exists between
an object and a subject.
@coveralls
Copy link

coveralls commented Oct 29, 2024

Pull Request Test Coverage Report for Build 11577520789

Details

  • 21 of 34 (61.76%) changed or added relevant lines in 2 files are covered.
  • 36 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+5.1%) to 65.92%

Changes Missing Coverage Covered Lines Changed/Added Lines %
paging/slice.go 0 2 0.0%
cache/cache.go 21 32 65.63%
Files with Coverage Reduction New Missed Lines %
paging/cursor.go 13 0.0%
paging/slice.go 23 0.0%
Totals Coverage Status
Change from base Build 11001328867: 5.1%
Covered Lines: 2559
Relevant Lines: 3882

💛 - Coveralls

@ronenh ronenh requested review from gertd and florindragos October 29, 2024 15:14
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
gertd
gertd previously approved these changes Oct 29, 2024
Copy link
Member

@gertd gertd left a comment

Choose a reason for hiding this comment

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

See note about using golang 1.23 to compile and the associated bump of the linter to 1.61.0

florindragos
florindragos previously approved these changes Oct 29, 2024
@ronenh ronenh dismissed stale reviews from florindragos and gertd via 0508a05 October 29, 2024 15:46
@ronenh ronenh requested a review from gertd October 29, 2024 15:49
@ronenh ronenh merged commit ff93a1d into main Oct 29, 2024
2 checks passed
@ronenh ronenh deleted the cache-query branch October 29, 2024 16:17
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