How to programatically add a policy to a resource?
I might be missing something here related to Spark, but how do I programatically add a policy? (e.g. using a Spark extension)
6 Replies
have tried something along the lines of:
as well
the strategy you're using is essentially the correct approach
but
Transformer.add_entity
for example is not used for nested entities, only for adding them to the DSL
Probably the best approach would be for us to implement a utility for this in Ash.Resource.Builder
, and there is inspiration there for handling nested entities
If you were interested, you could PR an add_policy
🙂
Just keep in mind, the order of policies actually matters.
if they have a bypass
on the resource, and your policy is added to the end, then the bypass will bypass your added policies.
But if you add your policy onto the beginning of the list, then your policy will trump the bypass 🙂we created our own little extension for this: https://github.com/traveltechdeluxe/ash-rbac
GitHub
GitHub - traveltechdeluxe/ash-rbac
Contribute to traveltechdeluxe/ash-rbac development by creating an account on GitHub.
🔥 🔥 🔥
🔥 🙂
@barnabasj Haha nice timing ❤️ 🔥