Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Matt S.
Development of login portlet
15 de enero de 2013 0:58
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

Hi, I'm new in liferay and I have a problem with development of my own login portlet. My idea is to create an organization as administrator an then create in the home page of the portal a registration form where a guest write his credential ( name, surname, email psw ecc...) and became an user of that organization. How I can do this, in particular how can assign the new user to the organization?
Juan Francisco Ramos
RE: Development of login portlet
15 de enero de 2013 3:16
Respuesta

Juan Francisco Ramos

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 1 de junio de 2010

Mensajes recientes

Hi! You must use a hook portlet or an ext portlet to override the original login portlet of Liferay. In the main page of Liferay you have documentation of how to create an ext portlet.

When you have the ext portlet, you must add the functionality to assign the new user to the organization. Use this method:

UserLocalServiceUtil.addOrganizationUsers(organizationId, userIds)

Please look this:

http://www.liferay.com/es/community/forums/-/message_boards/message/12926600

I hope it helps you.
Jan Geißler
RE: Development of login portlet
15 de enero de 2013 3:21
Respuesta

Jan Geißler

Ranking: Expert

Mensajes: 356

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

Hi Matt!
If I understand you correctly, you want to assign a new User automatically to an Organisation, is that correct?
If so, there are some options you might want to consider:
1. You can assign default sites (not an organization I know, but there is not so much difference in site and organizations if you look a little bit more closely at it) to new user via Control-Panel -> Portal/Settings -> Users and Organizations (right hand menu) and -> Default User Associations
2. You could write a ModelListener and overwrite onAfterCreate(User user) where you could apply your custom Logic. The benefits would be, that you don't have to write a complete login Portlet, just use and canibalize the Login-Portlet from Liferay ;)

Hop I could be of assistance!

So long
Jan
Matt S.
RE: Development of login portlet
16 de enero de 2013 2:18
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

Hi to both and thank you for the answers emoticon My idea in not to modify the Liferay Login portlet but to create my custom portlet with Liferay IDE.I have found some docs about the method to use for doing it, in particular how to create an user and assign it to an organization but I have a problem with the authentication because I haven't found the appropriate documentation. Can someone give me a link?
Nicolas Tamayo
RE: Development of login portlet
16 de enero de 2013 6:30
Respuesta

Nicolas Tamayo

Ranking: Junior Member

Mensajes: 29

Fecha de incorporación: 3 de octubre de 2012

Mensajes recientes

Hi Matt.

I have a question that make to you.

you want know how LIferay make the authentication of the user?
Matt S.
RE: Development of login portlet
16 de enero de 2013 8:08
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

Hi Nicholas,

yes, it is one of the things I want to know. In simple terms i want create a registration form where a guest can create an account (like login portlet of Liferay).This new account must be assigned to an organization previously created by me in the control panel like administrator. Then the user, if he want to enter in the organization, must authenticate. I don't know how to do this.
I hope you can help me.
Matt S.
RE: Development of login portlet
17 de enero de 2013 1:43
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

