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

migration to sea_orm + polar rules rework + endpoint logic rework #3

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

fairingrey
Copy link
Member

@fairingrey fairingrey commented Feb 16, 2022

This is a bit raw and dirty, but feels more 'idiomatic' and rustic.

About why UserFilter isn't a polar class is probably because it would limit policy flexibility -- in that while it is possible to construct new Rust polarclass structs within polar and then query for those structs via the rules that match, it would make it difficult to resolve queries where multiple rules can match (and thus there would need to be some sort of merge resolution/logic).

This approach, where allow_field rules are kept but HashSet<String> types can be converted into some pattern of EntityOptional by way of an EntityFilter is probably fine for now. I do feel as if there might be a few ways to macro the repetitive logic, but otherwise it's not a huge deal. More importantly the endpoint logic is a lot more sane and readable.

@fairingrey
Copy link
Member Author

Related to #4

Copy link

@k-cross k-cross left a comment

Choose a reason for hiding this comment

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

sorry i can't be more helpful, i don't really have the full context, keep it up!

src/models/user.rs Outdated Show resolved Hide resolved
src/models/mod.rs Outdated Show resolved Hide resolved
@fairingrey fairingrey marked this pull request as draft February 18, 2022 06:15
@fairingrey
Copy link
Member Author

fairingrey commented Feb 18, 2022

What's left to do is to essentially migrate the rest of the sqlx code to sea_orm calls, clean up any leftover bits of logic (in particular with the polar policy files), and then we can finally get started on cracking at the frontend.

And yeah, this PR will be rebased since my commit history is obviously dirty here (albeit it doesn't really matter that much)

@fairingrey fairingrey marked this pull request as ready for review February 19, 2022 00:01
move entities
rework polar rules
buncha other changes

rework rules and endpoint logic

fix role assn

remove unused imports

fix oso query, result might be error

update deps

super thicc diff
too many changes to document, but basically reworking to use SeaORM
WIP

dumb mistake

WIP

bloop

don't actually need the extra ref

more WIP

don't program when tired

seriously, DONT PROGRAM WHEN TIRED

fix

remove custom-derive, use fieldfilter

WIP

adjust rules to work with new pclasses

impl update_user handler

finish user handlers rewrite

finish rework

whoops
@fairingrey fairingrey changed the title Polar rule + endpoint logic rework migration to sea_orm + polar rules rework + endpoint logic rework Feb 19, 2022
@fairingrey fairingrey merged commit ee52183 into master Feb 19, 2022
@fairingrey fairingrey deleted the new-polar branch February 19, 2022 00:06
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.

2 participants