Foros de discusión

Hide portlet sing-in after login ?

thumbnail
B Yousri, modificado hace 14 años.

Hide portlet sing-in after login ?

Junior Member Mensajes: 70 Fecha de incorporación: 11/04/08 Mensajes recientes
Hello,

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


Thank you
thumbnail
satish bejgum, modificado hace 14 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 44 Fecha de incorporación: 5/11/08 Mensajes recientes
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 hace 14 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 70 Fecha de incorporación: 11/04/08 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 25 Fecha de incorporación: 15/07/10 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Liferay Master Mensajes: 598 Fecha de incorporación: 22/10/07 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

New Member Mensajes: 6 Fecha de incorporación: 10/09/10 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

New Member Mensajes: 6 Fecha de incorporación: 10/09/10 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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 hace 13 años.

RE: Hide portlet sing-in after login ?

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
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 hace 12 años.

RE: Hide portlet sing-in after login ?

Expert Mensajes: 349 Fecha de incorporación: 21/07/11 Mensajes recientes
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 hace 12 años.

RE: Hide portlet sing-in after login ?

Expert Mensajes: 349 Fecha de incorporación: 21/07/11 Mensajes recientes
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 hace 12 años.

RE: Hide portlet sing-in after login ?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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 hace 12 años.

RE: Hide portlet sing-in after login ?

Expert Mensajes: 349 Fecha de incorporación: 21/07/11 Mensajes recientes
thnx Olaf !!
Marc-Andre Gauthier, modificado hace 8 años.

RE: Hide portlet sing-in after login ?

New Member Mensajes: 21 Fecha de incorporación: 30/07/15 Mensajes recientes
.signed-in .portlet-login {
display: none;
}

Works for me