cancel
Showing results for 
Search instead for 
Did you mean: 

Site Library files permissions

cm_junior
Champ in-the-making
Champ in-the-making
Hi there!

I'm trying to use alfresco to control an internal evaluation of files in my company, where the users post their files in a folder, the same folder for all, and a project owner evaluate the file and approve or reprove them.

What I'm need is to define the permissions to any files only for the owner, who first posted the file and the manager, the other users, or groups, doesn´t need to see the files from each other.

I´m using alfresco 4.2 community.

Is there a way to do this?

Thanks!
3 REPLIES 3

mlagneaux
Champ on-the-rise
Champ on-the-rise
Hello,

I think that you can do that with a content rule and a Javascript script :
- create a content rule on your folder that triggers the execution of your script when a document is created
- in your Javascript script, you can manage your permissions on the created node thanks to the Javascript API (https://wiki.alfresco.com/wiki/4.0_JavaScript_API#Permission_and_Security_API)
Your script has to be uploaded to /Data dictionary/Scripts folder.

Hope this help.

cm_junior
Champ in-the-making
Champ in-the-making
Thanks for the help.

It worked, to set permissions. But I´m still having a problem, the permission to the owner is fine, but the other group can´t see the files.
The script file is below:


document.setInheritsPermissions(false);
      
document.setPermission("Editor",document.getOwner());
document.setPermission("Editor","GROUP_managers");
 
var permissions = document.permissions;
var result = "";
for (var i=0; i<permissions.length; i++)
{
   result += permissions + "<br>";
}

document.properties.description = result; // Just for debug reasons ;)
document.save();


The problem is that the file are hidden for managers on GROUP_managers

Am I doing something wrong?

mlagneaux
Champ on-the-rise
Champ on-the-rise
Hi,

You don't have to set Editor permission to the owner of your node since the owner of a node already has all permissions on that specific node.
Except that, your script seems to be good. Could you check that GROUP_managers really has Editor permissions on your node after execution of your script.