From 464a2960ee2d7089cff9c87fdb291f74b988f5b0 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 --- lib/fusionauth/fusionauth_client.rb | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/fusionauth/fusionauth_client.rb b/lib/fusionauth/fusionauth_client.rb index 2e3656a..1e13240 100644 --- a/lib/fusionauth/fusionauth_client.rb +++ b/lib/fusionauth/fusionauth_client.rb @@ -620,6 +620,21 @@ def create_theme(theme_id, request) .go end + # + # Adds the application tenants for universal applications. + # + # @param application_id [string] The Id of the application that the role belongs to. + # @param request [OpenStruct, Hash] The request object that contains all the information used to create the Entity. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def create_universal_application_tenants(application_id, request) + start.uri('/api/application') + .url_segment(application_id) + .url_segment("application-tenant") + .body_handler(FusionAuth::JSONBodyHandler.new(request)) + .post + .go + end + # # Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. # @@ -1136,6 +1151,36 @@ def delete_theme(theme_id) .go end + # + # Removes the specified tenant from the universal application tenants list. + # + # @param application_id [string] The Id of the application that the role belongs to. + # @param tenant_id [string] The Id of the tenant to delete from the universal application tenants list. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def delete_universal_application_tenant(application_id, tenant_id) + start.uri('/api/application') + .url_segment(application_id) + .url_segment("application-tenant") + .url_segment(tenant_id) + .delete + .go + end + + # + # Removes the specified tenants from the universal application tenants list. + # + # @param application_id [string] The Id of the universal application that the tenants are linked to. + # @param tenant_ids [Array] The Ids of the tenants to delete from the universal application tenants list. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def delete_universal_application_tenants(application_id, tenant_ids) + start.uri('/api/application') + .url_segment(application_id) + .url_segment("application-tenant") + .url_parameter('tenantIds', tenant_ids) + .delete + .go + end + # # Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated # with the user. @@ -3292,6 +3337,19 @@ def retrieve_two_factor_status(user_id, application_id, two_factor_trust_id) .go end + # + # Retrieves the application tenants for universal applications. + # + # @param application_id [string] The Id of the application that the role belongs to. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def retrieve_universal_application_tenants(application_id) + start.uri('/api/application') + .url_segment(application_id) + .url_segment("application-tenant") + .get + .go + end + # # Retrieves the user for the given Id. # From d9a73da49a317590369cd16420784aa577d912ca 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 --- lib/fusionauth/fusionauth_client.rb | 61 +++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/lib/fusionauth/fusionauth_client.rb b/lib/fusionauth/fusionauth_client.rb index 1e13240..0189440 100644 --- a/lib/fusionauth/fusionauth_client.rb +++ b/lib/fusionauth/fusionauth_client.rb @@ -623,13 +623,15 @@ def create_theme(theme_id, request) # # Adds the application tenants for universal applications. # - # @param application_id [string] The Id of the application that the role belongs to. - # @param request [OpenStruct, Hash] The request object that contains all the information used to create the Entity. + # @param application_id [string] The Id of the application that the universal application tenant belongs to. + # @param universal_application_tenant_id [string] (Optional) The Id of the universal application tenant. + # @param request [OpenStruct, Hash] The request object that contains all the information used to create the UniversalApplicationTenants. # @return [FusionAuth::ClientResponse] The ClientResponse object. - def create_universal_application_tenants(application_id, request) + def create_universal_application_tenant(application_id, universal_application_tenant_id, request) start.uri('/api/application') .url_segment(application_id) - .url_segment("application-tenant") + .url_segment("universal-application-tenant") + .url_segment(universal_application_tenant_id) .body_handler(FusionAuth::JSONBodyHandler.new(request)) .post .go @@ -1152,16 +1154,16 @@ def delete_theme(theme_id) end # - # Removes the specified tenant from the universal application tenants list. + # Deletes the universal application tenant. # - # @param application_id [string] The Id of the application that the role belongs to. - # @param tenant_id [string] The Id of the tenant to delete from the universal application tenants list. + # @param application_id [string] The Id of the application that the UniversalApplicationTenant belongs to. + # @param universal_application_tenant_id [string] The Id of the UniversalApplicationTenant to delete. # @return [FusionAuth::ClientResponse] The ClientResponse object. - def delete_universal_application_tenant(application_id, tenant_id) + def delete_universal_application_tenant(application_id, universal_application_tenant_id) start.uri('/api/application') .url_segment(application_id) - .url_segment("application-tenant") - .url_segment(tenant_id) + .url_segment("universal-application-tenant") + .url_segment(universal_application_tenant_id) .delete .go end @@ -3338,14 +3340,16 @@ def retrieve_two_factor_status(user_id, application_id, two_factor_trust_id) end # - # Retrieves the application tenants for universal applications. + # Retrieves the universal application tenant. # - # @param application_id [string] The Id of the application that the role belongs to. + # @param application_id [string] The Id of the universal application that tenant is mapped to + # @param universal_application_tenant_id [string] The Id of the universal application tenant. # @return [FusionAuth::ClientResponse] The ClientResponse object. - def retrieve_universal_application_tenants(application_id) + def retrieve_universal_application_tenant(application_id, universal_application_tenant_id) start.uri('/api/application') .url_segment(application_id) .url_segment("application-tenant") + .url_segment(universal_application_tenant_id) .get .go end @@ -4076,6 +4080,20 @@ def search_themes(request) .go end + # + # Searches universal application tenants for the specified applicationId and with the specified criteria and pagination. + # + # @param request [OpenStruct, Hash] The search criteria and pagination information. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def search_universal_application_tenants(request) + start.uri('/api/application') + .url_segment("universal-application-tenant") + .url_segment("search") + .body_handler(FusionAuth::JSONBodyHandler.new(request)) + .post + .go + end + # # Searches user comments with the specified criteria and pagination. # @@ -4701,6 +4719,23 @@ def update_theme(theme_id, request) .go end + # + # Adds the application tenants for universal applications. + # + # @param application_id [string] The Id of the application that the UniversalApplicationTenant belongs to. + # @param universal_application_tenant_id [string] The Id of the universal application tenant. + # @param request [OpenStruct, Hash] The request object that contains all the information used to create the UniversalApplicationTenant. + # @return [FusionAuth::ClientResponse] The ClientResponse object. + def update_universal_application_tenant(application_id, universal_application_tenant_id, request) + start.uri('/api/application') + .url_segment(application_id) + .url_segment("universal-application-tenant") + .url_segment(universal_application_tenant_id) + .body_handler(FusionAuth::JSONBodyHandler.new(request)) + .put + .go + end + # # Updates the user with the given Id. #