Tenant rights management method, system, device and medium for SaaS platform

Through the database routing component, connect the tenant server and database cluster in the SaaS platform, handle tenant business requests, solve the data integrity problem in an off-grid environment, ensure the normal execution of business requests, and improve user experience and system availability.

CN118484796BActive Publication Date: 2024-11-01宁波安得智联科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410940862.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-01
Estimated Expiration
2044-07-15

AI Technical Summary

Technical Problem

In the tenant permission management system of the SaaS platform, when the server is off-grid operation from the central environment, data integrity is difficult to guarantee, resulting in limited system functions and inability to execute tenant business requests normally, affecting user experience.

Method used

Connect the tenant server and the tenant database cluster through the database routing component, receive and process the tenant's business requests, obtain tenant information, find the database access address, execute the database access request, and send the results to the server to ensure the normal processing of business requests. Avoid relying on central environments.

Benefits of technology

In both networked and off-grid environments, the tenant's business needs can be normally supported, the user experience can be improved, and the tenant's server can effectively handle business requests, meeting the needs of centralized and localized deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118484796B_ABST
    Figure CN118484796B_ABST
Patent Text Reader

Abstract

The present application discloses a tenant rights management method, system, device and medium of a SaaS platform, which relates to the field of data management technology and is applied to a database routing component, which is used to connect a tenant database cluster and a tenant server. The tenant rights management method of the SaaS platform includes receiving a database access request triggered by a business request initiated by a target tenant, and obtaining the tenant information of the target tenant; searching in a preset routing table to obtain a database access address corresponding to the tenant information; based on the database access address, executing a database access request, obtaining an access result of the tenant database cluster, and sending the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result. The present application can ensure that the business needs of tenants can be normally supported in both an online environment and an off-line environment, so as to enhance the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data management technology, and in particular to a tenant rights management method, system, device and medium for a SaaS platform. Background Art

[0002] SaaS (Software as a Service) is a service model that provides software applications through the Internet. Tenants are the smallest unit for isolating user data in the SaaS platform.

[0003] In the tenant rights management system of the SaaS platform, when the server runs out of the central environment of the SaaS platform and attempts to operate off-network, the integrity of the data is difficult to guarantee, and some functions in the system are restricted, often unable to maintain its normal operation, and thus unable to execute the business requests initiated by the tenants. Therefore, how to ensure that the business needs of tenants can be supported normally in both online and offline environments to improve the user experience is a problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of this application is to provide a tenant rights management method, system, device and medium for a SaaS platform, aiming to ensure that the business needs of tenants can be normally supported in both online and offline environments to enhance the user experience.

[0005] To achieve the above purpose, the present application provides a tenant rights management method for a SaaS platform, which is applied to a database routing component, wherein the database routing component is used to connect a tenant database cluster and a tenant server, and the method includes:

[0006] Receiving a database access request triggered by a service request initiated by a target tenant, and obtaining tenant information of the target tenant;

[0007] Searching in a preset routing table to obtain a database access address corresponding to the tenant information;

[0008] Based on the database access address, the database access request is executed to obtain the access result of the tenant database cluster, and the access result is sent to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result.

[0009] In one embodiment, the step of obtaining the tenant information of the target tenant includes:

[0010] The tenant information of the target tenant is obtained from the thread context managed based on the Transmittable ThreadLocal.

[0011] In one embodiment, before the step of obtaining the tenant information of the target tenant, the method further includes:

[0012] Receiving a service request initiated by a target tenant, parsing the service request, and obtaining tenant information of the target tenant carried in the service request;

[0013] The tenant information of the target tenant is written into the thread context managed based on the Transmittable ThreadLocal.

[0014] In one embodiment, before the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information, the method further includes:

[0015] Verifying, based on the tenant information, whether the target tenant has access rights to the tenant database cluster;

[0016] If so, the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information is executed.

