Fórum

Hide portlet sing-in after login ?

thumbnail
B Yousri, modificado 14 Anos atrás.

Hide portlet sing-in after login ?

Junior Member Postagens: 70 Data de Entrada: 11/04/08 Postagens Recentes
Hello,

I'd like to hide the portlet sing-in after login? in the same page!


Thank you
thumbnail
satish bejgum, modificado 14 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 44 Data de Entrada: 05/11/08 Postagens Recentes
go to ROOt.WAR\html\portlet\login\login.jsp and add condition not to show any thing after log-in. but if your using border, you will see the border.
thumbnail
B Yousri, modificado 14 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 70 Data de Entrada: 11/04/08 Postagens Recentes
Thank you
Yes I already thought about this solution
I want all the portlet is not visible even the border
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
Hello Yousri

How did you manage to completly hide the login portlet?
Please, share the solution if there is a one.

Thank you very much,
Karolin
thumbnail
Ed Holderman, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 25 Data de Entrada: 15/07/10 Postagens Recentes
I'd like to know too. I've tried using permissions to grant View access to the Login portlet to "Guest" only, but it still showed up for "User" after authentication.
thumbnail
Minhchau Dang, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Master Postagens: 598 Data de Entrada: 22/10/07 Postagens Recentes
I don't think this is possible without creating an EXT plugin. You would need to implement your own [tt]PortletPermission[/tt] class in an EXT plugin that has special logic when the [tt]portletId[/tt] is equal to [tt]PortletKeys.LOGIN[/tt] (basically, always return false in the [tt]contains[/tt] method if the user is authenticated and you're checking against the login portlet).

Once it's implemented, you would need inject it by providing a bean definition in [tt]ext-spring.xml[/tt] that ultimately overrides the Liferay bean with id [tt]com.liferay.portal.service.permission.PortletPermissionUtil[/tt], and make sure that it points the [tt]portletPermission[/tt] property to your new implementation.
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
I am trying to follow Minhchau Dang's instructions:

