09-17-2012 02:13 PM
Hello everybody,
I'm currently working for an IT project and I'd like to customize the visibility of my documents according to the document's State, using the User Groups
Here's my example :
I created a user group called "Developer" for all our developers
How can I do that ?
Thanks a lot, Julien
09-20-2012 01:01 PM
There is other way than Security Policy to implement this use case. Here, I assume your document is draft only after creation (certainly a simplification against your use case), but you will have the idea to implement if the document goes back to draft, I let you do it:
Create an eventHandler for creation Event :
And create a second eventHandler for the transition
I think that's all. This is not the best implementation, I will suggest for a production server with a large volume of data a security policy. But this is fine for small/medium project.
09-20-2012 09:16 AM
The best way is to use a Security Policy manage through Nuxeo IDE :
And finally in checkPermission method fill like the that:
public Access checkPermission(Document doc, ACP mergedAcp,
Principal principal, String permission,
String[] resolvedPermissions, String[] additionalPrincipals)
throws SecurityException {
NuxeoPrincipal nxPrincipal = (NuxeoPrincipal) principal;
boolean isReadWriteAccess = false
for (String permissionTmp : resolbedPermissions) {
if ("ReadWrite".equals(permissionTmp) {
isReadWriteAccess = true;
}
}
if (isReadWriteAccess && "Validated".equals(doc.getLifeCycleState() && nxPrincipal.isMemberOf("developer")) {
return Access.DENY;
}
... I think you understood the idea, implement your stuff...
return Access.UNKNOWN;
}
To not have bad response time and problems for paginations, you will have also to implement the query transformer (see interface the class implement).
That's it.
09-20-2012 10:20 AM
Super ! Merci, that's great
09-20-2012 12:31 PM
De rien vraiment, j'insiste
09-20-2012 12:53 PM
ok thanks ! I'm waiting for your answer just for Studio... I can't wait to have it ! ahah
09-20-2012 01:01 PM
There is other way than Security Policy to implement this use case. Here, I assume your document is draft only after creation (certainly a simplification against your use case), but you will have the idea to implement if the document goes back to draft, I let you do it:
Create an eventHandler for creation Event :
And create a second eventHandler for the transition
I think that's all. This is not the best implementation, I will suggest for a production server with a large volume of data a security policy. But this is fine for small/medium project.
09-20-2012 01:24 PM
OK that's going to help me a lot ! You should really do a bigger tutorial about EventHandler, I just discovered it and it seems to be very, very useful ! A tutorial which would explain how to "automatically rename the title depending on some other fields values", "inherit some metadata from other content"...
09-20-2012 01:27 PM
one last question
09-20-2012 02:01 PM
en gros je veux juste qu'à sa création, un document soit invisible aux développeurs, mais qu'il apparaisse automatiquement dès qu'il est validé...
09-20-2012 02:48 PM
Ok my mistake I read can instead cannot... I modify my answer to follow your question.
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.