joas8211 / payload-tenancy

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

Extending field names and visibility #7

Closed TatisLois closed 1 year ago

TatisLois commented 1 year ago

I had a simpler multi tenant application and so far this has been much more seamless, so thank you!

I had two questions though, let me know if it's possible to support.

I am using a custom collection as the tenant ex: tenantCollection: Business.slug and noticed that the field still says tenant instead of the business name. I was wondering if it was possible to extend the configuration so that the relationship here could use another label? Also making it read only unless you are a user from the parent tenant could be handy too

Screen Shot 2023-05-03 at 2 53 03 PM

Also is it possible to hide this field from the table view, when I visit it as an admin user or user from a parent tenant it shows up as undefined

Screen Shot 2023-05-03 at 2 47 31 PM

When I view it was a user of the tenant it says no parent

Screen Shot 2023-05-03 at 2 51 26 PM

hiding the column from this view would be great!

TatisLois commented 1 year ago

Again this is an awesome step up from trying to manage this myself with the various hooks, if there is no easy way to extend these option I can look into supporting through a PR as well :)

joas8211 commented 1 year ago

Yes, I'll make it easier to edit fields at least, also #6 would benefit that. Could it also be also good to have an option to specify the label for tenant in the options? You could say that tenant = "Organization" and it would change all the field labels.

About the user's tenant field, I think it it is important information to know in the table also. Maybe if tenant's user could access their own tenant as read-only... would that make sense?

TatisLois commented 1 year ago

@joas8211 editing fields would definitely help here but having it as part of the tenant options would make it just as easy too.

Alternatively if a user passes in a collection to be the tenant, I wonder if you could read the useAsTitle field and if it has a value then use that fields label. Not sure if that would work but could be a seamless way to support it

joas8211 commented 1 year ago

Following issues are split from this issue: #8, #10, #9. Closing this issue in favor of those split issues.