Search code examples
open-sourceliferayportal

Liferay distinguish between public and internal pages and hide/show them as needed


Situation

I want to create a Community-like Website/Portal with Liferay's Open Source Portal Software. My issue right now is, I don't know how to realize a separated or partly divided site. It should be possible to have some pages before the login, to inform the possible future user and then after registration/login some internal pages which obviously shouldn't be visible to not registered users. The internal part is not much the problem, because I can just set the user permissions for the sites, so the "guest" users can not see them. But if I create pages for public guests, they also appear internally when logged in. But these ones should not be seen in the menu, but if I set the settings "hide page from navigation bar" they are also gone for the public area obviously. Also I thought about organizing my site, it is anyways better to have it a bit structured so the internal part is separated from the outside part.

Possible Solutions

First I tried with the public and private pages, but unfortunately I came to no success. Maybe it is possible but if, then I did something wrong with them.

Another approach I have in mind would be using user roles/permissions, but I have not figured out how it could be done in an efficient way and I am also quite unsure if it is a good way how to achieve that. The problem is that every user inherits the permissions from "guest" so I cannot hide pages from them. I mean it would be enough to not have it on the internal navigation.

My last and maybe closest approach which could work, would be the community/organization mechanism, but unfortunately I couldn't find much information on that how one could achieve what I want to have.

I would be really glad if someone could help me with that?

New Approaches

What I would want to have is a "flag"/checkbox or something like "Hide Menu Button"(Internally/Externally -> Logged in user etc...), which I can check, what would cause the link to disappear.

I was thinking about maybe there could be a CSS style solution? Are there attributes in the navbar links of the pages which I could address and hide the links via CSS/jQuery? Like a "private" or "public" attribute or something?


Solution

  • I played around a bit and found a better pleasing solution now (better than hardcode something or change themes or anything).

    I created two sites (not pages), where one has the "open" membership type and one the "private" membership type. In the "open" site I create pages now which are for the public and not logged in user, so they are visible before the login. The "private" site represents the "intern life" of the page, so I create the pages which only should be visible to logged in/registered users. Now I create a site link/default landing page in the "open" site to the "private" site. There are then only the internal sites visible for the users.

    Don't mix that solution up with "public"/"private" pages, because these are working a bit different.

    I like that solution way better, because then I can split concerns between the outer and inner "world".

    If someone has an even better way of doing that, I would be glad to hear that :)

    Until then, I hope maybe I could also help others with that.