[0017] In addition, to achieve the above purpose, the present application also provides a multi-tenant rights management method of a SaaS platform, which is applied to a tenant server, wherein the tenant server is connected to a tenant database cluster through a database routing component, and the method includes:

[0018] Triggering a database access request by executing the received business request initiated by the target tenant;

[0019] Sending the database access request to the database routing component, so that the database routing component executes the database access request based on the database access address, obtains the access result of the tenant database cluster, and sends the access result to the tenant server; wherein the database access address is obtained by the database routing component by searching in a preset routing table based on the tenant information of the target tenant obtained;

[0020] Receive the access result sent by the tenant server, and determine whether to complete the processing flow of the business request based on the access result.

[0021] In one embodiment, the method further comprises:

[0022] Acquire the data to be stored generated in the process of executing the business request, and store the data to be stored in the message queue of the tenant server;

[0023] If it is detected that the tenant server establishes a connection with the central control end, after the connection between the tenant server and the central control end is established, the data of the message queue of the tenant server and the message queue of the central control end are synchronized.

[0024] In one embodiment, the method further comprises:

[0025] When the tenant server is connected to the central control end, if it is detected that the data query request initiated by the central control end cannot be executed on the central control end, the tenant server receives and executes the data query request initiated by the central control end.

[0026] In addition, to achieve the above purpose, the present application also provides a tenant rights management system for a SaaS platform, the system comprising a tenant database cluster, a tenant server and a database routing component, the database routing component being used to connect the tenant database cluster and the tenant server;

[0027] The tenant server is used to receive a service request initiated by a target tenant, execute the service request initiated by the target tenant, trigger a database access request, and send the database access request to the database routing component;

[0028] The database routing component is used to receive the database access request and obtain the tenant information of the target tenant; search in a preset routing table to obtain the database access address corresponding to the tenant information; based on the database access address, execute the database access request to obtain the access result of the tenant database cluster, and send the access result to the tenant server;

[0029] The tenant server is also used to receive the access result sent by the tenant server, and determine whether to complete the processing flow of the business request based on the access result.

[0030] In addition, to achieve the above-mentioned purpose, the present application also provides an electronic device, which includes a memory, a processor, and a tenant rights management program of a SaaS platform stored in the memory and runnable on the processor, and when the automatic control program is executed by the processor, the steps of the tenant rights management method of the SaaS platform as described above are implemented.

[0031] In addition, to achieve the above-mentioned purpose, the present application also provides a medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the tenant rights management method of the SaaS platform as described above are implemented.

[0032] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the tenant rights management method of the SaaS platform as described above.

[0033] The present application provides a tenant rights management method for a SaaS platform, which assists the tenant server to effectively process the tenant's business request by connecting the tenant server and the tenant database cluster using a database routing component to ensure the normal execution of the business request. Specifically, the method receives a database access request triggered by a business request initiated by a target tenant through a database routing component, and obtains the tenant information of the target tenant; then the database routing component searches for the database access address corresponding to the tenant information in a preset routing table; then the database routing component executes the database access request based on the database access address, obtains the access result of the tenant database cluster, and sends the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result. Therefore, the method proposed in the present application does not need to rely on the central environment (i.e., the central control end) of the SaaS platform in the process of using the database routing component to assist the tenant server to effectively process the tenant's business request. This ensures that the tenant's business needs can be normally supported in both the networked environment and the off-network environment to enhance the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0036] Figure 1 A topology diagram of a tenant rights management system of a SaaS platform involved in an embodiment of the present application;

[0037] Figure 2 A data model diagram of a tenant rights management system of a SaaS platform involved in an embodiment of the present application;

[0038] Figure 3 A flowchart of the first embodiment of the tenant rights management method of the SaaS platform of the present application embodiment is provided;

[0039] Figure 4A flowchart diagram of a third embodiment of a tenant rights management method for a SaaS platform according to an embodiment of the present application;

