06-30-2014 05:54 PM
Hi,
I'm using the UnrestrictedSessionRunner class to try to WRITE_SECURITY permission before saving a Document(Task) to a user who is not in the Admin group , the runUnrestricted () method returns a new session without the information we need to grant permission. Here's an example
protected class WritePermission extends UnrestrictedSessionRunner {
protected WritePermission(CoreSession session) {
super(session);
// this.session = documentManager;
}
@Override
public void run() throws ClientException {
DocumentModel doc = getCurrentDocument();
ACP acp = null;
DocumentModel doc2 = session.getDocument(new PathRef(
doc.getPath().toString()));
try {
acp = doc2.getACP();
} catch (Exception e) {
}
if (acp == null) {
acp = new ACPImpl();
}
ACL acl = acp.getOrCreateACL();
int WorkspaceAdminACEIndex = acl.indexOf(new ACE(
session.getPrincipal().toString(),
SecurityConstants.WRITE_SECURITY, true));
if (WorkspaceAdminACEIndex == -1) {
ACE ace = new ACE(session.getPrincipal().toString(),
SecurityConstants.WRITE_SECURITY, true);
acl.add(0, ace);
acp.addACL(acl);
doc2.setACP(acp, true);
}
session.saveDocument(doc2);
session.save();
}
}
new WritePermission(documentManager).runUnrestricted(); // calling the runUnrestricted method.
How could grant permission to the user in this new session returned by runUnrestricted () method?
07-02-2014 08:36 AM
I don't understand the problem you have.
07-02-2014 12:55 PM
Hi,
07-08-2014 07:25 AM
Hello,
07-08-2014 11:09 AM
Hi Vladimir and Florent
08-13-2014 10:36 AM
This was just fixed and will be available in the next 5.8 hotfix (NXP-14939).
08-13-2014 10:48 AM
Hi, Thank You
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.