Use of node.setPermission

sanketgosavi
Champ in-the-making
Champ in-the-making
I have written the code
node.setPermission("AdminRole", user);

in java backed webscript


When i logged in as admin the above code executes fine.

But it fails for non-admin users with exception : Access Denied.  You do not have the appropriate permissions to perform this operation.

How I can make it possible for non admin user.


Suggest !
2 REPLIES 2

mlagneaux
Champ on-the-rise
Champ on-the-rise
To execute this code, the authenticated user needs to have ChangePermissions permission.
You can use an AuthenticationUtil.runAs with system user to solve your problem. You can find examples in the source code of Alfresco.

AuthenticationUtil.runAs will work for java only.

I want the solution in javascript.
Is there any way by which i can use AuthenticationUtil.runAsSystem in javascript ?

Thanks !