[0040] Figure 5 A schematic diagram of the implementation process of the tenant rights management system of the SaaS platform involved in the embodiment of the present application;

[0041] Figure 6 A schematic diagram of the structure of the hardware operating environment involved in the embodiments of the present application.

[0042] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0043] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0044] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0045] In the tenant rights management system of the SaaS platform, when the server runs out of the central environment of the SaaS platform and attempts to operate off-network, the integrity of the data is difficult to guarantee, and some functions in the system are restricted, often unable to maintain its normal operation, and thus unable to execute the business requests initiated by the tenants. Therefore, how to ensure that the business needs of tenants can be supported normally in both online and offline environments to improve the user experience is a problem that needs to be solved urgently.

[0046] The present application provides a tenant rights management method for a SaaS platform, which assists the tenant server to effectively process the tenant's business request by connecting the tenant server and the tenant database cluster using a database routing component to ensure the normal execution of the business request. Specifically, the method receives a database access request triggered by a business request initiated by a target tenant through a database routing component, and obtains the tenant information of the target tenant; then the database routing component searches for the database access address corresponding to the tenant information in a preset routing table; then the database routing component executes the database access request based on the database access address, obtains the access result of the tenant database cluster, and sends the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result. Therefore, the method proposed in the present application does not need to rely on the central environment (i.e., the central control end) of the SaaS platform in the process of using the database routing component to assist the tenant server to effectively process the tenant's business request. This ensures that the tenant's business needs can be normally supported in both the networked environment and the off-network environment to enhance the user experience.

[0047] In addition, in the SaaS platform, centralized architecture and localized deployment are relatively contradictory requirements. At present, it is impossible to maintain unified management and control of the SaaS center under the premise of physical isolation of tenant data. In this regard, this application ensures the data consistency between the central control end and the tenant server through message middleware (i.e. data synchronization through message queues) and proxy access mode (i.e. the tenant server proxy executes the data query request initiated by the central control end), so that the two can be dynamically plugged and unplugged, thereby meeting the needs of centralized architecture and localized deployment at the same time.

[0048] The execution subject of the tenant rights management method of the SaaS platform of the present application may be an electronic device capable of realizing data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc.; the execution subject may also be a control system, a control circuit, etc. capable of realizing data processing, network communication and program running functions; it may also be a tenant rights management system of the SaaS platform. This embodiment does not specifically limit this.

[0049] The tenant rights management system of the SaaS platform can be as follows: Figure 1 The topology mentioned above, the central control end and the tenant server mentioned below, namely Figure 1 The central control server and tenant server cluster in the . The databases of each tenant are placed in their own database clusters, which are physically isolated from each other. The tenant database cluster and the tenant server cluster can be authorized to the SaaS service provider to be hosted on the public network or placed on the self-built private network according to the tenant's own needs for data security (when the tenant database cluster and the tenant server cluster are both deployed on the private network, a completely localized deployment is achieved). The tenant server cluster deployed on the public network will be uniformly controlled by the central control server, thereby realizing centralized application and tenant management. The tenant server cluster deployed on the private network can also choose to connect to the central control server, but the tenant needs to provide a gateway to connect different network segments separately. Different tenant server clusters can be configured with different database routing components, and the tenant database clusters allowed to be accessed by the database routing components can be customized.

[0050] For further information, please refer to Figure 2 , Figure 2The black bottom part is divided into the data model of the central control server (corresponding to the central control database), and the white bottom part is divided into the data model of the permission server in the tenant server cluster (corresponding to the permission database). Among them, the tables in the data model of the permission server all carry the tenant code (tenant_code) field, which is used as the basis for the physical isolation of tenant data and the division of database routing component routing; the data model of the application server can also be customized, but the data model of the application server must be the same as the data model of the permission server, and its table must carry the tenant code. In addition, the data model of the permission server is based on the RBAC (Role-Based Access Control) model. By dividing the permissions into resource permissions and data permissions, the data permissions can be separated separately to improve the response efficiency of the database.

