Foren

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

Christian Richter, geändert vor 9 Jahren.

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

New Member Beiträge: 8 Beitrittsdatum: 21.09.14 Neueste Beiträge
Hi,

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?
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
Liferay uses the concept that guests can see limited stuff, but a user can see what they have and what guests have. So you can't really hide anything that a guest can see because all users are still guests.

And this is really the pattern that makes the most sense. Just because you're a site member (perhaps through "remember me" or something), you still want to be able to see all of the ads, upcoming information, etc. that a guest would be able to see, otherwise you risk cutting a portion of the eyeballs on your site out of the picture.

Now you can approach a public/private site. This would allow you to relocate the private info to the private pages and you can leave the public/guest stuff out of it, but you don't want to block a user from navigating wherever they would need or like to go (trust me, if you find some way to hide something there's going to be a group of folks in your population that will do what they can to unhide it).

For the organization part, I understand your concern. Obviously separating the private from public stuff makes great sense and also provides a level of protection (i.e. if you forget to set the permissions correctly on some private page it's public until you do).

But at the end of the day, registered users may still need to see the public facing content too. Even if it's promotional stuff (so they can tell their friends) or informational or whatever, some will still want to see it.
Christian Richter, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

New Member Beiträge: 8 Beitrittsdatum: 21.09.14 Neueste Beiträge
Ok thank you very much and it makes sense. The thing is maybe we misunderstood each other, because I dont really want to hide it but i want to achieve, to maybe clear it up a bit more, that in the navigation bar/menu, where the pages(links) are, I find it unusual to have the public links, so I want to "hide" them, not the content itself but it is unnecessary to have it in the logged in area too.
Let's say I have an consultant service where people can sign in and talk about projects or organize themselves. INTERNAL there are links to e.g. "Insert Project", "Rate Project", Community and so on which guests cannot see. OUTSIDE that area there is the public area which everyone can see in the internet, so it is used to give an impression on what you could expect if you would register yourself. Why should these points still be in the nav bar/menu in the private area? So how can I hide them(the links) in a good way without hardcoding something in some template/theme or the page? Is there no mechanism?
thumbnail
Christoph Rabel, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

Liferay Legend Beiträge: 1554 Beitrittsdatum: 24.09.09 Neueste Beiträge
I think the OP has a point. That navigation/hide/show stuff is somewhat inconvenient in Liferay. Had to do lots of workarounds so far.

Personally I would find the following feature very useful:

Page & Portlet config:
[ ] Hide when authenticated

Reason:
It's easy to add new portlets or pages with permissions when the user logs in. But it is not possible to hide portlets or pages. I am not talking about permissions, it's about creating a view that contains only stuff an authenticated user wants to see. I'd like to be able to simply hide the stuff he doesn't need, stuff that only clutters his personal view.
Christian Richter, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

New Member Beiträge: 8 Beitrittsdatum: 21.09.14 Neueste Beiträge
Exactly my point, thank you emoticon

So this feature is not implemented yet/not planned? Mh what a pity, so I have to code it in some template/theme? Where exactly?
thumbnail
Christoph Rabel, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

Liferay Legend Beiträge: 1554 Beitrittsdatum: 24.09.09 Neueste Beiträge
Not sure if that feature is planned or anything.

IMHO, you have two options:
Create public/private pages. In the template: If user is authenticated, send him to the private site. If he somehow goes to the public pages, always redirect him to the private pages. (Did this once for a customer) Works basically. Of course, you content editors/admins/... shouldn't be redirected ;)

Or:
Write your own nav code. It's more difficult, but it allows a lot of control.
Christian Richter, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

New Member Beiträge: 8 Beitrittsdatum: 21.09.14 Neueste Beiträge
I think the second option sound more clear and clean.
So basically I look if a user is logged in (is there a method or flag in the API or anywhere?) and if so just hide the menu point in the nav bar? Where is that piece of code or lets say better, where do I change that in the best way?

I am just thinking of doing the same thing with css, is that possible? Do the page links in the navbar have different classes or anything in html which I could access and with that hide the "public" ones after login with css/jquery or something?
thumbnail
Jeffrey Paul Handa, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
I'm not sure if it will help in the situation you're describing, but there is a portal property called permissions.check.guest.enabled that might be of interest (https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/portal.properties#L4168-L4177).
Christian Richter, geändert vor 9 Jahren.

RE: Liferay distinguish between public and internal pages and hide/show the (Antwort)

New Member Beiträge: 8 Beitrittsdatum: 21.09.14 Neueste Beiträge
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 emoticon

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