Add multiple navigation trees with filters based on user property (5.6)

Hi,

My goal is to add 3 navigations trees with exactly the same features as the default one, but with an advanced filtering specific to each one. The filter has to accept document only if the currentUser property 'p1' is equals to the document property 'p2'.

I know it is possible to add a post-query filter on the treeManagerPlugin extension, but how could I retrieve the current user in that filter ? Maybe the way of thiking is incorrect, but the only way I see is to create my own TreeActions implementation (where I can get the current principal) and my own DocumentTreeNode. Doing that way, I am able to do the filtering directly in the DocumentTreeNode implementation, but it seems a bad way to me.

Is there an other way of doing that filtering that would stay closer to the Nuxeo “philosophy” ?

Thank you

0 votes

1 answers

531 views

ANSWER



Got it ! I had forgotten that it was possible to retrieve the CoreSession directly from the DocumentModel using doc.getCoreSession() method. Then I was able to get the current principal using session.getPrincipal(). So in the end I was able to use the Filter class property in the treeManagerPlugin extension.

0 votes