AnsweredAssumed Answered

setPermission and setOwner cannot set together?

Question asked by e-no91 on May 19, 2014
Latest reply on May 21, 2014 by e-no91
I have a code that looks like this:


var creator = document.properties["cm:creator"];

document.setInheritsPermissions(false);
document.removePermission("FullControl","GROUP_SEKRETARIAT");
document.setPermission("Read",creator);
document.setPermission("Write",creator);
document.setPermission("Delete",creator);
document.setOwner("admin");



This rule is executed after user Contributor uploads a content.
I'd expect that the creator can Read, Write and Delete the content, and at the same time, admin has full control on the content, but it seems like all the codes set before setOwner is ignored.

I've tried to move the setOwner code after setInheritsPermission(false), but that gives me permission error.

Did I wrote my code in a wrong way?Thank you in advance!

Outcomes