sciapp / sampledb

Sample and Measurement Metadata Database
https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/
MIT License
21 stars 11 forks source link

How to set default permission for object created by specific action? #53

Open link89 opened 1 year ago

link89 commented 1 year ago

Hi, I have a question about permission of object.

I have create a create sample anction named Substance, and I hope that all samples created by this action should be able to read by everyone, or at least of a specific group. Is there an option to make it? Thank you.

FlorianRhiem commented 1 year ago

Hey @link89,

not really, each user controls the permissions for their objects, so when an object is created, the creating user's default permissions are applied (or they can chose to instead give permissions to a group they are a member of or copy the permissions from an existing object). There are a few possible workarounds:

link89 commented 1 year ago

I see. I think that would be a popular scenario to allow object created by specific actions to be public. For example, the reason we create a Substance action is to maintain a table of all kinds of substances, which includes their name, formula, CAS number, etc, so that other object can just reference them. It would be great to allow such objects to be public by default.

FlorianRhiem commented 1 year ago

I can see why this would be useful for such a use case. I think something like this might be useful as an additional option for the initial permissions settings when creating an object (so that users can disable it if they want, but it'd be checked by default for actions with this setting), but as the permissions system is rather complex and this feature would need to be intuitively understandable for users, I'll have to see how to best implement this. Until then, I suggest you use one of the workarounds.

FlorianRhiem commented 1 year ago

If you use the current development version (e.g. by using the sciapp/sampledb:develop Docker image), there is a new checkbox when creating an object, that will grant read permissions to all signed-in users in addition to the default permissions:

image

Also, there is now a checkbox when creating or editing actions, which allows you to set the default for that checkbox:

image

So if you check that box for your action, all signed-in users will get read permissions by default for objects created with that action.