cancel
Showing results for 
Search instead for 
Did you mean: 

add permission to a node in javascript

chys
Champ in-the-making
Champ in-the-making
I want to create a file in a node using javascript,but I haven't permission.How
to set permission or get admin's privilege temporarily in javascript?
  I set as follows:

company.children[4].setPermission("CreateChildren");

  but it doesn't work.Who can give me some suggestion?Thank you in advance!
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
You cannot simply set permissions whenever and however you want - that would make them pointless. The user setting the permissions actually requires the WRITE_PERMISSIONS permission - it may sound strange but it makes sense. That permission is available to admin and users with Coordinator role on the node - also to users who are OWNERs of the node. You need to get the admin user to execute the script or get an admin/coordinator user to grant the required permissions.

Thanks,

Kevin

chys
Champ in-the-making
Champ in-the-making
First thank you for you reply!But you suggestion still can't slove my problem.
I draw my work here:

   1 submit form using webscript
   2 read the content of form  and write it to a file
   3 the file is created in a space which auto execute a script to initialize a serial review workflow.

   So the person submitting form should have write permission in the space,but he don't have read permission.I create a role  in the permissionDefinitions.xml,but it doesn't work.The follow is the part of my configuration:
    <permissionGroup name="Writer" allowFullControl="false" expose="true" >
        <includePermissionGroup permissionGroup="AddChildren" type="sys:base"/>          
      </permissionGroup>

Do you have other suggestion? Thank you!