Skip to content

authz types could be more type-safe - #895

Merged
davepacheco merged 16 commits into
mainfrom
authz-types
Apr 11, 2022
Merged

davepacheco merged 16 commits into
mainfrom
authz-types

Conversation

@davepacheco

@davepacheco davepacheco commented Apr 8, 2022 •

Copy link
Copy Markdown
Collaborator

This draft addresses #848. It still needs more cleanup but I think it's close to ready for review.

@davepacheco
davepacheco requested a review from plotnick April 9, 2022 02:52
@davepacheco
davepacheco marked this pull request as ready for review April 11, 2022 18:22

@jmpesp jmpesp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks very cool, and I approve, FWIW :) One thought below:

authz_resource! {
name = "Role",
parent = "Fleet",
primary_key = (String, String),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's too bad this couldn't be tied closer to what's in schema.rs, if something like

primary_key = db::schema::role_builtin::dsl::primary_key_type()

was possible, though even that statement is problematic because it'd probably return sql_types::Text instead of String.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, that'd be a nice avenue for follow-up cleanup, if we can figure out how to do it.

@plotnick plotnick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is an unambiguous improvement over the previous API. As discussed in a call, it would be nice if we could use subtyping to eliminate the need for the individually generated Polar snippets, but we'd have to hack Polar a bit for that to work, so can be taken as a follow-up.

@davepacheco
davepacheco merged commit 03e9e90 into main Apr 11, 2022
@davepacheco
davepacheco deleted the authz-types branch April 11, 2022 23:05
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.

3 participants