11<?php
22
3+ declare (strict_types=1 );
4+
35/**
46 * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
57 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
68 * SPDX-License-Identifier: AGPL-3.0-only
79 */
10+
811namespace OCA \User_LDAP \Mapping ;
912
1013use OCP \HintException ;
1114use OCP \IAppConfig ;
1215use OCP \ICacheFactory ;
1316use OCP \IDBConnection ;
1417use OCP \IRequest ;
15- use OCP \Server ;
1618use OCP \Support \Subscription \IAssertion ;
1719
1820/**
@@ -30,6 +32,7 @@ public function __construct(
3032 IAppConfig $ config ,
3133 bool $ isCLI ,
3234 private IAssertion $ assertion ,
35+ private IRequest $ request ,
3336 ) {
3437 parent ::__construct ($ dbc , $ cacheFactory , $ config , $ isCLI );
3538 }
@@ -41,13 +44,7 @@ public function map($fdn, $name, $uuid): bool {
4144 try {
4245 $ this ->assertion ->createUserIsLegit ();
4346 } catch (HintException $ e ) {
44- static $ isProvisioningApi = null ;
45-
46- if ($ isProvisioningApi === null ) {
47- $ request = Server::get (IRequest::class);
48- $ isProvisioningApi = \preg_match (self ::PROV_API_REGEX , $ request ->getRequestUri ()) === 1 ;
49- }
50- if ($ isProvisioningApi ) {
47+ if (\preg_match (self ::PROV_API_REGEX , $ this ->request ->getRequestUri ()) === 1 ) {
5148 // only throw when prov API is being used, since functionality
5249 // should not break for end users (e.g. when sharing).
5350 // On direct API usage, e.g. on users page, this is desired.
0 commit comments