留言板

Groups creation in liferay 6.2

srinivasa rao,修改在9 年前。

Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Hi All,

I have one requirement,we have three different groups,each group have its own landing page.
how to achieve this?i try to create groups in liferay ,but unable to succeed.

any one please help me to achieve this task.

Regards,
Srinivas.
kiran revoori,修改在9 年前。

RE: Groups creation in liferay 6.2

Junior Member 帖子: 37 加入日期: 13-10-23 最近的帖子
First Create a Group "Test". Then select ManageSitePages option for this group
Go to the Private Pages Tab and create new private page. Suppose page name is "MyLandingPage"

Then hit the url like http://localhost:8080/group/Test/MyLandingPage

Similarly do this for other groups. So we have different landing page for each group
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
kiran revoori:
First Create a Group "Test". Then select ManageSitePages option for this group
Go to the Private Pages Tab and create new private page. Suppose page name is "MyLandingPage"

Then hit the url like http://localhost:8080/group/Test/MyLandingPage

Similarly do this for other groups. So we have different landing page for each group



Hi Kiran,

Thanks for ur reply.
but i want to login with tht usergroup under user details.for EX:if i entered localhost:8080(it opens direct page with signin option)
in sigin page i entered user details (depend upon user group)it will displays landing page.is it possible?
kiran revoori,修改在9 年前。

RE: Groups creation in liferay 6.2

Junior Member 帖子: 37 加入日期: 13-10-23 最近的帖子
Based on group you mentioned in the url and valid credentials, you will be redirected to corresponding group landing page
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Srinivasa,

You need to write a hook for same, post login hook would be right solution for such requirement.

Thanks,
Sagar Vyas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Sagar A Vyas:
Srinivasa,

You need to write a hook for same, post login hook would be right solution for such requirement.

Thanks,
Sagar Vyas



Hi Sagar,

Thanks for ur reply.

Could u please provide any example for this requirement?
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Hi Srinivasa,

You can do following things.

1. Create post login hook from scratch.
2. Or you can use Custom Landing page hook from Liferay's marketplace.

I would suggest go for 2nd option.

Let me know in case of more information require.

Thanks,
Sagar
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
HI Sagar,

i m created custom landing page hook as shown in tht example.
now i m trying to create a new user by using create account page upto this everything is fine.
but here my question is
1.how it will findout which user belongs to which group?
2.and i m unable to login with newly created user in portal.
too much confused..emoticon

Regards,
Srinivas.
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Ok Srinivasa,

I got your problem.

We can resolve your problem,as you are confuse let do it step by step.

When user is logging we need to know in hook that which group he is belong to right ? group can be site/org/user group correct me if I am wrong.

1. Create hook having following things. [Following things are comes under liferay-hook.xml]


<!--?xml version="1.0" encoding="UTF-8"?-->


<hook>
	<portal-properties>portal.properties</portal-properties> 
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>


Now here as you are seeing we need to override two files 1. portal.properties - which says what hook we are willing to execute. 2. Custom Jsps : where we need to set some parameter which we can read in our hook class with request parameter in this case we will set group

We need to override following jsp
\custom_jsps\html\portlet\dockbar\view.jsp



&lt;%@ include file="/html/portlet/dockbar/init.jsp" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %&gt;
 &lt;%
     Group singOutGroup = layout.getGroup();
        String friendlyUrl=singOutGroup.getFriendlyURL();
     if (singOutGroup.hasPublicLayouts() &amp;&amp; friendlyUrl != null) {
      String signOutUrl = themeDisplay.getURLSignOut()+ "?[b]referer[/b]="+singOutGroup.getName();
      themeDisplay.setURLSignOut(signOutUrl);
     }
%&gt;   
 <liferay-util:buffer var="html">
  <liferay-util:include page="/html/portlet/dockbar/view.portal.jsp" />
 </liferay-util:buffer>  
 &lt;%=html%&gt;


you can access referer parameter from hook base on that you can redirect.

If any confusion more ...I will provide full solution as I have done this before.

Thanks,
Sagar Vyas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Hi Sagar,

