How to create read-only access to certain objects for certain users only
This How-to applies to: Any version.
I copied this extremely useful How To from the Computer & Society website of the Technical University of Berlin, you can find the original post @ http://ig.cs.tu-berlin.de/forschung/plone/create-readonly-objects
The Problem
We have a couple of files that we are not allowed to make accessible for the world just for our students. At the same time it would obviously be silly to make them own the objects in questions lest they will delete or publish them.
Research
We found a good hint in the right direction on tomster.org which does however contain an ugly ZMI part that is inherent to the solution advanced. Luckily we had been confronted with the portal_workflow thingy in Plone before so we merged the knowledge at hand and created the fine solution set out below.
Our nice Solution
There are three steps to take to get it right. Read it to the end it won't do no harm to your objectives:
- Go to the ZMI root and access the
Securitytab. At the very bottom of the page you can adduser defined rolesto the ones already available. Add a roleReadOnly(or choose any other appropriate name you fancy, say "ReadAccess" or whatever). - Next, go to the
portal_workflowsection of your portal's ZMI.- Hit the
Contentstab and go toplone_workflowwhich should be the default workflow applicable for most Plone objects including files, documents, etc. Now hit theStatestab and click on theprivatestate to edit it. - Just in cae you're confused the breadcrumb should now read something like that: Workflow State at /Plone/portal_workflow/plone_workflow/states/private.
- Now it's getting hot. Hit the
Permissionstab. There will be aReadOnlycolumn and you will want to tickReadOnlypermissions forAccess contents informationandView. - The result of this is that people with a
ReadOnlyrole for a specific object may view it even though it is in theprivatestate which is exactly what we wanted to accomplish, isn't it?
- Hit the
- The only thing now that's left doing is sharing the items in
question with the due members or groups. To this end go back to your
Plone portal and go to the object in question.
- Hit the
Sharingtab and share it with the people you want to share it with assigning to them theReadOnlyrole. That will do. Now they can view the object but importantly not fool around with it. - You might have to change the status of the object from
privatetovisibleand back toprivatefor the changes in theportal_workflowto take effect.
- Hit the
Pitfalls
If you have your object in a private folder that is not shared with
the people in question they will not be able to access the object even
though they have a ReadOnly role for the object. In this
case you'll have to either make the folder visible or share it with the
relevant people. You might have to make the due amendments to the folder_workflow. See below.
Read Access for Folders for Certain Users
If you want to share folders with a group of people giving them
read access only you will have to repeat the steps detailed above for
the folder_workflow. Thereafter you may share folders with others assigning the ReadOnly role to them.