Source
16
16
** You should have received a copy of the GNU General Public License
17
17
** along with this program; if not, write to the Free Software
18
18
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
**/
20
20
21
21
22
22
require __DIR__ . '/vendor/autoload.php';
23
23
require_once __DIR__.'/include/func.inc.php';
24
24
require_once __DIR__.'/include/classes/core/CHttpRequest.php';
25
25
require_once __DIR__.'/include/classes/core/APP.php';
26
-
require_once __DIR__.'/include/debug.inc.php';
27
26
28
27
use SCIM\API as SCIM;
29
28
use SCIM\clients\ScimApiClient;
30
29
use SCIM\HttpResponse;
31
30
use SCIM\services\Group;
32
31
use SCIM\services\ServiceProviderConfig;
33
32
use SCIM\services\User;
34
33
35
34
$request = new CHttpRequest(['PATH_INFO', 'QUERY_STRING']);
36
35
42
41
'users' => User::class,
43
42
'groups' => Group::class,
44
43
'serviceproviderconfig' => ServiceProviderConfig::class
45
44
]));
46
45
$scim = new SCIM();
47
46
48
47
$response = $scim->execute($client, $request);
49
48
}
50
49
catch (Throwable $e) {
51
50
$response = new HttpResponse();
51
+
$exception = $e instanceof APIException ? $e : new APIException(ZBX_API_ERROR_INTERNAL, $e->getMessage());
52
52
53
-
if (!$e->getCode() || $e instanceof APIException) {
54
-
$e = new Exception($e->getMessage(), 500);
55
-
}
56
-
57
-
$response->setException($e);
53
+
$response->setException($exception);
58
54
}
59
55
60
56
$response->send();