Subscribe: RSS
  • Hello,
    Is it possible in Revo to allow resources to the (anonymous) users only ?

    Because my current menu looks like this :
    <nav>
        <ul>
    
            [[!Wayfinder]]
    
            <!-- show login and register links if NOT logged only  -->
            [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`loginchunk`]]
            [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`registerchunk`]]
    
            <!-- show logout link if logged only  -->
            [[If? &operator=`NEQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`logoutchunk`]]
    
        </ul>     
    </nav>
    


    For the moment I hide some resources of the menu with the If snippet when the user is logged. Eg : the "register" and "login" page must hide when already logged.

    I would like to use wayfinder only, instead of several following [[If]].


    thanks for any support


    EDIT : of course I’ve made a search through the forum and attempted many kinds of things before asking here, like creating a "Anonymous" resource group and link it to the (anonymous) in "Access control".
    • That last method you mentioned should work. Did you flush permissions and the cache and then check in another browser where you’re not logged in to the manager?

      If that doesn’t work (though I haven’t tried it), I think it would be simpler to just have one "if" and show the logged in users the same menu but with some docs excluded with &excludeDocs.

        MODX info for everyone: http://bobsguides.com/MODx.html
      • Like Bob said,
        [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`loginchunk`]]


        will work.

        As for integrating with Wayfinder, well...hrm. I don’t know if that’s possible. Jason may chime in later and say it is, but to as far as I know, I’m not sure how.
          shaun mccormick | modx director and chief engineer of cloud, modx foundation, modx revolution core co-lead | modx cloud | modx revolution | bugtracker | official docs | modx@github | api docs | splittingred.com
        • thank you BobRay it worked finally, only after cleaning the cache manually.
          • Glad it worked. smiley

            For the benefit of others, are you saying that putting it in a resource group and linking that group with the (anonymous) user group by creating a Resource Group Access ACL entry worked?

              MODX info for everyone: http://bobsguides.com/MODx.html
            • Yes it did.

              Step 1 : Create an "Anonymous" resource group and place the resources that you want to hide to authentified users.

              Step 2 : in the ACL page, update the (anonymous) user group. Skip the first fields and go directly at "resource group access", and add the resource group Anonymous ( minimum role : 9999, access policies : Resource )
              • Excellent. Thanks. smiley

                  MODX info for everyone: http://bobsguides.com/MODx.html
                • You are welcome, actually it works, but not if parent folder belongs to another group that is forbidden.
                  • I’m not sure, but I think you might be able to get around that by putting those forbidden folders in a resource group and giving the anonymous users access to it with a policy that includes only the "load" permission.

                      MODX info for everyone: http://bobsguides.com/MODx.html
                    • Yes, for others out there I can confirm that the permissions method works and in my opinion is much better, rather than just hiding the link.

                      My process
                      -----------

                      1. Created NotLoggedIn Only Resource Group
                      2. Added the resources I want hidden to the ’not logged in’
                      3. Update the Anonymous User Group with Resource Group Access Policy
                      4. Add the resource group Anonymous


                      • Minimum role : 9999
                        Access policies : Resource
                        Resource Group: NotLoggedIn Only
                        Context: Web

                      BUT ... it only worked also after I MANUALLY cleared the cache.

                      NB: Using 2.1.0-pl