Thanks for ur help.
after login or while creating account time only user may know which group belongs
or else user login into portal in hook we may knw which group he belongs to(user groups)
now i followed ur explained process...and created hook project and created portal.properties and custom_jsps
but in custom_jsp page what ever i taken html\portlet\dockbar\view.jsp jsp is showing lot of errors.

and wht we mentioned in portal.properties page and please provide me full solution.

Regards,
Srinivas.
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Dont worry about those error Srinivasa, those are compile time error.

Just deploy it, it should work dont worry.

Meanwhile let me try on my machine.

Stay tune.

THanks,
Sagar Vyas
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Srinivasa,

As I have created hook in my local machine.

Few questions on you requirement.

1. Login page of each group is different ? or common login page ?
2. A user can be part of multiple group or single group only ?

Thanks,
Sagar Vyas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Sagar A Vyas:
Srinivasa,

As I have created hook in my local machine.

Few questions on you requirement.

1. Login page of each group is different ? or common login page ?
2. A user can be part of multiple group or single group only ?

Thanks,
Sagar Vyas


Hi Sagar,

1.Common login page and what ever i created user are belongs to different usergroups
for ex:i created a group name is payee - under payee i created a user
as well as remaining groups.
2.User can be part of only single group(as of now)

Regards,
Srinivas.
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
If this is a case , then solution what I have provided that perfect one.

Please check/try and let me know.

Thanks,
Sagar Vyas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Sagar,

Thank you so much for ur continuously reply.

i created a hook and deployed it into server..its working wonderful.

and after tht i created usergroups under control panel,created users and map tht user to usergroup.

(for Ex:i created a group name called Payer(added private page(landing page) and themes) under payee i added a user called payer(this user mapped to payer group))

after this process i try to logged with new user ..but wt i want landing page is not comingemoticon

i added frdly url in controller class.(i observed logs in server..i put sysout to findout group) but nothing displayed in usergroup.emoticon
thumbnail
Tejas Kanani,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Sorry guys if I'm jumping in between your conversation. But,

Srinivasa,
It seems that if I'm understanding your requirement correctly, you should be able to achieve what you want using Custom Landing Page Hook. Give it a try and let me know if it's what you want.

Install & Setup
1) Download Custom Landing Page Hook v1.2.2 from Liferay Marketplace. Make sure you are downloading 1.2.2(latest) version which is compatible with Liferay 6.2+.
2) Open downloaded Custom Landing Page Hook.lpkg file using winzip/winrar and you'll see CustomLandingPage-hook-*.war
3) Open that war using winzip/winrar and go to WEB-INF/classes and open portal.properties
4) Modify the value of "custom.landing.page.type" property to "userGroup"
i.e. custom.landing.page.type=userGroup
5) Save the changes and you'll have the updates lpkg file
6) Deploy the Custom Landing Page Hook*.lpkg file to deploy folder and check the logs and make sure it deployed successfully

Now setup user, userGroup & it's mapping.
1) Create Payee user group
2) Create Payee1 user
3) Assign Payee1 to Payee user group
4) Create custom attribute of type "TextField" with key "landingPage" in userGroup. (Let me know if you need help on how to create custom attribute for userGroup)
5) Go to your Payee userGroup, custom attribute and for "landingPage" attribute, define landing page complete URL where you want members of this group to be landed on.
i.e. /web/mysite/myhome

Verify
1) login with Payee1 user
2) If everthing works fine, Payee1 user should be landed on the page you've defined in custom attriute of Payee user group.
3) If not, please share if you are getting any error in logs or provide custom landing page specific logs. Details are mentioned in below post on how to get custom landing page hook specific logs. (https://www.liferay.com/community/forums/-/message_boards/message/36133113)

Limitaion: If Payee1 user belongs to more than 1 user group, while deciding the landing page it will pick the 1st userGroup from the list of userGroup user is member of. So in that case we'll not be able to maintain specific landing page efficiently.

Let me know if you find any issue/concern.

For more details on Custom Landing Page Hook capabilities visit,
https://github.com/opensourceforlife/CustomLandingPage-Hook

Thanks,
Tejas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Tejas Kanani:
Sorry guys if I'm jumping in between your conversation. But,

Srinivasa,
It seems that if I'm understanding your requirement correctly, you should be able to achieve what you want using Custom Landing Page Hook. Give it a try and let me know if it's what you want.

Install & Setup
1) Download Custom Landing Page Hook v1.2.2 from Liferay Marketplace. Make sure you are downloading 1.2.2(latest) version which is compatible with Liferay 6.2+.
2) Open downloaded Custom Landing Page Hook.lpkg file using winzip/winrar and you'll see CustomLandingPage-hook-*.war
3) Open that war using winzip/winrar and go to WEB-INF/classes and open portal.properties
4) Modify the value of "custom.landing.page.type" property to "userGroup"
i.e. custom.landing.page.type=userGroup
5) Save the changes and you'll have the updates lpkg file
6) Deploy the Custom Landing Page Hook*.lpkg file to deploy folder and check the logs and make sure it deployed successfully

