cancel
Showing results for 
Search instead for 
Did you mean: 

remove Edit through removePermission()

e-no91
Champ in-the-making
Champ in-the-making
User B is set as contributor and uploads a document, I have set this script to fire if document is added to folder:


var creator = document.properties["cm:creator"];


document.setInheritsPermissions(false);
document.setPermission("Collaborator",creator);
document.removeAspect("fm:discussion");
document.removePermission("Delete",creator);
document.removePermission("Editor",creator);
document.removePermission("Write",creator);
document.removePermission("AddChildren",creator);
document.setInheritsPermissions(true);
document.setOwner("GROUP_ALFRESCO_ADMINISTRATORS");




But after passing through this code, User B is still able to Edit the file.
If I change

document.setPermission("Collaborator",creator);


to

document.setPermission("Contributor",creator);

or

document.setPermission("Consumer",creator);


the Edit permission can be removed through

document.removePermission("Write",creator);


I set User B as Collaborator because I want the user to be able to click the Share button.
How do I remove the Edit permission for Collaborator??
3 REPLIES 3

aaditvmajmudar
Confirmed Champ
Confirmed Champ
Have you saved the document after making all changes?

document.save(); ?

tonyrivet
Champ in-the-making
Champ in-the-making
If I understand well, you want your user to be able to use the quick share action but not to edit the document ?

Basically, that is not possible. As the share action adds a "shared" aspect on the shared node, you need to have the permission to edit it.
A workaround could be to extend the QuickShareService and execute the writing operations as admin, but you have to think about potential security issues…

e-no91
Champ in-the-making
Champ in-the-making
Oh. Thanks for the explanation!