I tried to create an user using this code but I have an exception that I don't understand...the code is

 1
 2public class Registrazione extends MVCPortlet {
 3
 4    public void processAction(ActionRequest request, ActionResponse response) throws IOException, PortletException{
 5        ThemeDisplay theme= (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
 6         long creatorUserId = theme.getUserId(); // default liferay user
 7          long companyId = theme.getCompanyId(); // default company
 8          boolean autoPassword = false;
 9          String password1 = "";//request.getParameter("psw");
10          String password2 = "";
11          boolean autoScreenName = false;
12          String screenName ="Ayeye" ;//request.getParameter("user");
13          String emailAddress = "hdjshd@hotmail.it";//request.getParameter("email");
14          long facebookId = 0;
15          String openId = "";
16          Locale locale = theme.getLocale();
17          String firstName = "Bo";//request.getParameter("name");
18          String middleName = "";
19          String lastName = "Bo";//request.getParameter("cognome");
20          int prefixId = 0;
21          int suffixId = 0;
22          boolean male = true;   
23          int birthdayMonth = 10;
24          int birthdayDay = 10;
25          int birthdayYear = 2010;
26          String jobTitle = "";
27         
28          long[] groupIds = null;
29          long[] organizationIds = null;
30          long[] roleIds = null;
31          long[] userGroupIds = null;
32         
33          boolean sendEmail = false;
34         
35         
36         
37          try {
38            User user = UserLocalServiceUtil.addUser(creatorUserId,
39                                                       companyId,
40                                                       autoPassword,
41                                                       password1,
42                                                       password2,
43                                                       autoScreenName,
44                                                       screenName,
45                                                       emailAddress,
46                                                       facebookId,
47                                                       openId,
48                                                       locale,
49                                                       firstName,
50                                                       middleName,
51                                                       lastName,
52                                                       prefixId,
53                                                       suffixId,
54                                                       male,
55                                                       birthdayMonth,
56                                                       birthdayDay,
57                                                       birthdayYear,
58                                                       jobTitle,
59                                                       groupIds,
60                                                       organizationIds,
61                                                       roleIds,
62                                                       userGroupIds,
63                                                       sendEmail,
64                                                       ServiceContextFactory.getInstance(request));
65        } catch (PortalException e) {
66            // TODO Auto-generated catch block
67            e.printStackTrace();
68        } catch (SystemException e) {
69            // TODO Auto-generated catch block
70            e.printStackTrace();
71        }


The error is
  1com.liferay.portal.DuplicateUserScreenNameException
  2    at com.liferay.portal.service.impl.UserLocalServiceImpl.validateScreenName(UserLocalServiceImpl.java:5762)
  3    at com.liferay.portal.service.impl.UserLocalServiceImpl.validate(UserLocalServiceImpl.java:5526)
  4    at com.liferay.portal.service.impl.UserLocalServiceImpl.addUserWithWorkflow(UserLocalServiceImpl.java:668)
  5    at com.liferay.portal.service.impl.UserLocalServiceImpl.addUser(UserLocalServiceImpl.java:539)
  6    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  7    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  8    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  9    at java.lang.reflect.Method.invoke(Method.java:597)
 10    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122)
 11    at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
 12    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
 13    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
 14    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
 15    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
 16    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
 17    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
 18    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
 19    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
 20    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
 21    at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
 22    at $Proxy97.addUser(Unknown Source)
 23    at com.liferay.portal.service.UserLocalServiceUtil.addUser(UserLocalServiceUtil.java:463)
 24    at com.test.Registrazione.processAction(Registrazione.java:89)
 25    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
 26    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
 27    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
 28    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 29    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 30    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 31    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
 32    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
 33    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 34    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 35    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
 36    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
 37    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
 38    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
 39    at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:579)
 40    at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:294)
 41    at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:944)
 42    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:688)
 43    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:249)
 44    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 45    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 46    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:176)
 47    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 48    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
 49    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
 50    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:560)
 51    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:537)
 52    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 53    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 54    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 55    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
 56    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 57    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 58    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 59    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 60    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 61    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
 62    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
 63    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
 64    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
 65    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
 66    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
 67    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 68    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 69    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
 70    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
 71    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
 72    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
 73    at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:138)
 74    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 75    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 76    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 77    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
 78    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 79    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 80    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
 81    at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:335)
 82    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
 83    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
 84    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
 85    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 86    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
 87    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
 88    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
 89    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
 90    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
 91    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
 92    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
 93    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
 94    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
 95    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
 96    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
 97    at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)
 98    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
 99    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
100    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
101    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
102    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
103    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
104    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
105    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:246)
106    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
107    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
108    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
109    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
110    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
111    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
112    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
113    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
114    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
115    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
116    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
117    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
118    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
119    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
120    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:216)
121    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
122    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
123    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
124    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
125    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
126    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
127    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
128    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
129    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
130    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
131    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
132    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
133    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
134    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
135    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
136    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
137    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
138    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
139    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
140    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
141    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
142    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
143    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
144    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
145    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
146    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
147    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
148    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
149    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
150    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
151    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
152    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
153    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
154    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
155    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
156    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
157    at java.lang.Thread.run(Thread.java:619)

How can I solve it?
Jan Geißler
RE: Development of login portlet
17 de enero de 2013 2:25
Respuesta

Jan Geißler

Ranking: Expert

Mensajes: 356

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

You already added a User with this particular screen name. You should change it, as Liferay doesn't allow you to have 2 Users with the same screen name.
I still don't understand why you insist on writing your own portlet, when your requirement can easily be met by a model listener with about 20 lines of code...
Nicolas Tamayo
RE: Development of login portlet
17 de enero de 2013 5:50
Respuesta

Nicolas Tamayo

Ranking: Junior Member

Mensajes: 29

Fecha de incorporación: 3 de octubre de 2012

Mensajes recientes

Hi Matt.

regarding to the Exception Jan have reason.

in the case that you want create a new Custom Portlet to Login, you must do all the Logic that involves the Creation Process of Liferay User (the funcionality that you already have), this is very simple because you just must use the Service of the Organization (for example: OrganizationLocalServiceUtil). in this case i can´t help you much.

in the case that you want make the Athentication Process; you must use the Login method in the LoginUtil Class, this class you can find it in the portlet-imp.jar, bacauser you can use the PortalClassInvokerClass to make the call to the method. int this case i can help you.

at this link you'll see how to user the PortalClassInvoker
Matt S.
RE: Development of login portlet
17 de enero de 2013 13:58
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

Hi,
The code I posted before is corret for creating a new user? (don't consider the exception) I ask this because I found other methods used for creating and adding user in part of code in which before is used UserLocalServiceUtil.create(userId), are used methods for setting parameters like user.setScreenName(name) and then the user is added with UserLocalServiceUtil.add(user). What's the difference?
At last to modify the Login Portlet of Liferay I have to use hook?

Regards
Nicolas Tamayo
RE: Development of login portlet
18 de enero de 2013 6:12
Respuesta

Nicolas Tamayo

Ranking: Junior Member

Mensajes: 29

Fecha de incorporación: 3 de octubre de 2012

Mensajes recientes

Hi Matt.

as my knownloedge covers about hooks, the hook only allows the customization over the:
  1. JPSs
  2. Services
  3. Portal Properties
  4. and Portal Language

whereby a hook not will be a good option to modify the functionlity that you want modifiy. so your option of customization for the Liferay Login Portlet, is the Ext Plugin.

in the case that you can't use the Hook Plugin, and the Ext plugin not will be the option that you prefer. Then the Custom Portlet is the Solution.

if you want use the Custom Portlet you have many options. all the options that you presented, are possible to add a user to the Liferay Database.

in my case, i use the UserServiceUtil.addUserWithWorkflow(.......);, this method is the used for the Liferay Login Portlet in the User Creation Process.

after making all the process to the User Registration. the Authentication Process is done for the LoginUtil.login(.....);, this method is called through PortalClassInvoker.

Regards.
Jan Geißler
RE: Development of login portlet
18 de enero de 2013 6:24
Respuesta

Jan Geißler

Ranking: Expert

Mensajes: 356

Fecha de incorporación: 5 de julio de 2011

Mensajes recientes

Correct me if I am wrong, but what I have understood so far is this one requirement:
There is an Organization where he wants to add the User Programatically after a new User has created his account.

So in my mind the easiest way to implement it would be a ModelListener where you only would have to overwrite:
onAfterCreate(User user)
and implement addUserToOrganization.... this is a 2 Liner... No need for ext or a custom LoginPortlet, as this would end up in 100 times more work.
Just my 2 cent.
Matt S.
RE: Development of login portlet
28 de enero de 2013 9:22
Respuesta

Matt S.

Ranking: Junior Member

Mensajes: 36

Fecha de incorporación: 29 de noviembre de 2012

Mensajes recientes

I'm sorry for late reply, I tried with ModelListener as you said me but I have an error in the liferay-hook.xml file, in particular when I put this code
1
2<hook>
3<portal-properties>portal.properties</portal-properties>
4</hook>


the error is
1
2Caused by: org.dom4j.DocumentException: Error on line 7 of document  : The content of element type "hook" must match "(portal-properties?,language-properties*,custom-jsp-dir?,custom-jsp-global?,indexer-post-processor*,service*,servlet-filter*,servlet-filter-mapping*,struts-action*)". Nested exception: The content of element type "hook" must match "(portal-properties?,language-properties*,custom-jsp-dir?,custom-jsp-global?,indexer-post-processor*,service*,servlet-filter*,servlet-filter-mapping*,struts-action*)".
3    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
4    at org.dom4j.io.SAXReader.read(SAXReader.java:365)
5    at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:396)
6    ... 28 more


In the portal properties file i wrote value.object.listener.com.liferay.portal.model.User=hook.AddUserListener , where AddUserListener is my class which extends BaseModelListener and it is in docroot/WEB-INF/src/hook directory. Where i'm wrong?