[0051] In addition, the data model of the permission server can operate independently, but the permissions, users and other data owned by the tenants need to be written by the central control server. In other words, in the case of local deployment, tenants cannot open users or permissions for themselves. They can only be opened by the central control server after connecting to the public network. In this way, paid SaaS expansion services can be provided while ensuring the security of user data and servers. Among them, the scope that the central control server can control can be as shown in Table 1 below.

[0052] Table 1:

[0053]

[0054] In addition, the tables in the data model of the central control server and the tables in the data model of the authority server have a strong association. Data synchronization can be achieved through message middleware (that is, data synchronization is achieved through message queues), proxy interfaces, distributed transactions, etc.

[0055] Based on the above content, this application proposes a tenant rights management method of a SaaS platform of the first embodiment, which is applied to a database routing component. The database routing component is used to connect a tenant database cluster and a tenant server. Please refer to Figure 3 , the tenant rights management method of the SaaS platform includes steps S10~S30:

[0056] Step S10, receiving a database access request triggered by a service request initiated by a target tenant, and obtaining tenant information of the target tenant;

[0057] It should be noted that the number of target tenants can be one or more, and this embodiment does not specifically limit this. The specific operation or task requirements issued by the target tenant through the user interface or application program interface of the SaaS platform are the business requests initiated by the target tenant. The database access request is used to indicate the data related to the target tenant that needs to be obtained, updated or processed from the tenant database cluster in the process of executing the business request initiated by the target tenant. The tenant information may include but is not limited to the tenant code, tenant identity information, etc.

[0058] In a feasible implementation, step S10 may include step S11:

[0059] Step S11, obtaining tenant information of the target tenant from the thread context managed based on the Transmittable ThreadLocal.

[0060] Based on this, in a feasible implementation manner, before step S10, steps S01 to S02 are also included:

[0061] Step S01, receiving a service request initiated by a target tenant, parsing the service request, and obtaining tenant information of the target tenant carried in the service request;

[0062] It should be noted that the database routing component can intercept the business request initiated by the target tenant sent by the tenant server through the front interceptor to parse the business request and obtain the tenant information of the target tenant carried in the business request.

[0063] Step S02: Write the tenant information of the target tenant into the thread context managed by Transmittable ThreadLocal.

[0064] It should be noted that Transmittable ThreadLocal is a class in Java. Its main feature is that its value can be transferred between threads. It is suitable for application scenarios that need to transfer context or status across threads, such as thread pools, asynchronous tasks, etc.

[0065] In this implementation, the tenant information of the target tenant obtained by parsing is written into the thread context managed by TransmittableThreadLocal, so that the tenant information can be transferred between threads. Therefore, when the tenant database cluster needs to be accessed later, the tenant information of the target tenant can be quickly obtained from the thread context managed by Transmittable ThreadLocal, and subsequent operations can be performed accordingly, so as to simplify the data processing flow in a multi-threaded environment and ensure the accuracy of the tenant information of the target tenant obtained later.

[0066] Step S20, searching in a preset routing table to obtain a database access address corresponding to the tenant information;

[0067] It should be noted that the routing table is used to record different tenant information and the database access address that has a mapping relationship with each tenant information. The database access address refers to the address used to link to the database.

[0068] Step S30, based on the database access address, execute the database access request, obtain the access result of the tenant database cluster, and send the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result.

[0069] It should be noted that when executing a database access request based on a database access address and obtaining an access result of a tenant database cluster, a data source and a connection pool can be dynamically created based on the database access address, and then a database access request is executed based on the created data source and connection pool to obtain an access result of a tenant database cluster. The process of dynamically creating a data source and a connection pool based on a database access address can be implemented using Shardingsphere technology.

