|
|
|
|
|
by bryantgillespie
487 days ago
|
|
You can certainly add whatever logic you want / need using custom hooks in Directus. Here's the docs for custom hooks.
https://directus.io/docs/guides/extensions/api-extensions/ho... But honestly, depending on the complexity of your logic you may not even need custom hooks. You can get really granular with the built-in access policies and permissions. As long as you have relationships configured with the user collection you can reference those in your permissions. Here's an example rule for accessing items within a `projects` table that hides any projects that don't belong to the current agency partner. {"_and":[{"partner":{"id":{"_eq":"$CURRENT_USER.agency_partner_id.id"}}}]} Each project a many to one relationship to agency_partners.
Each user has a many to one relationship to agency_partners. You can even scope this down to allow / hide specific fields if you want. |
|