firstChildRedirect is a nice snippet to use but from my view it ignores permissions completely. If the user has no permission for the 1st child he is forwarded to the not-autorized page(?). (I didn't test it, but if I look at the code it looks like, please correct me).
Is there a firstChildRedirect snippet around which respects the permissions i.e. returns the 1st resource which has the user permission for?
best regards
manu
-
☆ A M B ☆
- 24,524 Posts
That's what is supposed to happen if someone tries to access a page he doesn't have permission for. FirstChildRedirect simply does what it says - redirects to the first child of the page with the snippet call on it. You would need a custom snippet or perhaps a plugin for what you want. Do you want the person redirected to the first child that the user has permission to view? That would be difficult to do, since that might be the first child, or the 23rd child, or possibly none of the children. Then what? In my opinion, you would be better off re-thinking your site structure so that protected pages aren't so mixed in with public pages, or don't have a structure that requires using that snippet.
getResources should respect permissions.
So, I think you can use getResources in a snippet to get the correct firstChild and redirect to that one.
Hi Susan, hi Bruno
My intention is to have a central login page where the user is forwarded to a usergroup specific welcome page after successfull login. My idea was to setup a container with resources as children that each have unique user-/resource-group permission. With a firstChildRedirect on the container the user would be forwarded as planned to its child resource. I know I imagine that might be pretty slow. But at the moment I don't have cleverer idea, do you?
Thanks Bruno. If this is the way I'll give a try with getResources.
best regards
manu