[0070] This embodiment provides a tenant rights management method for a SaaS platform, which assists the tenant server to effectively process the tenant's business request by connecting the tenant server and the tenant database cluster using a database routing component to ensure the normal execution of the business request. Specifically, the method receives a database access request triggered by a business request initiated by a target tenant through a database routing component, and obtains the tenant information of the target tenant; then the database routing component searches for the database access address corresponding to the tenant information in a preset routing table; then the database routing component executes the database access request based on the database access address, obtains the access result of the tenant database cluster, and sends the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result. Therefore, the method proposed in this embodiment does not need to rely on the central environment (i.e., the central control end) of the SaaS platform in the process of using the database routing component to assist the tenant server to effectively process the tenant's business request. This ensures that the tenant's business needs can be normally supported in both the networked environment and the off-network environment to enhance the user experience.

[0071] Based on the above first embodiment, a second embodiment of the tenant rights management method of the SaaS platform of the present application is proposed. In the second embodiment, steps S21 to S22 may be included before step S20:

[0072] Step S21, based on the tenant information, verify whether the target tenant has access rights to the tenant database cluster;

[0073] In a feasible implementation, a tenant table may be set to record tenant information of each tenant having access rights to the tenant database cluster. Thus, step S201 may include: if it is verified that the tenant information of the target user exists in the preset tenant table, it is determined that the target tenant has access rights to the tenant database cluster; if it is verified that the tenant information of the target user does not exist in the preset tenant table, it is determined that the target tenant does not have access rights to the tenant database cluster.

[0074] Step S22: If yes, then execute the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information.

[0075] It should be noted that the operation process of this embodiment can be completed by the database interceptor in the database routing component, and the database interceptor can be implemented by the Interceptor class of mybatis.

[0076] This embodiment limits the operation required for subsequent access to the tenant database cluster to the premise that the target tenant has the access rights to the tenant database cluster, so as to avoid security issues caused by tenants who do not have the access rights to the tenant database cluster accessing the tenant database cluster. In this way, the access security of the tenant database cluster can be guaranteed.

[0077] This application proposes a third embodiment of a tenant rights management method for a SaaS platform, which is applied to a tenant server. The tenant server is connected to a tenant database cluster through a database routing component. Please refer to Figure 4 , the tenant rights management method of the SaaS platform includes steps S100~S300:

[0078] Step S100, triggering a database access request by executing a received service request initiated by a target tenant;

[0079] Step S200, sending the database access request to the database routing component, so that the database routing component executes the database access request based on the database access address, obtains the access result of the tenant database cluster, and sends the access result to the tenant server; wherein the database access address is obtained by the database routing component based on the tenant information of the target tenant obtained, and searches in the preset routing table;

[0080] Step S300: receiving the access result sent by the tenant server, and determining whether the processing flow of the business request is completed according to the access result.

[0081] It should be noted that the access result may include a status code of the database access operation, and thus, whether the processing flow of the business request is completed can be determined based on the status code of the database access operation included in the access result. Specifically, if the status code of the database access operation is a success state, it is determined that the processing flow of the business request is completed; if the status code of the database access operation is a failure state, it is determined that the processing flow of the business request is not completed.

[0082] In addition, it should be noted that if it is determined based on the access result that the processing flow of the service request is not completed, it is necessary to return to step S100 to continue executing the service request.

[0083] The tenant rights management method of the SaaS platform provided in this embodiment can ensure that the business needs of tenants can be normally supported in both online and offline environments to improve the user experience. Compared with the prior art, the beneficial effects of the tenant rights management method of the SaaS platform provided in this embodiment are the same as the beneficial effects of the tenant rights management method of the SaaS platform provided in the first embodiment above, and will not be repeated here.

[0084] Based on the third embodiment above, a fourth embodiment of the tenant rights management method of the SaaS platform of the present application is proposed. In the fourth embodiment, the tenant rights management method of the SaaS platform may further include steps S400 to S500:

