Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Bob Dietrich
Login Landing Page hook for 6.1?
February 21, 2012 5:06 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 221

Join Date: May 15, 2005

Recent Posts

Greetings,
Has anyone updated to Liferay 6.1 the Login Landing Page hook by Tarkan Corak? The hook seems to install correctly but when a user logs in a null pointer error is logged.

Thanks.
Bob Dietrich
RE: Login Landing Page hook for 6.1?
February 25, 2012 12:38 AM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 221

Join Date: May 15, 2005

Recent Posts

Looks like the NPE is caused by live users and clustering. See LPS-24822. The exception occurs in the following code ( clusterNode.getClusterNodeId()) because clusterNode is null (not configured).
 1            if (PropsValues.LIVE_USERS_ENABLED) {
 2                JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
 3
 4                ClusterNode clusterNode =
 5                    ClusterExecutorUtil.getLocalClusterNode();
 6
 7                jsonObject.put("clusterNodeId", clusterNode.getClusterNodeId());
 8                jsonObject.put("command", "signIn");
 9                jsonObject.put("companyId", companyId);
10                jsonObject.put("remoteAddr", request.getRemoteAddr());
Dave Kliczbor
RE: Login Landing Page hook for 6.1?
March 6, 2012 7:34 AM
Answer

Dave Kliczbor

Rank: Junior Member

Posts: 65

Join Date: July 12, 2011

Recent Posts

Yes, I'm updating and extending it at the moment. It still needs some testing, but I'm pretty sure that I will publish it some day...
Bob Dietrich
RE: Login Landing Page hook for 6.1?
March 11, 2012 3:15 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 221

Join Date: May 15, 2005

Recent Posts

I'd be happy to be an early tester if that helps.
Dave Kliczbor
RE: Login Landing Page hook for 6.1?
March 17, 2012 11:57 AM
Answer

Dave Kliczbor

Rank: Junior Member

Posts: 65

Join Date: July 12, 2011

Recent Posts

Okay, now with more time to write emoticon

My extended Login Landing Page plugin, originally written by Tarkan Corak, is downloadable from here: defaultlandingpage-hook.war. Sources are included, you should somehow be able to unzip and import them into Eclipse/Liferay IDE.

I'd appreciate any testing followed up by comments, hints, critics, praise etc., preferably posted here as an answer to this post.

Documentation (also in the source java file and in liferay-plugin-package.xml):

 1This plugin adds more control over the default landing page of your users after login.
 2It's configured through your [font=Courier New]portal-ext.properties[/font].
 3
 4New property: login.landing.page=<urlpattern>
 5    Possible string replacements in the urlpattern (take note which of these bring leading slashes with them):
 6        {ScreenName}                    = screenname of current user
 7        {UserURLGroup}                  = user.getGroup().getFriendlyURL() (usually "/<screenname>")
 8        {PrivateUserMapping}            = layout.friendly.url.private.user.servlet.mapping (default: "/user")
 9        {PrivateGroupMapping}           = layout.friendly.url.private.group.servlet.mapping (default: "/group")
10        {PublicMapping}                 = layout.friendly.url.public.servlet.mapping (default: "/web")
11        {UserDefaultPrivateLayout}      = default.user.private.layout.friendly.url (default: "/home")
12        {UserDefaultPublicLayout}       = default.user.public.layout.friendly.url (default: "/home")
13        {UserGroupId:name}              = substituted by the ID of the UserGroup denoted by <name>
14        {any.property}                  = will be replaced with the value of the property at time of login
15    These substitution strings are case-sensitive and do not like extra whitespace.
16    Example:
17         login.landing.page={PrivateUserMapping}{UserURLGroup}{UserDefaultPrivateLayout}
18             This example expands per default to: /user/screenname/home
19         login.landing.page={PrivateGroupMapping}{UserURLGroup}/~/{UserGroupId:members}{UserDefaultPrivateLayout}
20             This would expand to the URL of a user's private page that's being propagated
21             through a Dynamic Site Template: /group/screenname/~/12345/home
22                
23New property: login.landing.page.by.group=<usergroup>:<urlpattern>, <usergroup>:<urlpattern>, ...
24    List of comma-separated "<usergroup>:<urlpattern>" tuples to redirect
25    based on UserGroup memberships.
26    The same string replacements as for login.landing.page apply.
27    If the user belongs to a usergroup mentioned in this list, login.landing.page
28    will be ignored and the corresponding <friendlyurlpattern> applies instead.
29    The _last_ applicable pattern will be applied!
30    Example:
31        login.landing.page.by.group=members:{PrivateUserMapping}{UserURLGroup}{UserDefaultPrivateLayout}, \
32                                    specialists:{PrivateGroupMapping}/special/home
33        In this example, a user that belongs to the groups "members" _and_ "specialists"
34        will be redirected to /group/special/home.
35        A user that's only in the group "members" will be redirected to his private home page.
36        A user that's not a member of any listed group will be redirected to the
37        first applicable page of the following:
38            * login.landing.page (explained above)
39            * the user's default private profile page     (see default.user.private.layout.friendly.url)
40            * the first community's default private page
41            * the first community's default public page.
Bob Dietrich
RE: Login Landing Page hook for 6.1?
March 18, 2012 1:56 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 221

Join Date: May 15, 2005

Recent Posts

I've tested the plugin with 6.1CE GA1 using all the defaults (had to set live.users.enabled=false). Seems to work the same way. Unfortunately I don't have time right now to test the new options.

Thanks for making this available.
Aerosev Ro ro
RE: Login Landing Page hook for 6.1?
June 22, 2012 12:22 AM
Answer

Aerosev Ro ro

Rank: New Member

Posts: 2

Join Date: June 21, 2012

Recent Posts

Dave Kliczbor:
Okay, now with more time to write emoticon

My extended Login Landing Page plugin, originally written by Tarkan Corak, is downloadable from here: defaultlandingpage-hook.war. Sources are included, you should somehow be able to unzip and import them into Eclipse/Liferay IDE.

I'd appreciate any testing followed up by comments, hints, critics, praise etc., preferably posted here as an answer to this post.

Documentation (also in the source java file and in liferay-plugin-package.xml):

 1This plugin adds more control over the default landing page of your users after login.
 2It's configured through your [font=Courier New]portal-ext.properties[/font].
 3
 4New property: login.landing.page=<urlpattern>
 5    Possible string replacements in the urlpattern (take note which of these bring leading slashes with them):
 6        {ScreenName}                    = screenname of current user
 7        {UserURLGroup}                  = user.getGroup().getFriendlyURL() (usually "/<screenname>")
 8        {PrivateUserMapping}            = layout.friendly.url.private.user.servlet.mapping (default: "/user")
 9        {PrivateGroupMapping}           = layout.friendly.url.private.group.servlet.mapping (default: "/group")
10        {PublicMapping}                 = layout.friendly.url.public.servlet.mapping (default: "/web")
11        {UserDefaultPrivateLayout}      = default.user.private.layout.friendly.url (default: "/home")
12        {UserDefaultPublicLayout}       = default.user.public.layout.friendly.url (default: "/home")
13        {UserGroupId:name}              = substituted by the ID of the UserGroup denoted by <name>
14        {any.property}                  = will be replaced with the value of the property at time of login
15    These substitution strings are case-sensitive and do not like extra whitespace.
16    Example:
17         login.landing.page={PrivateUserMapping}{UserURLGroup}{UserDefaultPrivateLayout}
18             This example expands per default to: /user/screenname/home
19         login.landing.page={PrivateGroupMapping}{UserURLGroup}/~/{UserGroupId:members}{UserDefaultPrivateLayout}
20             This would expand to the URL of a user's private page that's being propagated
21             through a Dynamic Site Template: /group/screenname/~/12345/home
22                
23New property: login.landing.page.by.group=<usergroup>:<urlpattern>, <usergroup>:<urlpattern>, ...
24    List of comma-separated "<usergroup>:<urlpattern>" tuples to redirect
25    based on UserGroup memberships.
26    The same string replacements as for login.landing.page apply.
27    If the user belongs to a usergroup mentioned in this list, login.landing.page
28    will be ignored and the corresponding <friendlyurlpattern> applies instead.
29    The _last_ applicable pattern will be applied!
30    Example:
31        login.landing.page.by.group=members:{PrivateUserMapping}{UserURLGroup}{UserDefaultPrivateLayout}, \
32                                    specialists:{PrivateGroupMapping}/special/home
33        In this example, a user that belongs to the groups "members" _and_ "specialists"
34        will be redirected to /group/special/home.
35        A user that's only in the group "members" will be redirected to his private home page.
36        A user that's not a member of any listed group will be redirected to the
37        first applicable page of the following:
38            * login.landing.page (explained above)
39            * the user's default private profile page     (see default.user.private.layout.friendly.url)
40            * the first community's default private page
41            * the first community's default public page.


Hi!, I´m new here. First, sorry for my english, not very well.
I´m going to test your solution for my problem...

I´ve got a multisite with a father community and several community childs. I can to sign in by login in father and in each of the children but all login redirect me to the same page. I want to configure that in order to each login redirect to differents pages... do you understand me?... Your code can help me??...
Thanks for all!
Dave Kliczbor
RE: Login Landing Page hook for 6.1?
June 26, 2012 10:12 AM
Answer

Dave Kliczbor

Rank: Junior Member

Posts: 65

Join Date: July 12, 2011

Recent Posts

Sorry, I'm not sure what's your point... but I'm trying to understand emoticon

If you want to redirect by community membership: that's not implemented, although you may take the code and extend it -- copy and change the "redirect by group" code to a new feature "redirect by community".

If you have a correspondence between community membership and usergroup membership: you can use this plugin without modifying it -- just use the "redirect by group" feature.