Now setup user, userGroup & it's mapping.
1) Create Payee user group
2) Create Payee1 user
3) Assign Payee1 to Payee user group
4) Create custom attribute of type "TextField" with key "landingPage" in userGroup. (Let me know if you need help on how to create custom attribute for userGroup)
5) Go to your Payee userGroup, custom attribute and for "landingPage" attribute, define landing page complete URL where you want members of this group to be landed on.
i.e. /web/mysite/myhome

Verify
1) login with Payee1 user
2) If everthing works fine, Payee1 user should be landed on the page you've defined in custom attriute of Payee user group.
3) If not, please share if you are getting any error in logs or provide custom landing page specific logs. Details are mentioned in below post on how to get custom landing page hook specific logs. (https://www.liferay.com/community/forums/-/message_boards/message/36133113)

Limitaion: If Payee1 user belongs to more than 1 user group, while deciding the landing page it will pick the 1st userGroup from the list of userGroup user is member of. So in that case we'll not be able to maintain specific landing page efficiently.

Let me know if you find any issue/concern.

For more details on Custom Landing Page Hook capabilities visit,
https://github.com/opensourceforlife/CustomLandingPage-Hook

Thanks,
Tejas


Hi Tejas,

thanks for ur reply..

i tried wt ever u mentioned,i deployed custom hook(v1.2.2)(changed the properties) through hot deploy(in server App installation) ,in logs it showing hook available.i didnt see any errors in logs,every thing is fine.

created a group name called as Enrollee.
created a user called as a enrollee
created one portlet called enrollee home
created custom filed called as landing page.
in user group i added landing page called as /web/guest/enrollee.

after login with user credentials(enrollee) it showing old page..not loading wt i want.

Regards,
Srinivas.
thumbnail
Tejas Kanani,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
If you can follow the instruction in below post and share the log, that would might help to identify your issue.
3) If not, please share if you are getting any error in logs or provide custom landing page specific logs. Details are mentioned in below post on how to get custom landing page hook specific logs. (https://www.liferay.com/community/forums/-/message_boards/message/36133113)
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Hi Tejas,

i didnt find any Logs in my Home directory with the name of customhook.i checked the log4j.xml path is showing correctly.but i unable to check.
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Tejas Kanani:
If you can follow the instruction in below post and share the log, that would might help to identify your issue.
3) If not, please share if you are getting any error in logs or provide custom landing page specific logs. Details are mentioned in below post on how to get custom landing page hook specific logs. (https://www.liferay.com/community/forums/-/message_boards/message/36133113)



Hi Tejas,

Here is logs:

10:50:23,991 DEBUG [http-bio-8080-exec-53][CustomLandingPageAction:60] default.landing.page.path=
10:50:23,996 DEBUG [http-bio-8080-exec-53][CustomLandingPageAction:69] override.default.landing.page.path=true
10:50:23,996 DEBUG [http-bio-8080-exec-53][CustomLandingPageAction:133] custom.landing.page.type=userGroup
10:50:24,024 DEBUG [http-bio-8080-exec-53][CustomLandingPageUtil:403] No Custom Attribute found with key landingPage
10:50:24,024 DEBUG [http-bio-8080-exec-53][CustomLandingPageUtil:378] Custom Attribute found with key landingPage in enrollee User Group is having null/blank value
10:50:24,024 DEBUG [http-bio-8080-exec-53][CustomLandingPageAction:87] Custom Landing Page path= for User : Enrollee
thumbnail
Tejas Kanani,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Can you please verify if you have properly created custom attribute for userGroup with key "landingPage" ? and also make sure you've set proper value for enrollee userGroup. From the logs it looks like it's not able to find the landingPage custom attribute for userGroup enrollee.

10:50:24,024 DEBUG [http-bio-8080-exec-53][CustomLandingPageAction:87] Custom Landing Page path= for User : Enrollee

And that's why it's going to default landing page as mentioned in log that Custom Landing Page path = (blank).

If you can provide the complete steps on how you've added/created custom attribute for userGroup that might help to resolve your issue if you missed anything in that.

Thanks,
Tejas
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Hi,

I created a custom filed called as landing page:
process to create custom filed :

login as a admin and click on controlpanel->configurations->custom filed->usergroups->landingpage (created cutsom attribute)emoticon

after tht created a user group called a Enrollee
in custom attribute added home page url:/guest/enrollee
i added here image of enrolle user group,please chk
thumbnail
Tejas Kanani,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
You also need to include "/web". So try by using "/web/guest/enrolle" as a value of Landingpage.

I've followed the same steps as you've mentioned and it worked fine for me.
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Tejas Kanani:
You also need to include "/web". So try by using "/web/guest/enrolle" as a value of Landingpage.

I've followed the same steps as you've mentioned and it worked fine for me.



even i tried tht also..but my after login with user (enrollee) landing page is not displayed.
i checked in expando table and groups_ table but i didnt find any new created user group details,is thts may be the problem?
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Hi,

Its works fine.now one problem for me.

Now:

After login with enrollee credentials landing page will be \web\guest\enrollee.tht tab will be hilighted.

but i want home tab will be highlighted and enrollee page data will be showing in home page.

is it possible to show?and after enrollee login enrollee tab not displayed.
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Any suggestions?
srinivasa rao,修改在9 年前。

RE: Groups creation in liferay 6.2

Regular Member 帖子: 189 加入日期: 14-1-29 最近的帖子
Sagar A Vyas:
If this is a case , then solution what I have provided that perfect one.

Please check/try and let me know.

Thanks,
Sagar Vyas



Hi Sagar,

i added in this path in controller class.
if(grp.getFriendlyURL().equals("/guest/enrollee"))
{
path = "/guest/enrollee";
}
but in console logs i didnt find usergroup details.
if i logged as a admin it will shoiwng user group details and every thing.
those following logs are when ever i logged as a Admin

UserGroup[{uuid=c2f2d72a-fd02-4e1a-83fb-3f29629e931b, groupId=10184, companyId=10157, creatorUserId=10161, classNameId=10001, classPK=10184, parentGroupId=0, liveGroupId=0, treePath=/10184/, name=Guest, description=, type=1, typeSettings=mergeGuestPublicPages=false
, manualMembership=true, membershipRestriction=0, friendlyURL=/guest, site=true, remoteStagingGroupCount=0, active=true}]
User Under Group{uuid=97fc9b02-ffd9-4f78-b402-121005abbf2d, userId=10436, companyId=10157, createDate=Wed Apr 09 06:53:01 GMT 2014, modifiedDate=Wed Apr 09 06:53:01 GMT 2014, defaultUser=false, contactId=10437, password=AAAAoAAB9ADqhUwvaxJ61t0Wa7ag9tHVx6umxnSMAUapf+oR, passwordEncrypted=true, passwordReset=false, passwordModifiedDate=Wed Apr 09 06:54:23 GMT 2014, digest=53426672d218bf67d059078a5e41fbdf,fee69f20d2707aed7958229e50688a27,23d70a7ba4092e3c5727cfe04788f351, reminderQueryQuestion=what-is-your-father's-middle-name, reminderQueryAnswer=, graceLoginCount=0, screenName=srinivas, emailAddress=, facebookId=0, ldapServerId=-1, openId=, portraitId=0, languageId=en_US, timeZoneId=UTC, greeting=Welcome !, comments=, firstName=, middleName=, lastName=, jobTitle=, loginDate=Mon May 05 09:05:45 GMT 2014, loginIP=127.0.0.1, lastLoginDate=Mon May 05 09:05:15 GMT 2014, lastLoginIP=127.0.0.1, lastFailedLoginDate=null, failedLoginAttempts=0, lockout=false, lockoutDate=null, agreedToTermsOfUse=true, emailAddressVerified=true, status=0}
Current login user:/guest

if i logged with a created user(my own user) following logs are showing.
UserGroup[]:
User Under Group{uuid=47135eec-adf8-4c81-9f62-6d1971bf6070, userId=12818, companyId=10157, createDate=Mon May 05 08:40:01 GMT 2014, modifiedDate=Mon May 05 08:41:43 GMT 2014, defaultUser=false, contactId=12819, password=AAAAoAAB9ADbu8eizHB/onCJvhpEwz6Ko0ok6aXehe4UKS2p, passwordEncrypted=true, passwordReset=false, passwordModifiedDate=Mon May 05 08:42:16 GMT 2014, digest=72d14ef5c885fa1aa9e0147c5ac3b352,24995c97ec5199d342ec42b6cc3a24a2,826654f824e5099ca75fdea627701c13, reminderQueryQuestion=what-is-your-father's-middle-name, reminderQueryAnswer=, graceLoginCount=0, screenName=.1, emailAddress=, facebookId=0, ldapServerId=-1, openId=, portraitId=0, languageId=en_US, timeZoneId=UTC, greeting=, comments=, firstName=Enrollee, middleName=, lastName=, jobTitle=, loginDate=Mon May 05 09:07:00 GMT 2014, loginIP=127.0.0.1, lastLoginDate=Mon May 05 09:03:56 GMT 2014, lastLoginIP=127.0.0.1, lastFailedLoginDate=null, failedLoginAttempts=0, lockout=false, lockoutDate=null, agreedToTermsOfUse=true, emailAddressVerified=false, status=0}
thumbnail
Sagar A Vyas,修改在9 年前。

RE: Groups creation in liferay 6.2

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Hi Srinivasa,

I have created hook in my local.

What I did.


1. Create Two sites - Site A and Site B.
2. Create Two users - User A and User B.
3. Assign User A to Site A and User B to Site B.


What I want to achieve is.

When user A is login - He should be redirected to Site A public page as he is member of this site


When user B is login - He should be redirected to Site B public page as he is member of this site


Hook

1. liferay-hook.xml
 <!--?xml version="1.0"?-->


<hook>
	<portal-properties>portal.properties</portal-properties>
</hook>


2.portal.properties


#
#Wed Apr 30 04:43:25 CDT 2014
login.events.post=com.liferay.training.events.MyHookController


3. MyHookController


package com.liferay.training.events;

import com.liferay.portal.kernel.events.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.struts.LastPath;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.User;
import com.liferay.portal.util.PortalUtil;

import java.util.List;

import javax.servlet.http.HttpSession;

public class MyHookController extends Action {
	/* (non-Java-doc)
	 * @see com.liferay.portal.kernel.events.Action#Action()
	 */
	public MyHookController() {
		super();
	}

	/* (non-Java-doc)
	 * @see com.liferay.portal.kernel.events.Action#run(HttpServletRequest arg0, HttpServletResponse arg1)
	 */
	public void run(HttpServletRequest request, HttpServletResponse arg1) throws ActionException {
		String path = StringPool.BLANK;
		try {
				User currentUser =  PortalUtil.getUser(request);
				List<group> grpList  = currentUser.getGroups();
			
				for(Group grp : grpList)
				{
					if(grp.isSite())
					{
						System.out.println(grp.getFriendlyURL());
						if(grp.getFriendlyURL().equals("/site-a"))
						{
							path = "/web/site-a/sitea";
						}
						if(grp.getFriendlyURL().equals("/site-b"))
						{
							path = "/web/site-b/sitebpage";
						}
						
					}
				}
		} catch (PortalException e) {
			e.printStackTrace();
		} catch (SystemException e) {
			e.printStackTrace();
		}
		
		LastPath publiclastPath = null;
		HttpSession session = request.getSession();
		publiclastPath = new LastPath(StringPool.BLANK, path);
		session.setAttribute(WebKeys.LAST_PATH, publiclastPath);
				
	}

}
</group>


For this point of time you do not need to create hook for docbar.

Let me know in case of more information require.

Thanks,
Sagar Vyas