[0085] Step S400, obtaining the data to be stored generated in the process of executing the business request, and storing the data to be stored in the message queue of the tenant server;

[0086] It is understandable that since most of the data on the tenant server is private, it is generally not synchronized to the central control end. Therefore, when implementing data synchronization between the tenant server and the central control end, it is usually necessary to synchronize tenant information (for example, user_info table, user_account table, etc.) and other data that does not affect the main process of the system to the central control end.

[0087] Step S500: If it is detected that the tenant server establishes a connection with the central control end, after the connection between the tenant server and the central control end is established, the data of the message queue of the tenant server and the message queue of the central control end are synchronized.

[0088] It is understandable that although in the case of a fully localized deployment on the tenant server, data synchronization with the central control end is generally not required. However, considering the need for periodic upgrades of the locally deployed tenant rights management system, data synchronization between the tenant server and the central control end is still required. Therefore, this embodiment uses a message middleware method to store the data to be stored generated in the process of executing a business request on the tenant server in the message queue of the tenant server, thereby enabling data synchronization between the tenant server and the central control end after the connection between the tenant server and the central control end is restored.

[0089] In addition, if it is necessary to synchronize the data of the central control end to the tenant server, the message middleware method adopted in this embodiment can also be used to achieve data synchronization between the two.

[0090] Based on the third embodiment and / or the fourth embodiment, a fifth embodiment of the tenant rights management method of the SaaS platform of the present application is proposed. In the fifth embodiment, the tenant rights management method of the SaaS platform may further include step S600:

[0091] Step S600, when the tenant server and the central control are in a connected state, if it is detected that the data query request initiated by the central control cannot be executed on the central control, the tenant server receives and executes the data query request initiated by the central control.

[0092] It should be noted that, in the query scenario of this embodiment, the tenant server is used to maintain the interface address of each tenant on the one hand, and to provide a standardized query interface on the other hand.

[0093] It is understandable that, generally speaking, some data of tenant server permissions and applications are not stored in the central control end. Therefore, in order to ensure that the central control end can also query this part of unstored data normally, this embodiment forwards the data query request initiated by the central control end to the tenant server end, so that the tenant server end can proxy and execute the data query request initiated by the central control end, thereby ensuring the data consistency between the central control end and the tenant server end, so that the two can be dynamically plugged and unplugged to meet the needs of centralized architecture and localized deployment at the same time.

[0094] The present application also provides a tenant rights management system for a SaaS platform. Figure 5 , the system includes a tenant database cluster, a tenant server and a database routing component, the database routing component is used to connect the tenant database cluster and the tenant server;

[0095] The tenant server is used to receive the service request initiated by the target tenant, execute the service request initiated by the target tenant, trigger the database access request, and send the database access request to the database routing component;

[0096] The database routing component is used to receive database access requests and obtain the tenant information of the target tenant; search the preset routing table to obtain the database access address corresponding to the tenant information; based on the database access address, execute the database access request, obtain the access result of the tenant database cluster, and send the access result to the tenant server;

[0097] The tenant server is also used to receive the access result sent by the tenant server, and determine whether to complete the processing flow of the business request based on the access result.

[0098] Optionally, the database routing component is also used to:

[0099] Get the tenant information of the target tenant from the thread context managed by Transmittable ThreadLocal.

[0100] Optionally, the database routing component is also used to:

[0101] Receive a service request initiated by a target tenant, parse the service request, and obtain tenant information of the target tenant carried in the service request;

[0102] Write the tenant information of the target tenant into the thread context managed by Transmittable ThreadLocal.

[0103] Optionally, the database routing component is also used to:

[0104] Based on the tenant information, verify whether the target tenant has access rights to the tenant database cluster;

[0105] If so, the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information is executed.

[0106] Optionally, the tenant server is also used to:

[0107] Obtain the data to be stored generated during the execution of the business request, and store the data to be stored in the message queue of the tenant server;

