0

I have a page say xyz which contains many sub pages. Some of the subpages are "CUG enabled". In my jsp I am calling currentPage.listChildren() but this is listing the CUG enabled pages only if I login as an admin. If anonymous user hits the url for this jsp then the CUG enabled pages are not listed. Below is my jsp code:

Iterator<Page> itr = currentPage.listChildren();

                while(itr.hasNext()) {

                    Page ctxPage = itr.next();
                    String url =  hostName + ctxPage.getVanityUrl()+".html";
                    %>
                        <a href="<%=url%>"><%=url%><br/>
                    <%
                    }
                }

I also tried logging-in to the workspace as an admin using the method described here, but it didn't work.

Any help is appreciated, Thanks!

rakhi4110
  • 9,253
  • 2
  • 30
  • 49
Rakesh
  • 4,264
  • 4
  • 32
  • 58

1 Answers1

0

I think this behaviour is intented - only users belonging to the user group specified as the CUG can view these pages.

Now it depends for what purpose you need to list those pages.

The easiest solution would be to add the "everyone" to the Admitted Groups in the CUG-Section of those specific page properties. But that's defeating the purpose of having CUG in the first place.

CAUTION: Doing so would allow "everyone" to access those pages - which might not be what you want.

ADDITION: If you want to preserve access rights you need to go down to node level and access the repository directly. Here it is shown how you can get a "Resource Resolver with admin rights": https://cqwemblog.wordpress.com/2013/12/29/ways-to-access-jcr-repository-in-cq5/

You could then use this resource resolver to fetch your page and access it's children.

mish
  • 1,055
  • 10
  • 29
  • The purpose of this is to list those pages in my sitemap. So when an anonymous user hits the url http://www.example.com/sitemap.xml the cug enables page urls should be displayed in the sitemap. – Rakesh Nov 18 '14 at 13:26
  • If you're outputting URLs I assume you want the anonymous users to be able to access those pages as well? – mish Nov 18 '14 at 13:28
  • Only authenticated uses have access to these pages, but they need to be listed in the sitemap. – Rakesh Nov 19 '14 at 10:00
  • Ah ok, so you need to preserve access rights - See my update then – mish Nov 19 '14 at 12:10
  • Thanks @mish your inputs helped me, the issue was resolved after I followed the method described here http://www.stejan.ch/blog/tag/cq5/ – Rakesh Nov 19 '14 at 13:08