Comments (6)
I have published update (v1.2.0) that adds support for globals. In fact globals are now tenant isolated by default, so take that into account when updating. More information can be found from readme.
from payload-tenancy.
What about the solution I proposed here: #payloadcms/payload/discussions/3268
- Create a globals collection with the same structure as your global
- Add a field to this collection for the scope (your domain, for example)
- Add in the global a new hook beforeChange
- In this hook store the values via the internal payload API to the globals collection (with scope)
- Add a new hook beforeRead or afterRead
- Fetch based on the scope the value from the globals collection and return the data within this hook
It does not seem hard to implement and users can use the singleton focused UI instead of having an extra step where only one item is in the collection.
from payload-tenancy.
Isolating globals per tenant is not supported because I haven't figured out how that could be accomplished. If you know a way it can be done, please tell and I will add support for it. Collections have been isolated using access rules that restrict actions to documents that have matching value in tenant field (hidden field added by the plugin). But globals seems to only have one document which is the global, so having a global document for each tenant wouldn't work logically.
Now that I'm writing this, I can think one way this could be maybe done. What if the plugin adds a collection for globals that cannot be accessed by any users. That collection holds data for all globals and correct document is returned when global is read or written to. I'll look into this if it's possible. How does that sound to you? Any comments?
from payload-tenancy.
Yes, that makes sense to me. Both the issue and your solution. I'm not too sure how that would work since I'm not too familiar with Payload integrations, unfortunately. If that's possible, I think it would be a great improvement. Thank you.
from payload-tenancy.
Now that I'm writing this, I can think one way this could be maybe done. What if the plugin adds a collection for globals that cannot be accessed by any users. That collection holds data for all globals and correct document is returned when global is read or written to. I'll look into this if it's possible. How does that sound to you? Any comments?
I think your idea makes sense. Having a 'globals' collection in which the data is set, and then have the global file act as some kind of middleware, mapping the request to the right doc in the collection.
But wouldn't this make the UI look different than regular globals? Showing a 'collection of globals' to the /admin user. If so, al alternative approach could be:
Auto-generating globals with slugs like 'globalname-tenantname' for each tenant. Then have the base 'globalname' map to the correct 'globalname-tenantname'.
from payload-tenancy.
@joas8211 Maybe something to include into this plugin? Looks very clean and easy payloadcms/payload#3268 (reply in thread)
from payload-tenancy.
Related Issues (20)
- User with same email on different tenants not possible HOT 1
- Payload 2.0 HOT 5
- Tenant isolation "path" strategy HOT 1
- 2.0: Invalid field error when trying to create additional tenant manually HOT 4
- 2.0: Globals can't be localized
- Official form builder plugin issue HOT 1
- GraphQl playground not working after configuring plugin HOT 2
- Cannot access REST APIs via Users API key HOT 1
- isolationStrategy: "domain" not working in local setup HOT 1
- how to set limit parameter to find more than 10 child tenants? HOT 1
- Access control questions HOT 1
- PostgreSQL support HOT 1
- Isolation stragery path prevents accessing the admin dashboard HOT 1
- Can't access any collections after installing HOT 1
- Payload 3.0? HOT 1
- npm install error
- Postgres Error: "invalid reference to FROM-clause entry for table" HOT 1
- Cannot update Global after creating HOT 1
- readOnly access doesn't work HOT 5
- Feature: Add multi-segment path support for tenant isolation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from payload-tenancy.