[0108] If it is detected that the tenant server has established a connection with the central control end, after the connection between the tenant server and the central control end is established, the data of the message queue of the tenant server and the message queue of the central control end are synchronized.

[0109] Optionally, the tenant server is also used to:

[0110] When the tenant server is connected to the central control end, if it is detected that the data query request initiated by the central control end cannot be executed on the central control end, the tenant server receives and executes the data query request initiated by the central control end.

[0111] The tenant rights management system of the SaaS platform provided in the embodiment of the present application can ensure that the business needs of tenants can be normally supported in both online and offline environments to improve the user experience. Compared with the prior art, the beneficial effects of the tenant rights management system of the SaaS platform provided in the embodiment of the present application are the same as the beneficial effects of the tenant rights management method of the SaaS platform provided in the above embodiment, which will not be repeated here.

[0112] An embodiment of the present application also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the tenant authority management method of the SaaS platform in the above embodiment.

[0113] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0114] like Figure 6 As shown, the electronic device may include a processing device 101 (e.g., a central processing unit, a graphics processor, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 102 or a program loaded from a storage device 103 to a random access memory (RAM: Random Access Memory) 104. In RAM104, various programs and data required for the operation of the electronic device are also stored. The processing device 101, ROM102, and RAM104 are connected to each other through a bus 105. An input / output (I / O) interface 106 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 106: an input device 107 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 108 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 103 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 109. The communication device 109 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the electronic device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.

[0115] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 103, or installed from a ROM 102. When the computer program is executed by the processing device 101, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0116] The electronic device provided in the embodiment of the present application adopts the tenant rights management method of the SaaS platform in the above embodiment, which can ensure that the business needs of tenants can be normally supported in both online and offline environments to improve the user experience. Compared with the prior art, the beneficial effects of the electronic device provided in the embodiment of the present application are the same as the beneficial effects of the tenant rights management method of the SaaS platform provided in the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0117] It should be understood that each part of the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0118] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application shall be based on the protection scope of the above claims.

[0119] An embodiment of the present application also provides a computer-readable storage medium storing an operating program of a smart home system that can be run on a processor, and the computer-readable program instructions are used to execute the tenant authority management method of the SaaS platform in the above embodiment.

[0120] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0121] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0122] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives a database access request triggered by a business request initiated by a target tenant, and obtains tenant information of the target tenant; searches a preset routing table to obtain a database access address corresponding to the tenant information; executes a database access request based on the database access address, obtains an access result of the tenant database cluster, and sends the access result to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result.

[0123] Alternatively, a database access request is triggered by executing a business request received from a target tenant; the database access request is sent to a database routing component, so that the database routing component executes the database access request based on a database access address, obtains an access result of the tenant database cluster, and sends the access result to the tenant server; wherein the database access address is obtained by the database routing component by searching in a preset routing table based on the tenant information of the target tenant obtained; the access result sent by the tenant server is received, and based on the access result, it is determined whether the processing flow of the business request is completed.

[0124] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0126] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0127] The computer-readable storage medium provided in the embodiment of the present application stores computer-readable program instructions for executing the tenant rights management method of the above-mentioned SaaS platform, which can ensure that the business needs of tenants can be normally supported in both online and offline environments to improve the user experience. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the tenant rights management method of the SaaS platform provided in the above-mentioned embodiment, and will not be repeated here.

[0128] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the tenant rights management method of the SaaS platform as described above.

[0129] The computer program product provided in the embodiment of the present application can ensure that the business needs of tenants can be normally supported in both online and offline environments to improve the user experience. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiment of the present application are the same as the beneficial effects of the tenant rights management method of the SaaS platform provided in the above embodiment, which will not be repeated here.

[0130] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A tenant rights management method for a SaaS platform, characterized in that: Applied to a database routing component, the database routing component is used to connect a tenant database cluster and a tenant server, the method includes: Receiving a database access request triggered by a service request initiated by a target tenant, and obtaining tenant information of the target tenant; Searching in a preset routing table to obtain a database access address corresponding to the tenant information; the routing table is used to record different tenant information and a database access address that has a mapping relationship with each tenant information; Based on the database access address, dynamically create a data source and a connection pool; According to the data source and the connection pool, the database access request is executed to obtain the access result of the tenant database cluster, and the access result is sent to the tenant server, so that the tenant server can determine whether to complete the processing flow of the business request based on the access result.

2. The method according to claim 1, characterized in that The step of obtaining the tenant information of the target tenant includes: The tenant information of the target tenant is obtained from the thread context managed based on the Transmittable ThreadLocal.

3. The method according to claim 2, characterized in that Before the step of obtaining the tenant information of the target tenant, the method further includes: Receiving a service request initiated by a target tenant, parsing the service request, and obtaining tenant information of the target tenant carried in the service request; The tenant information of the target tenant is written into the thread context managed based on the Transmittable ThreadLocal.

4. The method according to claim 1, characterized in that Before the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information, the method further includes: Verifying, based on the tenant information, whether the target tenant has access rights to the tenant database cluster; If so, the step of searching in a preset routing table to obtain a database access address corresponding to the tenant information is executed.

5. A multi-tenant rights management method for a SaaS platform, characterized in that: Applied to a tenant server, the tenant server is connected to a tenant database cluster through a database routing component, and the method includes: Triggering a database access request by executing the received business request initiated by the target tenant; The database access request is sent to the database routing component, so that the database routing component can dynamically create a data source and a connection pool based on the database access address; the database access request is executed according to the data source and the connection pool to obtain the access result of the tenant database cluster, and the access result is sent to the tenant server; wherein the database access address is obtained by the database routing component based on the tenant information of the target tenant obtained by searching in a preset routing table; the routing table is used to record different tenant information and the database access address that has a mapping relationship with each tenant information; Receive the access result sent by the tenant server, and determine whether to complete the processing flow of the business request based on the access result.

6. The method according to claim 5, characterized in that The method further comprises: Acquire the data to be stored generated in the process of executing the business request, and store the data to be stored in the message queue of the tenant server; If it is detected that the tenant server establishes a connection with the central control end, after the connection between the tenant server and the central control end is established, the data of the message queue of the tenant server and the message queue of the central control end are synchronized.

7. The method according to claim 5, characterized in that The method further comprises: When the tenant server is connected to the central control end, if it is detected that the data query request initiated by the central control end cannot be executed on the central control end, the tenant server receives and executes the data query request initiated by the central control end.

8. A tenant rights management system for a SaaS platform, characterized in that: The system includes a tenant database cluster, a tenant server, and a database routing component, wherein the database routing component is used to connect the tenant database cluster and the tenant server; The tenant server is used to receive a service request initiated by a target tenant, execute the service request initiated by the target tenant, trigger a database access request, and send the database access request to the database routing component; The database routing component is used to receive the database access request and obtain the tenant information of the target tenant; search in a preset routing table to obtain the database access address corresponding to the tenant information; dynamically create a data source and a connection pool based on the database access address; execute the database access request according to the data source and the connection pool, obtain the access result of the tenant database cluster, and send the access result to the tenant server; the routing table is used to record different tenant information and the database access address that has a mapping relationship with each tenant information; The tenant server is also used to receive the access result sent by the tenant server, and determine whether to complete the processing flow of the business request based on the access result.

9. An electronic device, characterized in that: The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the tenant rights management method for the SaaS platform as described in any one of claims 1 to 4, or to implement the steps of the tenant rights management method for the SaaS platform as described in any one of claims 5 to 7.

10. A medium, characterized in that The medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the tenant rights management method for the SaaS platform described in any one of claims 1 to 4 are implemented, or the steps of the tenant rights management method for the SaaS platform described in any one of claims 5 to 7 are implemented.