You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now some authorization/permission related logic lives in the "frontend"/"web" part of the application.
It should be moved to the backend, maybe/probably into its own context Permissions or something similar. Theoretically every context can also provide functions to check its own permissions (as one context that depends on all others, is quite big) but permissions may often be cross cutting and in general an approach that centralizes these rules can often be good for the overview it provides.
This should also including scoping (i.e. taking a collection and scoping it down to the accessible records).
Why to the Backend?
The logic isn't entirely tied to the frontend/LiveView - if we had another way into the system, the logic would likely be the same
you should also never trust the FE as users can send whatever, so permissions should always be double checked on the backend side
generally speaking, the BE should also not depend on the FE, the FE should depend on the BE
at their core these are pure functions well suited for the BE
Where are the permissions now?
They might be more scattered but right now a lot of them live in idea live:
I don't think we need external libraries for that as our authorization logic is very very simple. I like the idea to move / extract the code in an own context though 👍
Right now some authorization/permission related logic lives in the "frontend"/"web" part of the application.
It should be moved to the backend, maybe/probably into its own context
Permissions
or something similar. Theoretically every context can also provide functions to check its own permissions (as one context that depends on all others, is quite big) but permissions may often be cross cutting and in general an approach that centralizes these rules can often be good for the overview it provides.This should also including scoping (i.e. taking a collection and scoping it down to the accessible records).
Why to the Backend?
Where are the permissions now?
They might be more scattered but right now a lot of them live in idea live:
mindwendel/lib/mindwendel_web/live/live_helpers.ex
Lines 6 to 21 in aaa88c0
Libraries
There's a ton of libraries out there right now and I'm not entirely sure which one is best. A lot of them use more DSLs than I like but 🤷
The text was updated successfully, but these errors were encountered: