1 /*******************************************************************************
2 * Copyright � Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
3 * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
4 * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
6 * This file is part of the work and learning management system Pentila Nero.
8 * Pentila Nero is free software. You can redistribute it and/or modify since
9 * you respect the terms of either (at least one of the both license) :
10 * - under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 * - the CeCILL-C as published by CeCILL-C; either version 1 of the
14 * License, or any later version
15 * - the GNU Lesser General Public License as published by the
16 * Free Software Foundation, either version 3 of the license,
17 * or (at your option) any later version.
19 * There are special exceptions to the terms and conditions of the
20 * licenses as they are applied to this software. View the full text of
21 * the exception in file LICENSE-PROJECT.txt in the directory of this software
24 * Pentila Nero is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * Licenses for more details.
29 * You should have received a copy of the GNU Affero General Public License
30 * and the CeCILL-C and the GNU Lesser General Public License along with
31 * Pentila Nero. If not, see :
32 * <http://www.gnu.org/licenses/> and
33 * <http://www.cecill.info/licences.fr.html>.
34 ******************************************************************************/
35 package com.pentila.entSavoie.actions;
37 import javax.servlet.http.HttpServletRequest;
38 import javax.servlet.http.HttpServletResponse;
40 import com.liferay.portal.kernel.events.Action;
41 import com.liferay.portal.kernel.events.ActionException;
42 import com.liferay.portal.kernel.exception.PortalException;
43 import com.liferay.portal.kernel.exception.SystemException;
44 import com.liferay.portal.kernel.log.Log;
45 import com.liferay.portal.kernel.log.LogFactoryUtil;
46 import com.liferay.portal.model.User;
47 import com.liferay.portal.util.PortalUtil;
48 import com.pentila.entSavoie.userProperties.model.UserProperties;
49 import com.pentila.entSavoie.userProperties.service.UserPropertiesLocalServiceUtil;
50 import com.pentila.entSavoie.utils.ENTMainUtilsLocalServiceUtil;
51 import com.pentila.entSavoie.utils.XmppUtil;
54 * @author Lancelot SIX
57 public class XmppCheckOnLoginAction extends Action {
60 public void run(HttpServletRequest arg0, HttpServletResponse arg1)
61 throws ActionException {
63 final User user = PortalUtil.getUser(arg0);
65 // If the chat is enabled and
66 // If the user does not have jabber id and password stored in userproperties
67 // Then we create an account for him
69 if (ENTMainUtilsLocalServiceUtil.isXmppEnable(user.getCompanyId())) {
71 UserProperties prop = UserPropertiesLocalServiceUtil.getUserPropertiesByUserId(user.getUserId());
72 if (prop.getJabberId() != null && !prop.getJabberId().equals("")) {
75 XmppUtil.createAccount(user);
78 } catch (PortalException e) {
80 } catch (SystemException e) {
85 private Log _log = LogFactoryUtil.getLog(this.getClass());