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

Add support for nil in schema #494

Merged
merged 1 commit into from
Mar 23, 2022
Merged

Add support for nil in schema #494

merged 1 commit into from
Mar 23, 2022

Conversation

josephschorr
Copy link
Member

A nil expression under a permission is considered an empty set, and returns no permission

@github-actions github-actions bot added area/api v0 Affects the v0 API area/schema Affects the Schema Language area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Mar 22, 2022
Copy link
Member

@jakedt jakedt left a comment

Choose a reason for hiding this comment

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

do we need to make it something that's not a valid relation/permission name? Do we need to audit existing schemas for nil? What happens if I attempt to define a relation named nil?

case *core.SetOperation_Child_XNil:
requests = append(requests, notMember())
default:
return checkError(errors.New("unknown set operation child in check"))
Copy link
Member

Choose a reason for hiding this comment

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

Can you get the operation name in the error somehow? All errors should have some data that helps debug it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I wasn't sure what to print out before, but %T seems to provide sufficient info without being too verbose

@@ -127,12 +127,20 @@ func setOperation(firstChild *core.SetOperation_Child, rest []*core.SetOperation
}

// This creates a child for a set operation that references only direct usersets with the parent relation.
// DEPRECATED
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to a TODO to remove, otherwise it breaks lint

A `nil` expression under a permission is considered an empty set, and returns no permission
@jakedt jakedt merged commit f4f8147 into authzed:main Mar 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2022
@josephschorr josephschorr deleted the nil branch April 3, 2022 13:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/api v0 Affects the v0 API area/schema Affects the Schema Language area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants