mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
use correct model and fix style
This commit is contained in:
parent
e21b89cc7c
commit
e957c9feb7
29 changed files with 105 additions and 111 deletions
|
@ -204,10 +204,11 @@ namespace controllers\publics;
|
|||
|
||||
return $this->redirect(\descartes\Router::url('Connect', 'login'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allow to stop impersonating a user
|
||||
* @param mixed $csrf
|
||||
* Allow to stop impersonating a user.
|
||||
*
|
||||
* @param mixed $csrf
|
||||
*/
|
||||
public function stop_impersonate()
|
||||
{
|
||||
|
@ -223,6 +224,7 @@ namespace controllers\publics;
|
|||
$_SESSION = $old_session;
|
||||
|
||||
\FlashMessage\FlashMessage::push('success', 'Vous n\'incarnez plus l\'utilisateur ' . $user_email . '.');
|
||||
|
||||
return $this->redirect(\descartes\Router::url('Dashboard', 'show'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,5 +164,4 @@ namespace controllers\publics;
|
|||
|
||||
return $this->redirect(\descartes\Router::url('Connect', 'login'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,12 +48,12 @@ namespace controllers\publics;
|
|||
|
||||
/**
|
||||
* Return receiveds as json.
|
||||
*
|
||||
*
|
||||
* @param bool $unread : Should we only search for unread messages
|
||||
*/
|
||||
public function list_json(bool $unread = false)
|
||||
{
|
||||
$draw = (int)($_GET['draw'] ?? false);
|
||||
$draw = (int) ($_GET['draw'] ?? false);
|
||||
|
||||
$columns = [
|
||||
0 => 'searchable_origin',
|
||||
|
|
|
@ -53,8 +53,7 @@ namespace controllers\publics;
|
|||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
||||
$draw = (int)($_GET['draw'] ?? false);
|
||||
$draw = (int) ($_GET['draw'] ?? false);
|
||||
|
||||
$columns = [
|
||||
0 => 'phone_name',
|
||||
|
|
|
@ -410,13 +410,13 @@ class User extends \descartes\Controller
|
|||
return $this->redirect(\descartes\Router::url('User', 'list'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allow an admin to impersonate a user
|
||||
* Allow an admin to impersonate a user.
|
||||
*
|
||||
* @param mixed $csrf
|
||||
* @param array int $_GET['user_ids'] : Ids of users to impersonate, the array should actually contain one id only, we keep use of array for simpler compatibility in UI
|
||||
*/
|
||||
public function impersonate ($csrf)
|
||||
public function impersonate($csrf)
|
||||
{
|
||||
if (!$this->verify_csrf($csrf))
|
||||
{
|
||||
|
@ -425,7 +425,7 @@ class User extends \descartes\Controller
|
|||
return $this->redirect(\descartes\Router::url('User', 'list'));
|
||||
}
|
||||
|
||||
if (count($_GET['user_ids']) != 1)
|
||||
if (1 != count($_GET['user_ids']))
|
||||
{
|
||||
\FlashMessage\FlashMessage::push('danger', 'Vous devez séléctionner un et un seul utilisateur à incarner !');
|
||||
|
||||
|
@ -460,17 +460,17 @@ class User extends \descartes\Controller
|
|||
|
||||
$user['settings'] = $settings;
|
||||
|
||||
//Save old session to get it back later
|
||||
//Save old session to get it back later
|
||||
$old_session = $_SESSION;
|
||||
$_SESSION = [
|
||||
'old_session' => $old_session,
|
||||
'old_session' => $old_session,
|
||||
'impersonate' => true,
|
||||
'connect' => true,
|
||||
'user' => $user,
|
||||
];
|
||||
|
||||
\FlashMessage\FlashMessage::push('success', 'Vous incarnez désormais l\'utilisateur ' . $user['email'] . '.');
|
||||
|
||||
return $this->redirect(\descartes\Router::url('Dashboard', 'show'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue