cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for easy way to mark content read-only

davidpisaac
Champ in-the-making
Champ in-the-making
Hello-

Does anyone know a simple way to mark content read-only that would override read/write permissions?  It looks like I must break permission inheritance, copy the authorities down, and give them access with a different permission set.  I was hoping for something simpler.
5 REPLIES 5

kevinr
Star Contributor
Star Contributor
There's not really any mechanism that is simpler. If it's web-client specific then you could add a UI evaluator to hide the action etc. but it's still some work.

Thanks,

Kevin

davidpisaac
Champ in-the-making
Champ in-the-making
Thanks Kevin.  What about using the LockService, lockable aspect, or jcr:lockisdeep? 

Is there any documentation on the lockable aspect, especially the effects on repository operations?  I can't find it, unless I assume it is tied directly to the LockService, and even then I don't know the effect of differen lock types.

I'm not afraid of code as documentation, so don't hesitate to point me there if needed.

alarocca
Champ in-the-making
Champ in-the-making
It's curious that if you open a document (better if a ms office document) via webdav, that file is locked and the lock is showed by the web client too. I guess this mechanism is based on the lockable aspect. Unfortunately it seems that it was implemented just for WCM and webdav. CIFS (avmfilesystem) does not lock by default but can do it.

See http://wiki.alfresco.com/wiki/Content_Locking

Thanks Kevin.  What about using the LockService, lockable aspect, or jcr:lockisdeep? 

Is there any documentation on the lockable aspect, especially the effects on repository operations?  I can't find it, unless I assume it is tied directly to the LockService, and even then I don't know the effect of differen lock types.

I'm not afraid of code as documentation, so don't hesitate to point me there if needed.

davidpisaac
Champ in-the-making
Champ in-the-making
For those interested in this topic, I read that permissions on a child override permissions inherited from a parent.  So, you should be able to put a DENY-Write-EVERYONE on the child to make it (and everything inherited from there down) read only.  I haven't tried it yet, since DENY is not available from the UI or JavaScript.  Feel free to try and post here if you get to it first.

cbosdonnat
Champ in-the-making
Champ in-the-making
For those interested in this topic, I read that permissions on a child override permissions inherited from a parent.  So, you should be able to put a DENY-Write-EVERYONE on the child to make it (and everything inherited from there down) read only.  I haven't tried it yet, since DENY is not available from the UI or JavaScript.  Feel free to try and post here if you get to it first.

You can do this quite easily with a custom aspect. Let's say this aspect is named my:readonly. You can add some behaviour on an aspect addition or removal by using Behaviour policies. You have an example of an aspect with behaviour policies in the SDK examples: CustomAspect. The example aspect is counting the number of click on a document with this aspect.

In your casee, the my:readonly aspect will need to register the following policies:
  • OnRemoveAspectPolicy : remove the denied permission on the node

  • OnAddAspectPolicy : add the denied permission on the node
To add and remove the permission, you'll need to use the foundation services, more precisely the PermissionService.

Then setting your document read-only is as easy as apply your  my:readonly aspect, which could be done using the webclient or javascript.

I hope this helps