From 220c9900ccc86bd1e0a1a27e2df6cf1d98c046ae Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Wed, 14 Mar 2018 11:42:41 +0100 Subject: [PATCH] FEAT #194 Redirect to administration when superadmin --- apps/maarch_entreprise/index.php | 37 +++++++------------ apps/maarch_entreprise/log.php | 3 ++ .../contact/controllers/ContactController.php | 9 ++--- .../contact/models/ContactModelAbstract.php | 2 - 4 files changed, 20 insertions(+), 31 deletions(-) diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php index 469c1a6dfbf..4619814a3ca 100755 --- a/apps/maarch_entreprise/index.php +++ b/apps/maarch_entreprise/index.php @@ -1,22 +1,10 @@ <?php -/* -* Copyright 2008-2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ +/** + * Copyright Maarch since 2008 under licence GPLv3. + * See LICENCE.txt file at the root folder for more details. + * This file is part of Maarch software. + * + */ /****************************************************************************/ /* */ @@ -30,11 +18,7 @@ * @brief Maarch index page : every php page is loaded with this page * * @file -* @author Claire Figueras <dev@maarch.org> -* @author Laurent Giovannoni <dev@maarch.org> -* @author Loic Vinet <dev@maarch.org> -* @date $date$ -* @version $Revision$ +* @author <dev@maarch.org> * @ingroup apps */ include_once '../../core/class/class_functions.php'; @@ -371,4 +355,11 @@ if (file_exists($path)) { </div> </div> </body> + <?php + if ($_SESSION['user']['UserId'] == 'superadmin' && !empty($_REQUEST['administration'])) { + ?> + <script>triggerAngular(true, '#/administration')</script> + <?php + } + ?> </html> diff --git a/apps/maarch_entreprise/log.php b/apps/maarch_entreprise/log.php index c777fe8e010..fafa2d9bd0e 100755 --- a/apps/maarch_entreprise/log.php +++ b/apps/maarch_entreprise/log.php @@ -312,6 +312,9 @@ if (! empty($_SESSION['error'])) { $res['url'] = 'index.php?display=true&page=login'; } } + if ($_SESSION['user']['UserId'] == 'superadmin') { + $res['url'] .= '?administration=true'; + } header( 'location: ' . $_SESSION['config']['businessappurl'] . $res['url'] ); diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index 30155b33020..abe58c6e7cc 100644 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -72,7 +72,8 @@ class ContactController return $response->withJson(['contactId' => $contactId, 'addressId' => $addressId]); } - public function getCheckCommunication(Request $request, Response $response, $aArgs) { + public function getCheckCommunication(Request $request, Response $response, $aArgs) + { $data = $request->getParams(); if (isset($data['contactId'])) { @@ -86,11 +87,7 @@ class ContactController ->withJson(['errors' => _ID . ' ' . _IS_EMPTY]); } - $data = [ - $obj, - ]; - - return $response->withJson($data); + return $response->withJson([$obj]); } diff --git a/src/app/contact/models/ContactModelAbstract.php b/src/app/contact/models/ContactModelAbstract.php index 29d77be0b45..903efd17b90 100644 --- a/src/app/contact/models/ContactModelAbstract.php +++ b/src/app/contact/models/ContactModelAbstract.php @@ -222,6 +222,4 @@ class ContactModelAbstract return $aReturn[0]; } - - } -- GitLab