Hello,
I need to change permissions on all my nodes using a script. The setPermission function is working good like this :
<blockcode>
node.setPermission("permission", "GROUP_groupname");
</blockcode>
But i need to remove all the old permissions on all the nodes too, so before setting new permissions, i try to erase all the old ones thank to removePermission, without user or group parameter, as explained in the documentation :
<blockcode>
node.removePermission("permission");
</blockcode>
But it's not working. I used another method which is working good :
<blockcode>
var permissions = ["Collaborator", "Contributor", "Consumer", "Editor", "Coordinator", "Read"];
var groups = ["GROUP_groupe1", "GROUP_groupe2", "GROUP_groupe3", "GROUP_groupe4", "GROUP_groupe5"];
for(var z= 0; z < permissions.length; z++)
{
for(var w= 0; w < groups.length; w++)
{
node.removePermission(permissions[z],groups[w]);
}
}
</blockcode>
But i need to understand. I think i miss understood this function. For me, using removePermission without precising a group or user, erase ALL the permission selected for all the users or groups in the selected node. Am I right ?
Does someone can explain to me please ?
Thank you
Anthony