From 9a4ff6684a10f80a5b3431831c97bde1111c9186 Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Thu, 26 Jun 2025 16:41:37 -0600 Subject: [PATCH 1/2] add the application-tenant api and move it out of the application object --- src/FusionAuth/FusionAuthClient.php | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/FusionAuth/FusionAuthClient.php b/src/FusionAuth/FusionAuthClient.php index 19943ec..65a4019 100644 --- a/src/FusionAuth/FusionAuthClient.php +++ b/src/FusionAuth/FusionAuthClient.php @@ -802,6 +802,25 @@ public function createTheme($themeId, $request) ->go(); } + /** + * Adds the application tenants for universal applications. + * + * @param string $applicationId The Id of the application that the role belongs to. + * @param array $request The request object that contains all the information used to create the Entity. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function createUniversalApplicationTenants($applicationId, $request) + { + return $this->start()->uri("/api/application") + ->urlSegment($applicationId) + ->urlSegment("application-tenant") + ->bodyHandler(new JSONBodyHandler($request)) + ->post() + ->go(); + } + /** * Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. * @@ -1474,6 +1493,44 @@ public function deleteTheme($themeId) ->go(); } + /** + * Removes the specified tenant from the universal application tenants list. + * + * @param string $applicationId The Id of the application that the role belongs to. + * @param string $tenantId The Id of the tenant to delete from the universal application tenants list. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function deleteUniversalApplicationTenant($applicationId, $tenantId) + { + return $this->start()->uri("/api/application") + ->urlSegment($applicationId) + ->urlSegment("application-tenant") + ->urlSegment($tenantId) + ->delete() + ->go(); + } + + /** + * Removes the specified tenants from the universal application tenants list. + * + * @param string $applicationId The Id of the universal application that the tenants are linked to. + * @param array $tenantIds The Ids of the tenants to delete from the universal application tenants list. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function deleteUniversalApplicationTenants($applicationId, $tenantIds) + { + return $this->start()->uri("/api/application") + ->urlSegment($applicationId) + ->urlSegment("application-tenant") + ->urlParameter("tenantIds", $tenantIds) + ->delete() + ->go(); + } + /** * Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated * with the user. @@ -4270,6 +4327,23 @@ public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrust ->go(); } + /** + * Retrieves the application tenants for universal applications. + * + * @param string $applicationId The Id of the application that the role belongs to. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function retrieveUniversalApplicationTenants($applicationId) + { + return $this->start()->uri("/api/application") + ->urlSegment($applicationId) + ->urlSegment("application-tenant") + ->get() + ->go(); + } + /** * Retrieves the user for the given Id. * From 02982ded00249364acfa9fe0e90f6b367bf7f983 Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Mon, 7 Jul 2025 15:14:17 -0600 Subject: [PATCH 2/2] separate out the universal config and update clients --- src/FusionAuth/FusionAuthClient.php | 69 +++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/src/FusionAuth/FusionAuthClient.php b/src/FusionAuth/FusionAuthClient.php index 65a4019..f4e2865 100644 --- a/src/FusionAuth/FusionAuthClient.php +++ b/src/FusionAuth/FusionAuthClient.php @@ -805,17 +805,19 @@ public function createTheme($themeId, $request) /** * Adds the application tenants for universal applications. * - * @param string $applicationId The Id of the application that the role belongs to. - * @param array $request The request object that contains all the information used to create the Entity. + * @param string $applicationId The Id of the application that the universal application tenant belongs to. + * @param string $universalApplicationTenantId (Optional) The Id of the universal application tenant. + * @param array $request The request object that contains all the information used to create the UniversalApplicationTenants. * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function createUniversalApplicationTenants($applicationId, $request) + public function createUniversalApplicationTenant($applicationId, $universalApplicationTenantId, $request) { return $this->start()->uri("/api/application") ->urlSegment($applicationId) - ->urlSegment("application-tenant") + ->urlSegment("universal-application-tenant") + ->urlSegment($universalApplicationTenantId) ->bodyHandler(new JSONBodyHandler($request)) ->post() ->go(); @@ -1494,20 +1496,20 @@ public function deleteTheme($themeId) } /** - * Removes the specified tenant from the universal application tenants list. + * Deletes the universal application tenant. * - * @param string $applicationId The Id of the application that the role belongs to. - * @param string $tenantId The Id of the tenant to delete from the universal application tenants list. + * @param string $applicationId The Id of the application that the UniversalApplicationTenant belongs to. + * @param string $universalApplicationTenantId The Id of the UniversalApplicationTenant to delete. * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function deleteUniversalApplicationTenant($applicationId, $tenantId) + public function deleteUniversalApplicationTenant($applicationId, $universalApplicationTenantId) { return $this->start()->uri("/api/application") ->urlSegment($applicationId) - ->urlSegment("application-tenant") - ->urlSegment($tenantId) + ->urlSegment("universal-application-tenant") + ->urlSegment($universalApplicationTenantId) ->delete() ->go(); } @@ -4328,18 +4330,20 @@ public function retrieveTwoFactorStatus($userId, $applicationId, $twoFactorTrust } /** - * Retrieves the application tenants for universal applications. + * Retrieves the universal application tenant. * - * @param string $applicationId The Id of the application that the role belongs to. + * @param string $applicationId The Id of the universal application that tenant is mapped to + * @param string $universalApplicationTenantId The Id of the universal application tenant. * * @return ClientResponse The ClientResponse. * @throws \Exception */ - public function retrieveUniversalApplicationTenants($applicationId) + public function retrieveUniversalApplicationTenant($applicationId, $universalApplicationTenantId) { return $this->start()->uri("/api/application") ->urlSegment($applicationId) ->urlSegment("application-tenant") + ->urlSegment($universalApplicationTenantId) ->get() ->go(); } @@ -5290,6 +5294,24 @@ public function searchThemes($request) ->go(); } + /** + * Searches universal application tenants for the specified applicationId and with the specified criteria and pagination. + * + * @param array $request The search criteria and pagination information. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function searchUniversalApplicationTenants($request) + { + return $this->start()->uri("/api/application") + ->urlSegment("universal-application-tenant") + ->urlSegment("search") + ->bodyHandler(new JSONBodyHandler($request)) + ->post() + ->go(); + } + /** * Searches user comments with the specified criteria and pagination. * @@ -6099,6 +6121,27 @@ public function updateTheme($themeId, $request) ->go(); } + /** + * Adds the application tenants for universal applications. + * + * @param string $applicationId The Id of the application that the UniversalApplicationTenant belongs to. + * @param string $universalApplicationTenantId The Id of the universal application tenant. + * @param array $request The request object that contains all the information used to create the UniversalApplicationTenant. + * + * @return ClientResponse The ClientResponse. + * @throws \Exception + */ + public function updateUniversalApplicationTenant($applicationId, $universalApplicationTenantId, $request) + { + return $this->start()->uri("/api/application") + ->urlSegment($applicationId) + ->urlSegment("universal-application-tenant") + ->urlSegment($universalApplicationTenantId) + ->bodyHandler(new JSONBodyHandler($request)) + ->put() + ->go(); + } + /** * Updates the user with the given Id. *