FIX: API access for deactivated users

This commit is contained in:
Ferran Marcet 2023-01-18 10:48:18 +01:00
parent 1aa2427fd2
commit cb96378031

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -147,6 +148,9 @@ class DolibarrApiAccess implements iAuthenticate
if ($result <= 0) { if ($result <= 0) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')'); throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
} }
if ($fuser->statut == 0) {
throw new RestException(503, 'Error when fetching user. This user has been locked or disabled');
}
$fuser->getrights(); $fuser->getrights();