Jahia Dev Forum > JahiaAccessManager...

0 (0 Good)
0 (0 Bad)

JahiaAccessManager override

by  mxlab »  2015/06/03 14:08

I need to show a node only if the current user belong to all groups defined as reader for that node.

Ie.: given a node N (could be a jnt:page or a custom component), I set groups G1 and G2 as readers in live roles.

Now I want that N is shown only to users that belong to G1 and G2.

If a user belongs only to G1, G2 or neither of them then he can't see N.

How can I do this?

I think I could override JahiaAccessManager but I don't know how to do it.

Thanks!

 

 

  • JahiaAccessManager override
    2015/06/03 14:08

    mxlab <p>I need to show a node only if the current user belong to all groups defined as reader for that node.</p> <p>Ie.: given a node N (could be a jnt:page or a custom component), I set&nbsp;<span style="line-height: 20.7999992370605px;">groups G1 and G2 as readers&nbsp;</span>in&nbsp;live roles.</p> <p>Now I want that N is shown only to users that belong to G1 <strong>and</strong> G2.</p> <p>If a user belongs only to G1, G2 or neither of them then he can&#39;t see N.</p> <p>How can I do this?</p> <p>I think I could override&nbsp;JahiaAccessManager but I don&#39;t know how to do it.</p> <p>Thanks!</p> <p>&nbsp;</p> <p>&nbsp;</p>

  • Number of messages  33
    Registration date Jun 3, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: JahiaAccessManager override

    by  mxlab »  2015/06/08 08:16

    Please are any documentation about this topic? It is very important, thanks!
  • Re: JahiaAccessManager override
    2015/06/08 08:16

    mxlab Please are any documentation about this topic? It is very important, thanks!

  • Number of messages  33
    Registration date Jun 8, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: JahiaAccessManager override

    by  shyrkov »  2015/06/08 08:54

    Hello,

    there is no notion of "group intersection" in Digital Factory.

    If you would like to show content only when a user is member of both groups, you will have to create a special view for that content and add a check (for live mode only) in the view JSP, like:

    <c:if test="${user:memberOf('G1', renderContext) and user:memberOf('G2', renderContext)}">

    <template:module node="${currentNode}" view="default"/>

    </c:if>

    Kind regards

    Sergiy

  • Re: JahiaAccessManager override
    2015/06/08 08:54

    shyrkov <p>Hello,</p> <p>there is no notion of &quot;group intersection&quot; in Digital Factory.</p> <p>If you would like to show content only when a user is member of both groups, you will have to create a special view for that content and add a check (for live mode only) in the view JSP, like:</p> <p>&lt;c:if test=&quot;${user:memberOf(&#39;G1&#39;, renderContext) and <span style="line-height: 20.7999992370605px;">user:memberOf(&#39;G2&#39;, renderContext)</span>}&quot;&gt;</p> <p>&lt;template:module node=&quot;${currentNode}&quot; view=&quot;default&quot;/&gt;</p> <p>&lt;/c:if&gt;</p> <p>Kind regards</p> <p>Sergiy</p>

  • Number of messages  407
    Registration date Jun 8, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: Re: JahiaAccessManager override

    by  mxlab »  2015/06/08 10:08

    Hello,

    there is no notion of "group intersection" in Digital Factory.

    If you would like to show content only when a user is member of both groups, you will have to create a special view for that content and add a check (for live mode only) in the view JSP, like:

    <c:if test="${user:memberOf('G1', renderContext) and user:memberOf('G2', renderContext)}">

    <template:module node="${currentNode}" view="default"/>

    </c:if>

    Kind regards

    Sergiy

    Thanks for your answer!

    In my case, I assign the groups in the content, and then I must check dinamically that the user is in all that groups.

    How can I read the groups assigned to that content with the view, so then I can do the check you write before?

    Thanks!

     

  • Re: Re: JahiaAccessManager override
    2015/06/08 10:08

    mxlab <blockquote> <p>Hello,</p> <p>there is no notion of &quot;group intersection&quot; in Digital Factory.</p> <p>If you would like to show content only when a user is member of both groups, you will have to create a special view for that content and add a check (for live mode only) in the view JSP, like:</p> <p>&lt;c:if test=&quot;${user:memberOf(&#39;G1&#39;, renderContext) and <span style="line-height: 20.7999992370605px;">user:memberOf(&#39;G2&#39;, renderContext)</span>}&quot;&gt;</p> <p>&lt;template:module node=&quot;${currentNode}&quot; view=&quot;default&quot;/&gt;</p> <p>&lt;/c:if&gt;</p> <p>Kind regards</p> <p>Sergiy</p> </blockquote> <p>Thanks for your answer!</p> <p>In my case, I assign the groups in the content, and then I must check dinamically that the user is in all that groups.</p> <p>How can I read the groups assigned to that content with the view, so then I can do the check you write before?</p> <p>Thanks!</p> <p>&nbsp;</p>

  • Number of messages  33
    Registration date Jun 8, 2015
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page