joas8211 / payload-tenancy

Multi-tenancy plugin for Payload CMS
MIT License
122 stars 6 forks source link

Tenant parent / child access control #5

Closed TatisLois closed 1 year ago

TatisLois commented 1 year ago

I was wondering if this was supported by default, behind an option or if possible to solve through writing custom hooks for access control.

I have three collections (Users, Media, Businesses)

My admin user is related to main business tenancy (let's call it A) A user joins under a new business, as a child to my base tenancy (let's call that tenancy B) User of tenancy B adds a image to the media file My admin user associated to the base tenancy (A) can't see that image in the media collection

is that suppose to happen? Because when I go into the User and Business collections I can see all the child tenant data

Thank you for any clarification 🙏🏽

TatisLois commented 1 year ago

It's also using the default strategy if thats helpful

TatisLois commented 1 year ago

Actually I see from this comment Users above in tenant hierarchy can login to tenants below and access resource collections that way that the best way is to create a temporary user and log into that tenant to see those resources, right?

TatisLois commented 1 year ago

Okay it does work if I switch to the path strategy and am logged in as the account of the parent tenant, then I can visit the URL of the child tenant and see all the content. Sweet!