From e24a35639e55936ec5113e4fd4f1b3baddf03fe7 Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Thu, 26 Jun 2025 16:41:36 -0600 Subject: [PATCH 1/2] add the application-tenant api and move it out of the application object --- .../python/fusionauth/fusionauth_client.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/main/python/fusionauth/fusionauth_client.py b/src/main/python/fusionauth/fusionauth_client.py index e635856..931d97f 100644 --- a/src/main/python/fusionauth/fusionauth_client.py +++ b/src/main/python/fusionauth/fusionauth_client.py @@ -615,6 +615,21 @@ def create_theme(self, request, theme_id=None): .post() \ .go() + def create_universal_application_tenants(self, application_id, request): + """ + Adds the application tenants for universal applications. + + Attributes: + application_id: The Id of the application that the role belongs to. + request: The request object that contains all the information used to create the Entity. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .body_handler(JSONBodyHandler(request)) \ + .post() \ + .go() + def create_user(self, request, user_id=None): """ Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. @@ -1131,6 +1146,36 @@ def delete_theme(self, theme_id): .delete() \ .go() + def delete_universal_application_tenant(self, application_id, tenant_id): + """ + Removes the specified tenant from the universal application tenants list. + + Attributes: + application_id: The Id of the application that the role belongs to. + tenant_id: The Id of the tenant to delete from the universal application tenants list. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .url_segment(tenant_id) \ + .delete() \ + .go() + + def delete_universal_application_tenants(self, application_id, tenant_ids): + """ + Removes the specified tenants from the universal application tenants list. + + Attributes: + application_id: The Id of the universal application that the tenants are linked to. + tenant_ids: The Ids of the tenants to delete from the universal application tenants list. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .url_parameter('tenantIds', self.convert_true_false(tenant_ids)) \ + .delete() \ + .go() + def delete_user(self, user_id): """ Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated @@ -3287,6 +3332,19 @@ def retrieve_two_factor_status(self, user_id, application_id, two_factor_trust_i .get() \ .go() + def retrieve_universal_application_tenants(self, application_id): + """ + Retrieves the application tenants for universal applications. + + Attributes: + application_id: The Id of the application that the role belongs to. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .get() \ + .go() + def retrieve_user(self, user_id): """ Retrieves the user for the given Id. From 9d6edb5249dbdd643bfc55d856e0c290758ff797 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 --- .../python/fusionauth/fusionauth_client.py | 61 +++++++++++++++---- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/src/main/python/fusionauth/fusionauth_client.py b/src/main/python/fusionauth/fusionauth_client.py index 931d97f..56145fc 100644 --- a/src/main/python/fusionauth/fusionauth_client.py +++ b/src/main/python/fusionauth/fusionauth_client.py @@ -615,17 +615,19 @@ def create_theme(self, request, theme_id=None): .post() \ .go() - def create_universal_application_tenants(self, application_id, request): + def create_universal_application_tenant(self, application_id, request, universal_application_tenant_id=None): """ Adds the application tenants for universal applications. Attributes: - application_id: The Id of the application that the role belongs to. - request: The request object that contains all the information used to create the Entity. + application_id: The Id of the application that the universal application tenant belongs to. + universal_application_tenant_id: (Optional) The Id of the universal application tenant. + request: The request object that contains all the information used to create the UniversalApplicationTenants. """ return self.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(JSONBodyHandler(request)) \ .post() \ .go() @@ -1146,18 +1148,18 @@ def delete_theme(self, theme_id): .delete() \ .go() - def delete_universal_application_tenant(self, application_id, tenant_id): + def delete_universal_application_tenant(self, application_id, universal_application_tenant_id): """ - Removes the specified tenant from the universal application tenants list. + Deletes the universal application tenant. Attributes: - application_id: The Id of the application that the role belongs to. - tenant_id: The Id of the tenant to delete from the universal application tenants list. + application_id: The Id of the application that the UniversalApplicationTenant belongs to. + universal_application_tenant_id: The Id of the UniversalApplicationTenant to delete. """ return self.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() @@ -3332,16 +3334,18 @@ def retrieve_two_factor_status(self, user_id, application_id, two_factor_trust_i .get() \ .go() - def retrieve_universal_application_tenants(self, application_id): + def retrieve_universal_application_tenant(self, application_id, universal_application_tenant_id): """ - Retrieves the application tenants for universal applications. + Retrieves the universal application tenant. Attributes: - application_id: The Id of the application that the role belongs to. + application_id: The Id of the universal application that tenant is mapped to + universal_application_tenant_id: The Id of the universal application tenant. """ return self.start().uri('/api/application') \ .url_segment(application_id) \ .url_segment("application-tenant") \ + .url_segment(universal_application_tenant_id) \ .get() \ .go() @@ -4071,6 +4075,20 @@ def search_themes(self, request): .post() \ .go() + def search_universal_application_tenants(self, request): + """ + Searches universal application tenants for the specified applicationId and with the specified criteria and pagination. + + Attributes: + request: The search criteria and pagination information. + """ + return self.start().uri('/api/application') \ + .url_segment("universal-application-tenant") \ + .url_segment("search") \ + .body_handler(JSONBodyHandler(request)) \ + .post() \ + .go() + def search_user_comments(self, request): """ Searches user comments with the specified criteria and pagination. @@ -4696,6 +4714,23 @@ def update_theme(self, theme_id, request): .put() \ .go() + def update_universal_application_tenant(self, application_id, universal_application_tenant_id, request): + """ + Adds the application tenants for universal applications. + + Attributes: + application_id: The Id of the application that the UniversalApplicationTenant belongs to. + universal_application_tenant_id: The Id of the universal application tenant. + request: The request object that contains all the information used to create the UniversalApplicationTenant. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("universal-application-tenant") \ + .url_segment(universal_application_tenant_id) \ + .body_handler(JSONBodyHandler(request)) \ + .put() \ + .go() + def update_user(self, user_id, request): """ Updates the user with the given Id.