Page rendering method and device
By obtaining the user role permission code collection and determining the view permission code collection based on the scene, and obtaining the attribute configuration object for page rendering, the problem of high maintenance costs in the existing technology and inability to meet the rapid iterative updates is solved, and differentiated view display and flexible view permission management are realized.
Patent Information
- Application Number
- CN202010214036.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-24
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2040-03-24
AI Technical Summary
In the prior art, the page rendering method based on Jsp or Velocity has high maintenance costs due to differences from the front-end syntax and cannot meet the needs of rapid iterative updates, and it is difficult to meet the needs of differentiated view display.
After receiving the user page access request, the user's role permission code collection is obtained, and the user's view permission code collection is determined based on the scene requested by the page access request and the user's role permission code collection in this scene, obtain the corresponding attribute configuration object, and render the page, and return to the rendered page.
It achieves meeting the needs of differentiated view display, reduces the maintenance cost of page rendering functions, improves the flexibility of view permission management, and supports rapid iterative updates.
Smart Images

Figure CN113449228B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page rendering method and device. Background Art
[0002] With the development of Internet technology, the division of software technology field has become more and more finely divided. The previous project development model in which the same programmer was responsible for both the back-end and the front-end has gradually become a thing of the past, and has been replaced by a project development model with separated front-end and back-end.
[0003] For a long time in the past, Web projects were mainly Java Web projects, and the rendering function of the presentation layer was often a part of Java Web project development. There are mainly two rendering methods in Java Web projects: one is based on Jsp page rendering, and the other is based on the Velocity template engine.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: First, whether it is a page rendering method based on Jsp or Velocity, it belongs to the category of Java syntax, which is very different from the front-end syntax. Therefore, the iteration, maintenance, and upgrade of the page rendering function are often maintained by the back-end Java programmer. However, the presentation layer content is very closely related to the front-end, resulting in the need for communication between the front-end and back-end programmers before each iteration and update, which cannot meet the needs of rapid iteration and update, and increases maintenance costs. Second, as the business becomes more and more complex, the existing page rendering method is increasingly difficult to meet the needs of differentiated view display. Summary of the invention
[0005] In view of this, the present invention provides a page rendering method and device, which can meet the needs of differentiated view display and effectively reduce the maintenance cost of the page rendering function.
[0006] To achieve the above objective, according to one aspect of the present invention, a page rendering method is provided.
[0007] The page rendering method of the present invention includes: after receiving a page access request from a user, obtaining the role permission code set of the user; wherein the role permission code set of the user is composed of all view permission codes corresponding to the user; according to the scenario corresponding to the page access request and the role permission code set of the user, determining the view permission code set of the user in the scenario; according to the view permission code set of the user in the scenario, obtaining the corresponding attribute configuration object; performing page rendering according to the corresponding attribute configuration object, and returning the rendered page to the user.
[0008] Optionally, determining the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user includes: filtering the view permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; and performing calculations on the role permission code set of the user in the scenario and a pre-configured standard view permission code set for the scenario to obtain the view permission code set of the user in the scenario.
[0009] Optionally, the operation processing of the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario includes: performing an intersection operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario; or, performing a union operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario.
[0010] Optionally, obtaining the role permission code set of the user includes: sending a request for obtaining the role permission set of the user to a Java server, and receiving the role permission set of the user returned by the Java server.
[0011] Optionally, the method further includes: receiving a set of standard view permission codes for each scenario submitted by the configuration terminal, and storing the set of standard permission codes for each scenario.
[0012] To achieve the above objective, according to another aspect of the present invention, a page rendering device is provided.
[0013] The page rendering device of the present invention includes: an acquisition module, which is used to acquire the role permission code set of the user after receiving the user's page access request; wherein the user's role permission code set is composed of all view permission codes corresponding to the user; a determination module, which is used to determine the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the user's role permission code set; a rendering module, which is used to acquire the corresponding attribute configuration object according to the view permission code set of the user in the scenario; and is also used to render the page according to the corresponding attribute configuration object, and return the rendered page to the user.
[0014] Optionally, the determination module determines the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user, including: the determination module filters the view permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; the determination module performs calculations on the role permission code set of the user in the scenario and a pre-configured standard view permission code set for the scenario to obtain the view permission code set of the user in the scenario.
[0015] Optionally, the determination module performs operation processing on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario, including: the determination module performs an intersection operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario; or, the determination module performs a union operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario.
[0016] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.
[0017] The electronic device of the present invention comprises: one or more processors; and a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the page rendering method of the present invention.
[0018] To achieve the above objective, according to yet another aspect of the present invention, a computer readable medium is provided.
[0019] The computer-readable medium of the present invention stores a computer program, and when the program is executed by a processor, the page rendering method of the present invention is implemented.
[0020] One embodiment of the above invention has the following advantages or beneficial effects: after receiving a page access request from a user, obtaining the role permission code set of the user, determining the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user, obtaining the corresponding attribute configuration object according to the view permission code set of the user in the scenario, rendering the page according to the corresponding attribute configuration object, and returning the rendered page to the user. These steps can meet the needs of differentiated view display, realize the free combination of role and scene view rendering permissions, improve the flexibility of view permission management, and reduce the maintenance cost of page rendering function.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0023] Figure 1 is a schematic diagram of the main flow of the page rendering method according to the first embodiment of the present invention;
[0024] Figure 2 is a partial flow chart of a page rendering method according to a second embodiment of the present invention;
[0025] Figure 3 is a partial flow chart of a page rendering method according to a second embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of main modules of a page rendering device according to a third embodiment of the present invention;
[0027] Figure 5 is a schematic diagram of main modules of a page rendering device according to a fourth embodiment of the present invention;
[0028] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0029] Figure 7 It is a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0031] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.
[0032] Figure 1 FIG. 1 is a schematic diagram of the main flow of the page rendering method according to the first embodiment of the present invention. Figure 1 As shown, the page rendering method of the embodiment of the present invention includes:
[0033] Step S101: After receiving a page access request from a user, obtain a role permission code set of the user.
[0034] In an optional example, the page rendering method of the present invention can be executed by a Node server. The Node server is a server developed based on Node.js. In this optional example, the Node server is mainly used to implement the page rendering function. Among them, the user's role permission code set is composed of all view permission codes corresponding to the user, which is a permission code set defined according to different user roles. The view permission code can be understood as an identifier of a part of the view that needs to be differentiated by permissions for the entire system; a part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0035] In this step, after receiving the user's page access request, the Node server can first obtain the user ID (such as the user's account name), and then obtain the corresponding role permission code set based on the user ID. In an optional example, the Node server can use the user ID as the input parameter of the request, send a request to the Java server to obtain the user's role permission set, and then receive the user's role permission set returned by the Java server.
[0036] In the embodiment of the present invention, the page rendering function of the presentation layer is extracted from the Javaweb project, the page rendering function is implemented by the Node server, and the Java server is mainly responsible for data and business logic processing, so that there is no need for communication between the front-end and back-end programmers before each iteration and update of the rendering layer function, which meets the demand for rapid iteration and update of the rendering function and reduces maintenance costs.
[0037] It should be pointed out that, without affecting the implementation of the present invention, the page rendering method of the present invention can be implemented by other servers in addition to being implemented by the Node server.
[0038] Step S102: Determine a view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user.
[0039] In specific implementation, the scene entered by the user can be determined according to the URL (Uniform Resource Locator, also known as the webpage address) input by the user, such as decoration, preview, release, backup, template management, batch management, etc. For example, when the URL input by the user is xxx / sku / editor.html, the corresponding scene is the decoration scene; when the URL input by the user is xxx / sku / preview.html, the corresponding scene is the preview scene.
[0040] In an optional example, step S102 specifically includes: filtering the view permission codes in the role permission code set of the user according to the scenario corresponding to the page access request, and using the filtered view permission codes as the view permission code set of the user in the scenario. For example, assuming that there are view permission codes for 5 scenarios in the user's role permission code set, if the scenario corresponding to the page access request is a decoration scenario, the view permission codes for the decoration scenario can be filtered out from the user's role permission code set, and the filtered view permission codes can be used as the view permission code set of the user in the scenario.
[0041] In another optional example, step S102 may specifically include: screening the permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; performing calculation processing on the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario to obtain the view permission code set of the user in the scenario. The definition of the standard view permission code set in each scenario is independent of the user role, and it is a permission code set under the standard page in each scenario pre-configured by the administrator.
[0042] Step S103: acquiring a corresponding attribute configuration object according to the view permission code set of the user in the scenario; rendering the page according to the corresponding attribute configuration object, and returning the rendered page to the user.
[0043] During specific implementation, the administrator may pre-configure and store the attribute configuration objects corresponding to each view permission code. Furthermore, in step S103, the attribute configuration objects corresponding to each view permission code in the set may be obtained based on the view permission code set of the user in the scenario. Among them, the attribute configuration object may include the following parameters: the unique identifier (ID) of the permission code, the basic functional module to which the permission code belongs, and the rendering template or html fragment corresponding to the permission code. In addition, the attribute configuration object may also include parameters such as the permission code definition name and the permission code display name. During specific implementation, the parameters in the attribute configuration object can be flexibly set according to different business types and permission types. After obtaining the corresponding attribute configuration objects, page rendering can be performed according to these attribute configuration objects to obtain the rendered page, and then the rendered page is returned to the terminal device corresponding to the user.
[0044] In the embodiment of the present invention, the above steps can meet the differentiated view display requirements, realize the free combination of role and scene view rendering permissions, improve the flexibility of view permission management, and reduce the maintenance cost of page rendering function.
[0045] Figure 2FIG. 1 is a partial flow chart of a page rendering method according to a second embodiment of the present invention. Figure 2 As shown, the page rendering method of the embodiment of the present invention includes:
[0046] Step S201: Receive a page access request from a user.
[0047] In an optional example, the page rendering method of the present invention can be executed by a Node server. The Node server is a server developed based on Node.js. In a specific implementation, a user can send a page access request to the Node server through a terminal device. After receiving the page access request, the Node server can obtain the role permission code set of the user through the interaction with the Java server in step S102.
[0048] Step S202: Send a request to the Java server to obtain the role permission code set of the user, and then receive the role permission code set of the user returned by the Java server.
[0049] The user's role permission code set is composed of all view permission codes corresponding to the user, which is a permission code set defined according to different user roles. The view permission code can be understood as an identifier of a part of the view that needs to be differentiated by permissions for the entire system; the part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0050] In this step, after receiving the user's page access request, the Node server can first obtain the user ID (such as the user's account name), and use the user ID as the input parameter of the request, send a request to the Java server to obtain the user's role permission set, and then receive the user's role permission set returned by the Java server.
[0051] In the embodiment of the present invention, the page rendering function of the presentation layer is extracted from the Javaweb project, the page rendering function is implemented by the Node server, and the Java server is mainly responsible for data and business logic processing, so that there is no need for communication between the front-end and back-end programmers before each iteration and update of the rendering layer function, which meets the demand for rapid iteration and update of the rendering function and reduces maintenance costs.
[0052] Step S203: Filter the permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario.
[0053] For example, assuming that the user's role permission code set contains view permission codes for five scenarios, if the scenario corresponding to the page access request is a decoration scenario, the view permission codes for the decoration scenario can be filtered out from the user's role permission code set, and the filtered view permission codes can be used as the role permission code set of the user in the scenario.
[0054] Step S204: perform computation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario to obtain the view permission code set of the user in the scenario.
[0055] Among them, the definition of the standard view permission code set in each scenario has nothing to do with the user role. It is a set of permission codes under the standard page in each scenario pre-configured by the administrator. For example, the standard view permission code set in the decoration scenario includes the following view permission codes: M01, M02, M03, M04, M05, CMS01, CMS02, CMS03, CMS04, CMS05, CMT01, CMT02. Among them, M01 to M05 represent the view permission codes of button 1 to button 5, CMS01 to CMS05 represent the view permission codes of icon 1 to icon 5, and CMT01 to CMT02 represent the view permission codes of input box 1 to input box 2.
[0056] Exemplarily, the operation processing of the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario includes: performing an intersection operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario; or, performing a union operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario. During specific implementation, different operations may be performed on the role permission code set of the user in the scenario and the standard view permission code set for the scenario, depending on the scenario. For example, in a decoration scenario, a union operation may be performed on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario.
[0057] Step S205: Obtain a corresponding attribute configuration object according to the view permission code set of the user in the scenario.
[0058] During specific implementation, the administrator may pre-configure and store the attribute configuration objects corresponding to each view permission code. Furthermore, in step S205, based on the view permission code set of the user in the scenario, the attribute configuration objects corresponding to each view permission code in the set may be obtained. Among them, the attribute configuration object may include the following parameters: the unique identifier (ID) of the permission code, the basic functional module to which the permission code belongs, and the rendering template or html fragment corresponding to the permission code. In addition, the attribute configuration object may also include parameters such as the permission code definition name and the permission code display name. During specific implementation, the parameters in the attribute configuration object can be flexibly set according to different business types and permission types.
[0059] Step S206: Render the page according to the corresponding attribute configuration object, and return the rendered page to the user.
[0060] In an optional example, after obtaining the corresponding attribute configuration object, the Node server can render the page according to these attribute configuration objects to obtain a rendered page, and then return the rendered page to the terminal device corresponding to the user. After receiving the rendered page, the terminal device displays the rendered page to the user.
[0061] In another optional example, the Node server can also encrypt the user's view permission code set in the scenario, and push the encrypted permission code set to the terminal device corresponding to the user. After receiving the encrypted permission code set, the terminal device can decrypt the encrypted permission code set, and then perform an interactive verification operation according to the decryption result, and display the rendered page returned by the Node server after the interactive verification passes.
[0062] In an embodiment of the present invention, by implementing the page rendering function based on the Node server, there is no need for front-end and back-end programmers to communicate before each iteration update, which meets the demand for fast iteration update of the rendering function and reduces maintenance costs; further, after receiving a page access request from a user, the role permission code set of the user is obtained, and according to the scenario corresponding to the page access request and the role permission code set of the user, the view permission code set of the user in the scenario is determined, and according to the view permission code set of the user in the scenario, the corresponding attribute configuration object is obtained, and the page is rendered according to the corresponding attribute configuration object, and the rendered page is returned to the user. These steps can meet the demand for differentiated view display, realize the free combination of role and scene view rendering permissions, improve the flexibility of view permission management, and further reduce the maintenance cost of the page rendering function.
[0063] Figure 31 is a partial flow chart of the page rendering method according to the second embodiment of the present invention. The method of the embodiment of the present invention can be executed by a Node server. In the embodiment of the present invention, the Node server is a server developed based on Node.js, which is mainly used to implement the page rendering function. Figure 3 As shown, the page rendering method of the embodiment of the present invention also includes:
[0064] Step S301: The administrator sends a login request through a configuration terminal.
[0065] In specific implementation, the administrator can enter the URL of the configuration management center on the configuration terminal to enter the login page, and then enter the account and password required for login on the login page. The configuration terminal can carry the account and password entered by the user in the login request and send the login request to the Node server.
[0066] Step S302: The Node server verifies the login request and returns the configuration management page to the configuration terminal corresponding to the administrator after the verification is passed.
[0067] Step S303: The administrator performs configuration operations on the standard view permission code sets in various scenarios through the configuration management page presented by the configuration terminal, and then sends a submission request for the configuration operation to the Node server.
[0068] The view permission code can be understood as the identification of a part of the view that needs to be differentiated by permissions in the entire system; the part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0069] Among them, the definition of the standard view permission code set in each scenario has nothing to do with the user role. It is a set of permission codes under the standard page in each scenario pre-configured by the administrator. For example, the standard view permission code set in the decoration scenario includes the following view permission codes: M01, M02, M03, M04, M05, CMS01, CMS02, CMS03, CMS04, CMS05, CMT01, CMT02. Among them, M01 to M05 represent the view permission codes of button 1 to button 5, CMS01 to CMS05 represent the view permission codes of icon 1 to icon 5, and CMT01 to CMT02 represent the view permission codes of input box 1 to input box 2.
[0070] In this step, the configuration operation performed on the standard view permission code set may be operations such as adding, deleting, or modifying permission codes. In addition, the administrator may also perform configuration operations on the attribute configuration objects corresponding to each permission code through the configuration management page presented by the configuration terminal.
[0071] Step S304: After receiving the submission request, the Node server returns a configuration operation result preview page to the configuration terminal corresponding to the administrator.
[0072] Step S305: The administrator confirms whether modification is required through the configuration operation result preview page presented by the configuration terminal, and sends a request for confirmation submission to the Node server after confirming that modification is not required.
[0073] In addition, after the administrator confirms that modification is required according to the configuration operation result preview page, the administrator can perform configuration operation on the permission code again through step S303.
[0074] Step S306: After receiving the request for confirmation submission, the Node server saves the configuration operation result.
[0075] During specific implementation, after receiving the request for confirmation submission, the Node server may notify each Node server in the cluster by means of a message, so as to store the result of this configuration operation in each Node server.
[0076] In the embodiment of the present invention, the above steps can realize the configuration management of the view permission code and the attribute configuration object, thereby improving the flexibility and scalability of the view permission management.
[0077] Figure 4 Schematic diagram of the main modules of the page rendering device according to the third embodiment of the present invention. Figure 4 As shown, the page rendering device 400 according to the embodiment of the present invention includes: an acquisition module 401 , a determination module 402 , and a rendering module 403 .
[0078] The acquisition module 401 is used to acquire the role permission code set of the user after receiving the page access request of the user.
[0079] The user's role permission code set is composed of all view permission codes corresponding to the user, which is a permission code set defined according to different user roles. The view permission code can be understood as an identifier of a part of the view that needs to be differentiated by permissions for the entire system; the part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0080] Specifically, after receiving a page access request from a user, the acquisition module 401 may first acquire a user identifier (such as a user's account name), and then acquire a corresponding role permission code set based on the user identifier.
[0081] In an optional example, the page rendering device 400 can be implemented based on the Node server. In this optional example, the acquisition module 401 can use the user identifier as the input parameter of the request, send a request to the Java server to obtain the role permission set of the user, and then receive the role permission set of the user returned by the Java server. In the above optional example, by extracting the page rendering function of the presentation layer from the Javaweb project, the page rendering function is implemented by the Node server, and the Java server is mainly responsible for data, business logic processing, etc., so that there is no need for communication between the front-end and back-end programmers before each iteration and update of the rendering layer function, which meets the needs of rapid iteration and update of the rendering function and reduces maintenance costs.
[0082] The determination module 402 is used to determine the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user.
[0083] In specific implementation, the determination module 402 can determine the scene that the user enters according to the URL (Uniform Resource Locator, also known as the webpage address) input by the user, such as decoration, preview, release, backup, template management, batch management, etc. For example, when the URL input by the user is xxx / sku / editor.html, the corresponding scene is the decoration scene; when the URL input by the user is xxx / sku / preview.html, the corresponding scene is the preview scene.
[0084] In an optional example, the determination module 402 determines the view permission code set of the user in the scenario specifically including: the determination module 402 filters the view permission codes in the role permission code set of the user according to the scenario corresponding to the page access request, and uses the filtered view permission codes as the view permission code set of the user in the scenario. For example, assuming that there are view permission codes for 5 scenarios in the user's role permission code set, if the scenario corresponding to the page access request is a decoration scenario, the view permission codes for the decoration scenario can be filtered out from the user's role permission code set, and the filtered view permission codes can be used as the view permission code set of the user in the scenario.
[0085] In another optional example, the determination module 402 determines the view permission code set of the user in the scenario, which may specifically include: the determination module 402 filters the permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; the determination module 402 performs calculations on the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario to obtain the view permission code set of the user in the scenario. Among them, the definition of the standard view permission code set in each scenario is independent of the user role, and it is a permission code set under the standard page in each scenario pre-configured by the administrator.
[0086] The rendering module 403 is used to obtain the corresponding attribute configuration object according to the view permission code set of the user in the scenario; it is also used to render the page according to the corresponding attribute configuration object and return the rendered page to the user.
[0087] During specific implementation, the administrator may pre-configure and store the attribute configuration objects corresponding to each view permission code. Furthermore, the rendering module 403 may obtain the attribute configuration objects corresponding to each view permission code in the set according to the view permission code set of the user in the scenario. Among them, the attribute configuration object may include the following parameters: the unique identifier (ID) of the permission code, the basic functional module to which the permission code belongs, and the rendering template or HTML fragment corresponding to the permission code. In addition, the attribute configuration object may also include parameters such as the permission code definition name and the permission code display name. During specific implementation, the parameters in the attribute configuration object can be flexibly set according to different business types and permission types. After obtaining the corresponding attribute configuration objects, the rendering module 403 may render the page according to these attribute configuration objects to obtain the rendered page, and then return the rendered page to the terminal device corresponding to the user.
[0088] The device of the embodiment of the present invention can meet the demand for differentiated view display, realize the free combination of role and scene view rendering permissions, and improve the flexibility of view permission management.
[0089] Figure 5 Schematic diagram of the main modules of the page rendering device according to the fourth embodiment of the present invention. The page rendering device of the embodiment of the present invention can be implemented based on the Node server. Figure 5 As shown, the page rendering device 500 according to the embodiment of the present invention includes: a configuration module 501 , an acquisition module 502 , a determination module 503 , and a rendering module 504 .
[0090] The configuration module 501 is used to receive the standard view permission code sets in various scenarios submitted by the configuration terminal, and store the standard view permission code sets in various scenarios.
[0091] The view permission code can be understood as the identification of a part of the view that needs to be differentiated by permissions in the entire system; the part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0092] Among them, the definition of the standard view permission code set in each scenario has nothing to do with the user role. It is a set of permission codes under the standard page in each scenario pre-configured by the administrator. For example, the standard view permission code set in the decoration scenario includes the following view permission codes: M01, M02, M03, M04, M05, CMS01, CMS02, CMS03, CMS04, CMS05, CMT01, CMT02. Among them, M01 to M05 represent the view permission codes of button 1 to button 5, CMS01 to CMS05 represent the view permission codes of icon 1 to icon 5, and CMT01 to CMT02 represent the view permission codes of input box 1 to input box 2.
[0093] In addition, the configuration module 501 may also be used to receive the attribute configuration objects corresponding to the view permission codes submitted by the configuration terminal, and store the attribute configuration objects corresponding to the view permission codes.
[0094] The acquisition module 502 is used to acquire the role permission code set of the user after receiving the page access request of the user.
[0095] The user's role permission code set is composed of all view permission codes corresponding to the user, which is a permission code set defined according to different user roles. The view permission code can be understood as an identifier of a part of the view that needs to be differentiated by permissions for the entire system; the part of the view can be a combination of any one or more page elements such as buttons, icons, pictures, or lists. For example, "M01" can be used to represent the permission code of a button, and "CMS01" can be used to represent the permission code of an icon.
[0096] Specifically, after receiving the user's page access request, the acquisition module 502 can first obtain the user identifier (such as the user's account name), and use the user identifier as the input parameter of the request, send a request to the Java server to obtain the user's role permission set, and then receive the user's role permission set returned by the Java server.
[0097] In the embodiment of the present invention, the page rendering function of the presentation layer is extracted from the Javaweb project, the page rendering function is implemented by the Node server, and the Java server is mainly responsible for data and business logic processing, so that there is no need for communication between the front-end and back-end programmers before each iteration and update of the rendering layer function, which meets the demand for rapid iteration and update of the rendering function and reduces maintenance costs.
[0098] The determination module 503 is used to filter the permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario.
[0099] For example, assuming that the user's role permission code set contains view permission codes for five scenarios, if the scenario corresponding to the page access request is a decoration scenario, the view permission codes for the decoration scenario can be filtered out from the user's role permission code set, and the filtered view permission codes can be used as the role permission code set of the user in the scenario.
[0100] The determination module 503 is further used to perform operation processing on the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario to obtain the view permission code set of the user in the scenario.
[0101] Exemplarily, the determination module 503 performs computational processing on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario, including: the determination module 503 performs an intersection operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario; or, the determination module 503 performs a union operation on the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario. During specific implementation, different computational processing may be performed on the role permission code set of the user in the scenario and the standard view permission code set for the scenario, depending on the scenario. For example, in a decoration scenario, the role permission code set of the user in the scenario and the pre-configured standard view permission code set for the scenario may be unioned to obtain the view permission code set of the user in the scenario.
[0102] The rendering module 504 is used to obtain the corresponding attribute configuration object according to the view permission code set of the user in the scenario; the rendering module 504 is also used to render the page according to the corresponding attribute configuration object and return the rendered page to the user.
[0103] During specific implementation, the administrator may pre-configure and store the attribute configuration objects corresponding to each view permission code. Furthermore, the rendering module 504 may obtain the attribute configuration objects corresponding to each view permission code in the set according to the view permission code set of the user in the scenario. Among them, the attribute configuration object may include the following parameters: the unique identifier (ID) of the permission code, the basic functional module to which the permission code belongs, and the rendering template or html fragment corresponding to the permission code. In addition, the attribute configuration object may also include parameters such as the permission code definition name and the permission code display name. During specific implementation, the parameters in the attribute configuration object can be flexibly set according to different business types and permission types. After obtaining the corresponding attribute configuration objects, the rendering module 504 may render the page according to these attribute configuration objects to obtain the rendered page, and then return the rendered page to the terminal device corresponding to the user.
[0104] In the device of the embodiment of the present invention, the page rendering function is implemented based on the Node server, so that there is no need for communication between front-end and back-end programmers before each iteration update, which meets the demand for rapid iteration update of the rendering function and reduces maintenance costs; further, the view permission code is configured through the configuration module, which improves the flexibility and scalability of view permission management; the role permission code set of the user is obtained through the acquisition module, and the view permission code set of the user in the scenario is determined through the determination module according to the scenario corresponding to the page access request and the role permission code set of the user, and the corresponding attribute configuration object is obtained through the rendering module according to the view permission code set of the user in the scenario, and the page is rendered according to the corresponding attribute configuration object, which can meet the differentiated view display requirements, realize the free combination of role and scene view rendering permissions, improve the flexibility of view permission management, and further reduce the maintenance cost of the page rendering function.
[0105] Figure 6 An exemplary system architecture 600 is shown to which the page rendering method or the page rendering apparatus according to the embodiment of the present invention can be applied.
[0106] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0107] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0108] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0109] The server 605 may be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The background management server may analyze and process the received data such as page access requests, and feed back the processing results (such as rendered pages) to the terminal device.
[0110] It should be noted that the page rendering method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the page rendering device is generally disposed in the server 605 .
[0111] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0112] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 7 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0113] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0114] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0115] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include 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 the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0116] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0117] 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 invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 box can also occur in a different order from the order marked in the accompanying drawings. For example, two 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 box in the block diagram or flow chart, and the combination of the boxes in the block diagram 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.
[0118] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes an acquisition module, a determination module, and a rendering module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the acquisition module may also be described as a "module for acquiring a set of user role permission codes."
[0119] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the following process: after receiving a page access request from a user, obtain the role permission code set of the user; wherein the role permission code set of the user is composed of all view permission codes corresponding to the user; according to the scenario corresponding to the page access request and the role permission code set of the user, determine the view permission code set of the user in the scenario; according to the view permission code set of the user in the scenario, obtain the corresponding attribute configuration object, render the page according to the corresponding attribute configuration object, and return the rendered page to the user.
[0120] According to the technical solution of the embodiment of the present invention, it is possible to meet the demand for differentiated view display and effectively reduce the maintenance cost of the page rendering function.
[0121] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A page rendering method, characterized in that: The method comprises: After receiving a page access request from a user, obtaining a role permission code set of the user; wherein the role permission code set of the user is composed of all view permission codes corresponding to the user; Determine a view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user; According to the view permission code set of the user in the scenario, a corresponding attribute configuration object is obtained; according to the corresponding attribute configuration object, a page is rendered, and the rendered page is returned to the user; The step of obtaining the role permission code set of the user comprises: Sending a request to the Java server to obtain the role permission set of the user, and receiving the role permission set of the user returned by the Java server; The determining, according to the scenario corresponding to the page access request and the role permission code set of the user, a view permission code set of the user in the scenario comprises: The view permission codes in the role permission code set of the user are screened according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario are processed to obtain the view permission code set of the user in the scenario.
2. The method according to claim 1, characterized in that The operation processing of the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario includes: An intersection operation is performed on the role permission code set of the user in the scenario and a pre-configured standard view permission code set in the scenario; or a union operation is performed on the role permission code set of the user in the scenario and a pre-configured standard view permission code set in the scenario.
3. The method according to claim 1, characterized in that The method further comprises: The standard view permission code sets in various scenarios submitted by the configuration terminal are received, and the standard permission code sets in various scenarios are stored.
4. A page rendering device, characterized in that: The device comprises: The acquisition module is used to acquire the role permission code set of the user after receiving the page access request of the user; specifically, it is used to send a request for acquiring the role permission set of the user to the Java server, and receive the role permission set of the user returned by the Java server; wherein, the role permission code set of the user is composed of all view permission codes corresponding to the user; A determination module, configured to determine a view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user; A rendering module, used to obtain a corresponding attribute configuration object according to the view permission code set of the user in the scenario; and also used to render a page according to the corresponding attribute configuration object, and return the rendered page to the user; The determining module determines the view permission code set of the user in the scenario according to the scenario corresponding to the page access request and the role permission code set of the user, including: The determination module filters the view permission codes in the role permission code set of the user according to the scenario corresponding to the page access request to obtain the role permission code set of the user in the scenario; the determination module performs calculations on the role permission code set of the user in the scenario and a pre-configured standard view permission code set for the scenario to obtain the view permission code set of the user in the scenario.
5. The device according to claim 4, characterized in that The determination module performs computation processing on the role permission code set of the user in the scenario and the pre-configured standard view permission code set in the scenario, including: The determination module performs an intersection operation on the role permission code set of the user in the scenario and a pre-configured standard view permission code set for the scenario; or, the determination module performs a union operation on the role permission code set of the user in the scenario and a pre-configured standard view permission code set for the scenario.
6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 3.
7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.