PortletPermissionImpl
public boolean contains(
  PermissionChecker permissionChecker, long plid, String portletId,
  String actionId, boolean strict)
  throws PortalException, SystemException {

  long groupId = 0;
  String name = null;
  String primKey = null;
  boolean isSignedIn = false; // todo: check user signed in

  if (plid > 0) {
    if (portletId.equals(PortletKeys.LOGIN)){
      if (isSignedIn){
        // don't show login portlet if user is logged in
        return false;
      }
    }
    .....


But how can I find out, if the user is signed in PortletPermissionImpl.contains ?

I don't have a request to find out over the themeDisplay:
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY)
themeDisplay.isSignedIn()


Is there any other possibility I don't know?
Marek Pomocka, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

New Member Postagens: 6 Data de Entrada: 10/09/10 Postagens Recentes
I think that you can achieve what you want using a custom layout template:

1. Create a layout template with plugins SDK
2. In the .tpl file place the following code as an example:
<div id="main-content" role="main">
    <div class="portlet-layout">
        <div class="portlet-column" id="column-1">
	    $processor.processColumn("column-1")
		</div>
		<div class="portlet-column" id="column-2">
		    #if($user.isDefaultUser())
		    $theme.runtime("58","",$velocityPortletPreferences.toString())
		    #end
		</div>
    </div>
</div>

3. Use your custom template on the page where you want the login portlet to disappear after logging in.
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
Yes, Pomocka's suggestion with a custom layout template works.

But because I want the behaviour in all standard layouts it’s not a good solution for me. I don't want to make a custom layout for all existing layouts just to hide the login portlet.

Any other solutions?
Marek Pomocka, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

New Member Postagens: 6 Data de Entrada: 10/09/10 Postagens Recentes
Then, add the following code to portal_normal.vm in your custom theme, just before closing </head> tag

#if(!$user.isDefaultUser())
#css ($htmlUtil.escape($portalUtil.getStaticResourceURL($request, "$css_folder/hide_login.css")))
#end


and create file hide_login.css in _diffs/css with the code:

#p_p_id_58_ { display: none; }


Hope that helps and works for you!
thumbnail
Olaf Kock, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
You can do this with CSS only - either through the portlet's Look&Feel or in your theme:

When somebody is logged in, there's the class "signed-in", together with the portlet you can utilize the "display:none;" CSS instruction for the sign-in portlet.

I currently have no access to a running liferay (just back from vacation, this computer doesn't have any installation), so I can't check the final CSS, but it'll be like this:

.signed-in .portlet-000 {
  display: none;
}


If this is ok (sign in doesn't disclose any important data), I'd opt for this than the more heavy weight modifications mentioned in this thread.
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
I tried Kock's light weight solution.

It would have to be:

.signed-in .portlet-login {
  display: none;
}


But class "signed-in" is never set as well as class "signed-out"?

In init.vm I found the code with should set class "signed-in".
#if($is_signed_in)
  #set ($css_class = $css_class + " signed-in")
#else
  #set ($css_class = $css_class + " signed-out")
#end


I surged the page source code, but class "signed-in" or "signed-out" is never set no matter if I use the standard layout or custom layout.

<div class="portlet-boundary portlet-boundary_58_  portlet-static portlet-static-end portlet-login " id="p_p_id_58_">
	<a id="p_58"></a>
	<section id="portlet_58" class="portlet">
		<header class="portlet-topper">
			<h1 class="portlet-title">
			......
		</h1></header></section></div>
	


Any help why class "signed-in", "signed-out" is never set?
thumbnail
Olaf Kock, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
I don't know if I understand your question correctly: "signed-in" is set on <body>, not on the individual portlet. But as it's nested, CSS will work as expected.

Olaf
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Can you try creating a jsp hook for init.jsp of login portlet and add the following at the end

if(themeDisplay.isSignedIn()){
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,false);

}

Regards,
Sandeep
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
I am sorry, I am not an html or css expert.
The login portlet is always visible and because I could't find "signed-in" in the html page source I thought it's not set and that's why the login portlet is always visible.


Is my configuration right? Does this work for you?

custom.css

.signed-in .portlet-login {
  display: none;
}
thumbnail
Olaf Kock, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
Karolin Anna Krieg:
.signed-in .portlet-login {
  display: none;
}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.
thumbnail
Karolin Anna Krieg, modificado 13 Anos atrás.

RE: Hide portlet sing-in after login ?

Junior Member Postagens: 53 Data de Entrada: 17/12/09 Postagens Recentes
It was my fault. In my custom theme portal_normal.vm <body class="$css_class"> was not set.

Now it works perfectly emoticon

Thank you very much for your help!
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: Hide portlet sing-in after login ?

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
Olaf Kock:
Karolin Anna Krieg:
.signed-in .portlet-login {
  display: none;
}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.



Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.



Hi Olaf !!

I have committed this mistake.....emoticon

emoticon

now plz give some idea to get rid of this.......i have tried to remove from portlet folder and putting new LOGIN folder.....but still dint succeed........
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: Hide portlet sing-in after login ?

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
Olaf Kock:
Karolin Anna Krieg:
.signed-in .portlet-login {
  display: none;
}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.



Hi Olaf !!

how to recover the login portlet that has been disappeared by adding the lines in Advance Styling....?? i have a lot R & D.....but still dint get.....

thnx !!
thumbnail
Olaf Kock, modificado 12 Anos atrás.

RE: Hide portlet sing-in after login ?

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
Zeeshan Khan:
how to recover the login portlet that has been disappeared by adding the lines in Advance Styling....?? i have a lot R & D.....but still dint get.....


Try inspecting the site with firebug or any similar tool on the browser of your least mistrust. You can inspect the DOM, manipulate the currently active DOM or CSS, i.e. show the content again (that is still there) or add the same style to a different portlet (this time with a "display:block;" instruction) and hope that it will override the other one. You might want to combine it with the "important" directive for CSS.
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: Hide portlet sing-in after login ?

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
thnx Olaf !!
Marc-Andre Gauthier, modificado 8 Anos atrás.

RE: Hide portlet sing-in after login ?

New Member Postagens: 21 Data de Entrada: 30/07/15 Postagens Recentes
.signed-in .portlet-login {
display: none;
}

Works for me