cancel
Showing results for 
Search instead for 
Did you mean: 

Document having permission error

e-no91
Champ in-the-making
Champ in-the-making
I have user A as contributor in Folder X.
And I have user A as consumer and Admin as site-manager in Folder Y.

User A uploads a file, and I will execute script by rule:

document.setPermission("SiteManager","Admin");
document.move(companyhome.childByNamePath("Sites/test/documentLibrary/a"));


What I expected is that the document can be moved to folder Y as currently it is controlled by Admin.
But what I get is 'You do not have the appropriate permissions to perform this operation.' error.

From what I understand, setPermission function that I set means that the document now is passed to Admin, as a Site Manager, and now is able to move to the destination file.

If I understnad it wrongly, how do I achieve my expectation? Thanks in advance!

ADDITIONAL: I didn't add user A as consumer for folder Y at first, and I get Destination Node is Mandatory error. After I add user A as consumer, the error is gone. Its the same as runas admin error, which makes me believe that admin is 'holding' the document now.

2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator
Before you added user A as consumer on folder Y.
User A might don't even have read permission on Y ,so it is as if folder Y dose not exist to user A .so you got the "Destination Node is Mandatory error"


After you added user A as consumer on folder Y
You are using user A to upload a file to Folder X and user A is a contributor,But neither of the following two lines will execute successfully

document.setPermission("SiteManager","Admin");
document.move(companyhome.childByNamePath("Sites/test/documentLibrary/a"));

The reason is :
1.setPermission requires that the current authentication has "ChangePermissions" permission .User A is a contributor which dosen't have "ChangePermissions" permission.
2.move method requires  the current authentication has the permission to delete the node in the source folder and create it in the destination folder.User A is a contributor on Folder X which dosen't have delete permission and he is a consumer on Folder Y which dosen't alos have create permission.


Technically if you run your script as admin ,it will execute successfully. Could you paste your code that runas admin? I gusess there is something wrong in your code.

As  "admin is holding the document now",I don't think it will happen.

e-no91
Champ in-the-making
Champ in-the-making
Thank you so much for the explanation!
I haven't done the runas admin code, I just found out about this code and trying it out.
http://tpeelen.wordpress.com/2011/04/29/sudo-for-scripts-in-alfresco/
According to the site, where do I actually put the sudoScript.java file?
Or maybe there is another easier way?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.