-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tenancy for all objects in model, except for specific conditions #291
Comments
I don't believe it's possible to do something like this now. There was some work here #86, but again I don't think it's possible now to share objects between tenants. |
Thanks @pruzicka – that definitely points me in the right direction. My platform allows users to see only their own posts, but I wanted to add the ability for the admins to create "shared posts" that everyone can see but not edit. |
Well I would use it as well. I have libraries that are owned by tenants yet I would like to have "shared" library that each tenant could use. One option would be to always create copy for each tenant but that is "brute force" way, not smart at all. If I remember there was an option to have "nil" in tenant_id field, that record would be "shared" record. But it doesn't work anymore |
That sounds very much like my use case – I was thinking of adding a "global" setting, so that it requires a little more confirmation on the admin side. Could be a bad situation if a post were to accidentally have a "nil" tenant to suddenly be viewable by everyone. Something like: "is_global" would be a customizable column with a boolean value - if true, then the object is shared for all users. Then you can use something like pundit to allow users to view these "global" posts but not edit/delete them. I'm hoping to use these objects as templates and allow users to "clone" and edit them without having to start a new post from scratch. Would that work for your libraries? |
Yes, that would be perfect. so some records would be visible to everyone, or better say could be visibile for everyone. first would be |
I have a model called
Post
. Posts require tenancy and are only accessible by their owners.However - if a Post is set to "global" (or created by a site admin), it will be accessible by everyone.
acts_as_tenant :account, has_global_records: true
In my controller:
@post = Post.find(params[:id])
The text was updated successfully, but these errors were encountered: