Application software as service (SaaS) method, equipment and medium

By introducing a data access layer and configuration center, the data and behavior of the application are separated, and SQL rewriting and data source management are used to achieve data isolation, which solves the problems of data isolation and multi-tenant customization in the traditional software development model, and realizes the application Dynamic configuration and security.

CN119201201APending Publication Date: 2024-12-27SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411120154.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Traditional software development models cannot achieve data isolation and multi-tenant customization requirements, making it difficult for software to be dynamically configured and maintained during the SaaS process.

Method used

By introducing a data access layer, the application's data and business logic are separated, and the application's behavior and code are separated through the configuration center to achieve dynamic configuration. Data isolation is achieved through data source management and SQL rewriting, supporting database level and table level Isolate from row-level data.

Benefits of technology

It realizes data isolation and multi-tenant customization requirements between different users, ensures data security and application flexibility, avoids code complexity, and supports SaaSization of existing applications and the development of new applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201201A_ABST
    Figure CN119201201A_ABST
Patent Text Reader

Abstract

The invention discloses an application SaaS (Software as a Service) method, equipment and a medium, belongs to the technical field of SaaS, and aims to solve the technical problem of how to realize data isolation and multi-tenant customization requirements and overcome the difficulty of SaaS of an application. According to the technical scheme, data and service logic of the application program are separated by introducing a data access layer, behaviors and codes of the application program are separated by introducing a configuration center, and meanwhile dynamic configuration of the application program is achieved. Wherein the data access layer is an independent service and is used for accessing a database and providing a data access interface for an upper layer, so that transparency to an upper-layer application is ensured, and the upper-layer application does not need to be changed; the configuration center is used for storing configuration information of a new function when the application program develops the new function, reading the configuration information from the configuration center when the application program is started, and determining the behavior of the function according to the configuration information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of SaaS, and in particular to a method, device and medium for SaaS application. Background Art

[0002] With the development of the Internet, the traditional software development model can no longer meet the needs of users. Users have higher and higher requirements for software and hope that the software can be accessed anytime and anywhere, which requires the software to be able to achieve this.

[0003] SaaS is the abbreviation of Software as a Service, which is a software delivery model in which users access the software through the Internet instead of downloading and installing the software.

[0004] The traditional software development model is to couple data, business logic, behavior and code together. Such software is not suitable for SaaS because the software's data, business logic, behavior and code are coupled together, making it impossible to achieve dynamic configuration of the software or multi-tenancy of the software.

[0005] One difficulty faced by SaaS is data isolation. Data isolation means that the data between different users is isolated. The data of user A cannot be accessed by user B. This is a basic requirement for ensuring data security. For example, in the traditional B / S architecture application, the data in the database is shared, and the data between different users is shared, so data isolation cannot be achieved.

[0006] Another difficulty faced by SaaS is to realize the customized needs of multi-tenants. Multi-tenancy means that multiple users share the same software instance, but each user has different needs, which are manifested in different application functions, front-end pages, etc. How to realize the customized needs of multi-tenants is the key to SaaS. If the customized needs of multi-tenants are hard-coded in the application, the application code will become very complex and difficult to maintain.

[0007] Therefore, how to achieve data isolation and multi-tenant customization requirements and overcome the difficulties of application SaaS are technical issues that need to be solved urgently. Summary of the invention

[0008] The technical task of the present invention is to provide an application SaaS method, device and medium to solve the problem of how to achieve data isolation and multi-tenant customization requirements and overcome the difficulties of application SaaS.

[0009] The technical task of the present invention is achieved in the following manner: a method for SaaS-based application, which separates the data and business logic of the application by introducing a data access layer, separates the behavior and code of the application by introducing a configuration center, and realizes dynamic configuration of the application;

[0010] The data access layer is an independent service used to access the database and provide a data access interface for the upper layer, ensuring transparency to the upper layer application without modifying the upper layer application.

[0011] The configuration center is used to save the configuration information of new functions when the application develops new functions. When the application starts, the configuration information is read from the configuration center and the behavior of the function is determined based on the configuration information.

[0012] As a preference, the data access layer uses data source management and SQL rewriting to allow users to only access data under their own tenant, thereby achieving data isolation.

[0013] Preferably, data isolation is divided into different granularities, and data isolation according to different granularities includes database-level data isolation, table-level data isolation, and row-level data isolation.

[0014] More optimally, data isolation at the database level means that different users use different databases to achieve data isolation;

[0015] The data access layer manages tenants and corresponding data sources and creates a database for each user to achieve data isolation at the database level;

[0016] When users from different tenants access the data, the currently accessed tenant is first determined, and then the corresponding data source is selected based on the tenant to execute the incoming SQL statement.

[0017] Better yet, table-level data isolation means that different users use the same database, but different users use different tables to achieve data isolation;

[0018] The data access layer manages tenants and corresponding data tables to achieve data isolation at the database level;

[0019] When users from different tenants access the data, the currently accessed tenant is first determined, and then the data table is determined based on the tenant, and the SQL statement is rewritten to replace the data table with the data table corresponding to the corresponding tenant.

[0020] Better yet, row-level data isolation means that different users use the same table. By adding fields representing tenants to the table, different users can only access their own data, thus achieving row-level data isolation.

[0021] The details of row-level data isolation are as follows:

[0022] When creating a data table, add a tenant field (such as tenant_id) to the data table;

[0023] When performing a query, the data access layer rewrites the SQL statement by adding the tenant condition (tenant_id=?) to the conditional statement.

[0024] An electronic device comprising: a memory and at least one processor;

[0025] Wherein, the memory stores a computer program;

[0026] The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the application SaaS method as described above.

[0027] A computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the above-mentioned application SaaS method.

[0028] The application SaaS method, device and medium of the present invention have the following advantages:

[0029] (i) The present invention separates the data and business logic of an application by introducing a data access layer, separates the behavior and code of an application by introducing a configuration center, and also realizes dynamic configuration of the application, thereby realizing the SaaS of the application;

[0030] (ii) The present invention achieves data isolation, and the data between different users is isolated, thereby ensuring data security; and by introducing a data access layer, it achieves non-intrusiveness to existing applications;

[0031] (III) The present invention realizes the customized needs of multiple tenants. Different users have different needs. Through the configuration center, the customized needs of multiple tenants can be realized;

[0032] (iv) The present invention realizes the separation of application behavior and code. The application code no longer contains the configuration information of the function, but reads the configuration information from the configuration center and determines the behavior of the function according to the configuration information; customized requirements for a tenant can also be applied to other tenants;

[0033] (V) The present invention can transform existing applications into SaaS, and can also develop new applications to enable them to have SaaS capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The present invention is further described below in conjunction with the accompanying drawings.

[0035] Attached Figure 1 Schematic diagram for achieving data isolation;

[0036] Attached Figure 2 Schematic diagram for realizing multi-tenant customization requirements. DETAILED DESCRIPTION

[0037] The application SaaS method, device and medium of the present invention are described in detail below with reference to the drawings and specific embodiments of the specification.

[0038] Embodiment 1:

[0039] This embodiment provides an application SaaS method, which separates the data and business logic of the application by introducing a data access layer, and separates the behavior and code of the application by introducing a configuration center, while realizing dynamic configuration of the application;

[0040] The data access layer is an independent service used to access the database and provide a data access interface for the upper layer, ensuring transparency to the upper layer application without modifying the upper layer application. Figure 1 As shown;

[0041] The configuration center is used to save the configuration information of new functions when the application develops new functions. When the application starts, the configuration information is read from the configuration center and the behavior of the function is determined based on the configuration information. For example, the system provides the function of broadcasting login notifications to friends after the user logs in, but there are scenarios where this function does not need to be enabled under certain tenants. In this case, whether the tenant has enabled the notification can be saved in the configuration center. After the user logs in, the notification will be made only when it is determined that the tenant has enabled the function. For example, Figure 2 shown.

[0042] The data access layer in this embodiment uses data source management and SQL rewriting to allow users to access only the data of this tenant, thereby achieving the purpose of data isolation.

[0043] The data isolation in this embodiment is divided into different granularities. According to the different granularities, the data isolation includes database-level data isolation, table-level data isolation and row-level data isolation.

[0044] The database-level data isolation in this embodiment means that different users use different databases to achieve data isolation;

[0045] The data access layer manages tenants and corresponding data sources and creates a database for each user to achieve data isolation at the database level;

[0046] When users from different tenants access the data, the currently accessed tenant is first determined, and then the corresponding data source is selected based on the tenant to execute the incoming SQL statement.

[0047] The table-level data isolation in this embodiment means that different users use the same database and different users use different tables to achieve data isolation;

[0048] The data access layer manages tenants and corresponding data tables to achieve data isolation at the database level;

[0049] When users from different tenants access the data, the currently accessed tenant is first determined, and then the data table is determined based on the tenant, and the SQL statement is rewritten to replace the data table with the data table corresponding to the corresponding tenant.

[0050] In this embodiment, row-level data isolation means that different users use the same table. By adding fields representing tenants to the table, different users can only access their own data, thus achieving row-level data isolation.

[0051] The details of row-level data isolation are as follows:

[0052] ① When creating a data table, add a tenant field (such as tenant_id) to the data table;

[0053] ② When performing a query, the data access layer rewrites the SQL statement: adding the tenant condition (tenant_id=?) to the conditional statement.

[0054] Among them, database-level data isolation is the simplest, but also the most resource-intensive, because a database needs to be created for each user; table-level data isolation is the most commonly used; row-level data isolation is the most flexible, but it requires adding tenant-representing fields to the table, which increases the complexity of the table.

[0055] The following uses table-level data isolation as an example to introduce how to implement data isolation. Taking querying user information as an example, the query SQL of a traditional application is as follows:

[0056] SELECT*FROM user WHERE id=1;

[0057] After introducing the data access layer, the query SQL is as follows:

[0058] SELECT*FROM user_tenant_a WHERE id=1;

[0059] Generally, applications access the database through the ORM framework, so data isolation can be achieved by simply modifying the mapping relationship between entities and tables in the ORM framework.

[0060] Taking Java as an example, it can be implemented through aspects. Therefore, the data access layer can be used as an independent project, and the existing application only needs to introduce the dependency of the data access layer.

[0061] Embodiment 2:

[0062] This embodiment also provides an electronic device, including: a memory and a processor;

[0063] Wherein, the memory stores computer-executable instructions;

[0064] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the application SaaS method in any embodiment of the present invention.

[0065] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0066] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.

[0067] Embodiment 3:

[0068] This embodiment also provides a computer-readable storage medium, which stores a plurality of instructions, which are loaded by a processor to enable the processor to execute the application SaaS method in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.

[0069] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0070] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0071] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0072] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for SaaS-based application, characterized in that: This method is to separate the data and business logic of the application by introducing a data access layer, and to separate the behavior and code of the application by introducing a configuration center, while realizing dynamic configuration of the application; The data access layer is an independent service used to access the database and provide a data access interface for the upper layer, ensuring transparency to the upper layer application without modifying the upper layer application. The configuration center is used to save the configuration information of new functions when the application develops new functions. When the application starts, the configuration information is read from the configuration center and the behavior of the function is determined based on the configuration information.

2. The method for SaaS-based application according to claim 1, characterized in that: The data access layer uses data source management and SQL rewriting to ensure that users can only access data under their own tenant, thus achieving data isolation.

3. The application SaaS method according to claim 1 or 2, characterized in that: Data isolation is divided into different granularities, including database-level data isolation, table-level data isolation, and row-level data isolation.

4. The method for SaaS-based application according to claim 3, characterized in that: Data isolation at the database level means that different users use different databases to achieve data isolation; The data access layer manages tenants and corresponding data sources and creates a database for each user to achieve data isolation at the database level; When users from different tenants access the data, the currently accessed tenant is first determined, and then the corresponding data source is selected based on the tenant to execute the incoming SQL statement.

5. The method for SaaS-based application according to claim 3, characterized in that: Table-level data isolation means that different users use the same database and different tables to achieve data isolation; The data access layer manages tenants and corresponding data tables to achieve data isolation at the database level; When users from different tenants access the data, the currently accessed tenant is first determined, and then the data table is determined based on the tenant, and the SQL statement is rewritten to replace the data table with the data table corresponding to the corresponding tenant.

6. The method for SaaS-based application according to claim 3, characterized in that: Row-level data isolation means that different users use the same table. By adding fields representing tenants to the table, different users can only access their own data, thus achieving row-level data isolation. The details of row-level data isolation are as follows: When creating a data table, add a tenant field to the data table; When making a query, the data access layer rewrites the SQL statement by adding the tenant's condition to the conditional statement.

7. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the application SaaS method as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the application SaaS method as described in any one of claims 1 to 6.