Permission control method, device, equipment and storage medium in front-end rendering scenario

By obtaining the permission parameters of the page object in the front-end framework and passing it into an independent permission control unit for permission control, the problem of the built-in judgment logic unit being unable to achieve other permission control is solved, and the display efficiency and logical control efficiency of the page object are improved.

CN112241266BActive Publication Date: 2024-12-31TENCENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910646804.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-17
Publication Date
2024-12-31
Estimated Expiration
2039-10-05

AI Technical Summary

Technical Problem

The built-in judgment logic unit in the existing front-end framework can only realize the hiding of page objects and cannot realize other permission control, resulting in unnecessary permission control processes leading to waste of resources, affecting the logical control efficiency of page objects.

Method used

The permission parameters of the page object are obtained through the front-end framework and passed them into the permission control unit independent of other logical control units. The permission control information is obtained based on the permission parameters for permission control, and the permission control logic unit and other logical control units are decoupled.

Benefits of technology

Reduce unnecessary permission control processes, avoid resource waste, and improve the display efficiency and logical control efficiency of page objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112241266B_ABST
    Figure CN112241266B_ABST
Patent Text Reader

Abstract

The present application is about a permission control method, device, equipment and storage medium in a front-end rendering scenario. The method includes: obtaining permission parameters of a page object through a front-end framework; passing the permission parameters into a permission control unit through the front-end framework, and the permission control unit is independent of other logical control units; through the permission control unit, obtaining permission control information of the page object according to the permission parameters, and performing permission control on the page object according to the permission control information. Through the above-mentioned scheme, the present application decouples the logic unit used for permission control from other logical control units, reduces the repeated execution of the permission control unit when executing other logical control units, avoids the waste of resources caused by unnecessary permission control processes, and thus improves the display efficiency of page objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of front-end technology, and in particular to a permission control method, device, equipment and storage medium in a front-end rendering scenario. Background Art

[0002] In front-end technology, permission control is a common method to provide differentiated access services to different users.

[0003] In the related art, the permission control of page objects such as pages, page components or elements in page components is usually implemented by binding with the built-in judgment logic unit of the front-end framework. Specifically, when it is necessary to determine whether a certain page object is displayed, the front-end framework can call the built-in judgment logic unit to determine whether the page object is visible in the current login state.

[0004] Since the built-in judgment logic unit in the front-end framework is a general unit, in addition to judging whether the page object is visible in the current login state, the built-in judgment logic unit also needs to judge whether the page object meets other display conditions when necessary. For example, a page object that requires permission control is an object that can be manually hidden by the user. When displaying the page or page component where the page object is located, the front-end framework can call the built-in judgment logic unit. The built-in judgment logic unit judges whether the page object is visible in the current login state, and also judges whether the page object is in a hidden state. If the judgment result is that the page object is visible in the current login state and is not in a hidden state, the front-end framework displays the page object.

[0005] Among them, the above-mentioned built-in logic judgment unit can only realize the hiding of page objects, but cannot realize other permission controls. In addition, the permission control logic in the related technology may be bound to other judgment logics. When other judgment logics are triggered, regardless of whether permission control is needed (even if the permission has been determined to be completed), the permission control logic will be triggered, resulting in unnecessary waste of resources caused by the permission control process, thereby affecting the efficiency of the logical control of the page object. Summary of the invention

[0006] The embodiment of the present application provides a permission control method, device, equipment and storage medium in a front-end rendering scenario, which can expand the way of creating scenes for articles and improve the expression effect of scenes described in text. The technical solution is as follows:

[0007] On the one hand, a permission control method in a front-end rendering scenario is provided, the method comprising:

[0008] Obtaining, through the front-end framework, a permission parameter of a page object, wherein the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required to render the page object;

[0009] The permission parameters are transmitted to the permission control unit through the front-end framework, and the permission control unit is independent of other logic control units, and the other logic control units are software units with logic control functions other than permission control;

[0010] Obtaining, by the permission control unit, permission control information of the page object according to the permission parameter, the permission control information being used to indicate whether the page object is visible in the current login state;

[0011] The permission control unit performs permission control on the page object according to the permission control information.

[0012] On the other hand, a permission control device in a front-end rendering scenario is provided, the device comprising:

[0013] A first permission parameter acquisition module is used to acquire permission parameters of a page object through a front-end framework, wherein the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required to render the page object;

[0014] A parameter input module, used to input the permission parameters into the permission control unit through the front-end framework, wherein the permission control unit is independent of other logic control units, and the other logic control units are software units having logic control functions other than permission control;

[0015] An authority control information acquisition module, used to acquire the authority control information of the page object according to the authority parameter through the authority control unit, wherein the authority control information is used to indicate whether the page object is visible in the current login state;

[0016] The permission control module is used to perform permission control on the page object according to the permission control information through the permission control unit.

[0017] Optionally, the authority control information acquisition module is used to:

[0018] The permission control unit compares the permission parameter with the permission control data, wherein the permission control data includes various permission parameters in the current login state;

[0019] The authority control information is obtained according to a comparison result between the authority parameter and the authority control data.

[0020] Optionally, when acquiring the authority control information according to the comparison result between the authority parameter and the authority control data, the authority control information acquisition module is used to:

[0021] If the comparison result is that the permission parameter does not exist in the permission control data, first control information is obtained, where the first control information is used to indicate that the page object is not visible in the current login state.

[0022] Optionally, the device further comprises:

[0023] A second permission parameter acquisition module, used for acquiring the permission parameters in the current login state from the server before the permission control information acquisition module compares the permission parameters with the permission control data through the permission control unit;

[0024] The authority control data generating module is used to generate the authority control data according to the authority parameters.

[0025] Optionally, the permission control module is used to control the jump to a specified page through the permission control unit when the page object is the page and the permission control information indicates that the page object is not visible in the current login state.

[0026] Optionally, the permission control module is used to set the display property of the page object to hidden through the permission control unit when the page object is a page component in the page or an element in the page component, and the permission control information indicates that the page object is not visible in the current login state.

[0027] Optionally, the parameter input module is used to call a specified hook function through the front-end framework to input the permission parameter into the permission control unit; the specified hook function is a hook function that can be executed once for the page object.

[0028] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the permission control method in the front-end rendering scenario as described above.

[0029] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the permission control method in the front-end rendering scenario as described above.

[0030] The technical solution provided by this application may have the following beneficial effects:

[0031] By passing the permission parameters of the page object obtained by the front-end framework into a permission control unit independent of other logical control units, the permission control unit obtains the permission control information of the page object according to the permission parameters, and implements permission control on the page object according to the permission control information, the logical unit used for permission control is decoupled from other logical control units, reducing the repeated execution of the permission control unit when executing other logical control units, avoiding the waste of resources caused by unnecessary permission control processes, and thus improving the display efficiency of page objects.

[0032] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] 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.

[0034] Figure 1 It is a system architecture diagram of a permission control system in a front-end rendering scenario involved in various embodiments of the present application;

[0035] Figure 2 is a flowchart of a permission control method in a front-end rendering scenario according to an exemplary embodiment;

[0036] Figure 3 yes Figure 2 A schematic diagram of performing permission control through a Web application according to the embodiment shown;

[0037] Figure 4 is a flowchart of a permission control method in a front-end rendering scenario according to an exemplary embodiment;

[0038] Figure 5 yes Figure 4 A schematic diagram of the permission control process involved in the illustrated embodiment;

[0039] Figure 6 is a structural block diagram of a permission control device in a front-end rendering scenario according to an exemplary embodiment;

[0040] Figure 7 The diagram is a schematic structural diagram of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0041] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0042] It should be understood that the "several" mentioned in this article refers to one or more, and "multiple" refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0043] The present application provides a permission control scheme in a front-end rendering scenario, which can effectively avoid unnecessary permission control steps, thereby saving terminal processing resources and improving the efficiency of logical control of page objects in the front-end rendering scenario. For ease of understanding, several terms involved in this application are explained below.

[0044] 1) Front-end framework

[0045] The front-end framework refers to a framework used to simplify web design. The front-end framework involved in this application can be a front-end framework with custom instruction functions, such as Vue, Angular, etc. These frameworks encapsulate some basic functions, such as Hypertext Markup Language (HTML) document operations and various controls (buttons, forms, etc.). Using the front-end framework can reduce the interface development cycle and improve the aesthetics of the interface.

[0046] 2) Page Object

[0047] In this application, page objects refer to objects of various granularities in a page that can be independently controlled by the front-end framework. For example, in a page, the page itself can be used as a page object, each page component contained in the page can also be used as a separate page object, and the page elements contained in each page component can also be used as a separate page object.

[0048] 3) Permission Control

[0049] In the field of front-end technology, permission control refers to the method of controlling which page objects a user can access, that is, determining whether a page object is visible in the current logged-in state. Among them, permission control is roughly divided into two dimensions: vertical dimension and horizontal dimension.

[0050] Among them, the permission control in the vertical dimension refers to controlling which URLs the user can access, that is, controlling whether a certain page is visible in the current login state.

[0051] Horizontal permission control refers to controlling the permissions of users to obtain certain data when accessing a specific URL (for example, different data are obtained when ordinary users, administrators, and super administrators access the same URL). In other words, it controls whether page components in a page or elements in page components are visible in the current login state.

[0052] Please refer to Figure 1 , which shows a system structure diagram of a permission control system in a front-end rendering scenario involved in various embodiments of the present application. Figure 1 As shown, the system includes a server 120 , a database 140 and a plurality of user terminals 160 .

[0053] The server 120 is a server, or is composed of several servers, or is a virtualization platform, or is a cloud computing service center.

[0054] The server 120 may be composed of one or more functional units. Figure 1 As shown, the server 120 may include: a permission management unit 120a, a page data management unit 120b, and the like.

[0055] The authority management unit 120a is used to generate, update and maintain the authority corresponding to each user account, and provide each user terminal 160 with information such as the authority that the user terminal 160 has in the current login state.

[0056] The page data management unit 120 b is used to manage the page data in the page developed by the developer, accept the request of the user terminal 160 , and send the page data requested by the user terminal 160 to the user terminal 160 so that the user terminal 160 can display it.

[0057] The database 140 may be a Redis database, or may be other types of databases. The database 140 is used to store various types of data, such as each user account, the permissions of each user account, and page data of each page.

[0058] The user terminal 160 may be a terminal device having a network connection function and a page display function. For example, the user terminal 160 may be a mobile phone, a tablet computer, an e-book reader, smart glasses, a smart watch, a car terminal, and the like.

[0059] For example, the user terminal 160 may be installed with a browser or other network (Web) applications (such as a Web client, etc.) that support front-end framework development.

[0060] The user terminal 160 is connected to the server 120 via a communication network. Optionally, the communication network is a wired network or a wireless network.

[0061] Optionally, the system may also include a management device ( Figure 1 (not shown), the management device is connected to the server 120 via a communication network. Optionally, the communication network is a wired network or a wireless network.

[0062] Optionally, the above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.

[0063] Figure 2 is a flowchart of a permission control method in a front-end rendering scenario according to an exemplary embodiment. The permission control method can be applied to a computer device to implement permission control of page objects in a page in a front-end rendering scenario. The computer device can be Figure 1 The user terminal 160 in the system shown. Figure 2 As shown, the permission control method in the front-end rendering scenario may include the following steps:

[0064] Step 210, obtaining a permission parameter of a page object through the front-end framework, where the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required for rendering the page object.

[0065] In the embodiment of the present application, the page object may be the current page itself, or the page object may be a page component in the current page, or the above-mentioned page object may also be an element in a page component in the current page.

[0066] The page component is a container that encapsulates one or more elements. For example, the page component can be an input box or a drop-down box in the page. Optionally, when the page is a web page, the page component can also be a web page component or a Web component.

[0067] The above elements are basic components of a page, which are usually objects that are displayed on the screen in a graphical manner and can interact with the user. For example, the above elements can be a button in an input box, or a label in a drop-down box, etc.

[0068] Step 220: passing the permission parameters to the permission control unit through the front-end framework. The permission control unit is independent of other logic control units. The other logic control units are software units with logic control functions other than permission control.

[0069] In the embodiment of the present application, the front-end framework may be a front-end framework with a custom instruction function, and the permission control unit is implemented by the custom instruction function provided by the front-end framework.

[0070] The permission control unit is an independent unit different from the built-in judgment unit of the front-end framework. The permission control unit is used to perform permission control on the web page object and is decoupled from other logical functions of the web page object.

[0071] That is to say, in the embodiment of the present application, there is no binding relationship between the permission control unit and other logical control units. When the front-end framework triggers other logical control units to perform logical control on a page object, it does not necessarily trigger the permission control unit to perform permission control on the same page object. Correspondingly, when the front-end framework triggers the permission control unit to perform permission control on a page object, it does not necessarily trigger other logical control units to perform other logical controls on the same page object.

[0072] Step 230: Obtain, through the permission control unit, permission control information of the page object according to the permission parameter, where the permission control information is used to indicate whether the page object is visible in the current login state.

[0073] In an embodiment of the present application, when the page object is the page itself, whether the page object is visible in the current login state may refer to whether you have permission to access the page in the current login state; when the page object is a page component in the page, or an element in the page component, whether the above-mentioned page object is visible in the current login state may refer to whether you have permission to see the page component or the element in the page component in the current login state.

[0074] Step 240: Performing permission control on the page object according to the permission control information through the permission control unit.

[0075] In one possible implementation, when the above-mentioned page object is a page, if the permission control information indicates that the page object is not visible in the current login state, the permission control unit can be used to control the jump to the specified page; or, when the above-mentioned page object is a page component or an element in a page component, if the permission control information indicates that it is not visible in the current login state, the page component or the object in the page component can be hidden by the permission control unit.

[0076] For example, see Figure 3 , which shows a schematic diagram of a permission control through a Web application involved in an embodiment of the present application. Figure 3 As shown, the Web application is developed based on the front-end framework. During the development process, the developer develops a permission control unit dedicated to permission control based on the custom instruction function of the front-end framework. When the Web application is running in the user terminal, when the Web application accesses a page, when it is necessary to perform permission control on the page object in the page, the front-end framework can obtain the permission parameters of the page object in the page (S31), and then input the permission parameters into the permission control unit (S32). The permission control unit determines whether the page object is visible in the current login state according to the permission parameters of the page object, and performs permission control on the page object according to the determination result (S33).

[0077] In the above Figure 3 In the process shown, when other logical controls are required on the above-mentioned page object in addition to permission control, the front-end framework can separately call other logical control units to execute other logical judgments and control processes on the page object, and the above-mentioned calling process does not trigger the permission control unit to perform permission control operations on the page object.

[0078] To summarize, the permission control method in the front-end rendering scenario provided in the embodiments of the present application, through the permission parameters of the page object obtained by the front-end framework into the permission control unit independent of other logical control units, the permission control unit obtains the permission control information of the page object according to the permission parameters, and implements the permission control of the page object according to the permission control information, so that the logical unit used for permission control is decoupled from other logical control units, reducing the repeated execution of the permission control unit when executing other logical control units, avoiding the waste of resources caused by unnecessary permission control processes, and thus improving the display efficiency of page objects.

[0079] Figure 4 is a flowchart of a permission control method in a front-end rendering scenario according to an exemplary embodiment. The permission control method can be applied to a computer device to implement permission control of page objects in a page in a front-end rendering scenario. The computer device can be Figure 1 The user terminal 160 in the system shown. Figure 4 As shown, the permission control method in the front-end rendering scenario may include the following steps:

[0080] Step 410, obtaining a permission parameter of a page object through the front-end framework, where the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required for rendering the page object.

[0081] In a possible implementation, the front-end framework may extract the permission parameter of the page object from the page data corresponding to the page object.

[0082] For example, when a web application (such as a browser or other web client developed based on a front-end framework) accesses a page, it can obtain the corresponding server (such as Figure 1 The server 120 in the system shown in the figure pulls the page data of the page, wherein the page data of the page is composed of the page data of each page object of the page, and when a page object needs to be subject to permission control, the page data of the page object will include the permission parameters of the page object, that is, the page object is visible to users with corresponding permission parameters. Accordingly, when the front-end framework in the Web application parses the page data of a page object in the page that needs permission control, it can extract the permission parameters of the page object from the page data of the page object.

[0083] The above-mentioned page objects include objects of various granularities such as pages, page components in pages, and elements in page components. For different page objects, the permission parameters carried in the page data may also be different.

[0084] For example, assuming that the page object is a page A, its root component is APP, the name of the custom instruction (that is, the permission control unit) is v-permission, and PAGE_A_READ represents the access rights required for page A (that is, the above permission parameters), then you only need to add the following custom instructions to the root component of page A:<App v-permission=“PAGE_A_READ” / > , which can trigger the front-end framework to obtain the permission parameters when parsing the page data of page A, that is, "PAGE_A_READ" in the above custom instruction.

[0085] For another example, there is a button in page A, which is visible to users with permission but invisible to users without permission. Assuming the name of the custom instruction is v-permission, BUTTON_READ represents the permission to display this button, then you only need to add the following custom instruction to the button: <button v-permission="button_read”>< / button> , which can trigger the front-end framework to obtain the permission parameters when parsing the button, that is, "BUTTON_READ" in the above custom instruction.

[0086] Step 420: The permission parameter is transmitted to the permission control unit through the front-end framework.

[0087] The authority control unit is independent of other logic control units, and the other logic control units are software units having logic control functions other than authority control.

[0088] In one embodiment, a permission control unit is developed by developers based on a custom instruction function of a front-end framework, which can be specifically used to implement permission judgment on page objects, i.e., subsequent control processes, and the permission control unit is decoupled from other logic control units. For example, whether to call the permission control unit is determined by the front-end framework based on business needs and has nothing to do with whether to call other logic control units. From a code perspective, the code for the permission control logic is separated from the code for other logic controls, and at the same time, the permission control instructions are also separated from other logic control instructions, thereby improving the readability and maintainability of the code.

[0089] In addition, in the embodiment of the present application, the front-end framework can pass the page object's identifier and the page object's permission parameters to the permission control unit, which performs subsequent permission judgment and permission control. In this process, the front-end framework does not need to pass other redundant data to the permission control unit, further improving the readability and maintainability of the code.

[0090] In an embodiment of the present application, during one display of a page, since the current login status usually does not change, accordingly, during this display of the page, no matter what changes occur in other logical controls of the page object, the logical control result of the page object usually remains unchanged. In other words, during this display of the page, the permission control logic of the page object only needs to be executed once.

[0091] In a possible implementation, the permission control logic of the page object can be executed once in the current display process of the page by binding the process of passing the permission parameters of a page object into the permission control unit with a hook function that is executed once. That is to say, in an embodiment of the present application, the front-end framework can pass the permission parameters of the page object into the permission control unit by calling a specified hook function, and the specified hook function is a function that can be executed once for the current page object. In the current display process of the current page, after one call, the specified hook function will not be called again, that is, in the current display process of the current page, after the permission parameters of the page object are passed into the permission control unit for the first time, no matter what changes occur in other business logics of the page object, the permission parameters of the page object will not be passed into the permission control unit again, thereby reducing repeated calls to the permission control unit when calling other logic control units.

[0092] For example, in a possible implementation scenario, user A opens a web page. After receiving the user operation information, the front-end framework requests the page data of the web page from the server. After receiving the request sent by the front-end framework, the server sends the page data of the web page to the front-end framework, which contains the permission parameters required for rendering the current page object, including the permission parameters of each granularity such as the page, the page components in the page, and the elements in the components. After the front-end framework obtains the permission parameters of a page object, it passes the permission parameters required for rendering the page object to the permission control unit by calling the specified hook function corresponding to the page object. Since the specified hook function is executable once for the current page object, that is, during the current display process of the web page, the process of the front-end framework passing the obtained permission parameters of the page object to the permission control unit is also executed once, that is, when executing other logical control processes for the page object, the step of calling the permission control unit to perform permission control on the page object will not be repeated.

[0093] For example, for the front-end framework Vue, the hook functions that are only executed once when custom instructions are used are the bind function and the update function. The judgment logic of permission control can be written in these two functions. Among them, the bind hook function is called after the Document Object Model (DOM) element is created by the front-end framework but before it is displayed on the page, and the update function can be called when the parameters passed to the permission control unit change.

[0094] That is to say, the above-mentioned process of performing a single executable permission control on the page object in the page during the current display of the page can be executed before the page object is displayed. That is to say, in an embodiment of the present application, the above-mentioned step of passing the permission parameters of the page object into the permission control unit through the front-end framework can be executed when the front-end framework creates the DOM element of the page object or after the creation of the DOM element of the page object is completed, and before the page object is rendered and displayed.

[0095] For example, when a user requests to access a certain page, the front-end framework parses the page data of the page and creates the DOM elements of each page object in the page. If it is found that a certain page object needs permission control, the permission parameters of the page object will be passed to the permission control unit before rendering and displaying the page object. In addition, after the permission parameters of the page object are passed to the permission control unit this time, for the same page object, the permission parameters of the page object will not be repeatedly passed to the permission control unit during the current access to the page.

[0096] Step 430: The authority control unit compares the authority parameter with the authority control data, where the authority control data includes various authority parameters in the current login state.

[0097] In an embodiment of the present application, after the weight parameters of the page object are passed into the permission control unit through the front-end framework, the terminal also compares the user permissions required to render the page object with the user permissions in the current login state through the permission control unit.

[0098] The terminal may obtain the above-mentioned permission control data from the server in advance. For example, in a possible implementation, the process of the terminal obtaining the above-mentioned permission control data may be as follows:

[0099] S4301. Obtain various permission parameters in the current login state from the server through the permission request unit.

[0100] In a possible implementation, the terminal may request various permission parameters of the current login state from the server through the permission request unit.

[0101] The permission request unit is a program unit in the terminal specifically used for remote permission data request. For example, when the terminal starts a Web application, or when the login status changes (such as logging in or logging out), the terminal can send a permission parameter acquisition request to the server by calling the permission request unit. The permission parameter acquisition request carries the current login status information, such as whether there is a user account currently logged in, and the currently logged in user account, etc. After receiving the permission parameter acquisition request, the server queries the various permission parameters in the current login status and returns the queried permission parameters to the terminal.

[0102] In a possible implementation, the various permission parameters in the current login state may include user permissions for each page, page components in each page, or each element in each page component in the current login state.

[0103] S4302. Generate corresponding authority control data according to various authority parameters.

[0104] In a possible implementation, the various permission parameters obtained by the terminal from the server are permission parameters in a first format. The terminal may obtain permission parameters corresponding to a second format according to the permission parameters in the first format to obtain the permission control data.

[0105] For example, when the permission parameter of the page object obtained by the front-end framework in step 410 and the permission parameter passed into the permission control unit by the front-end framework in step 420, the user permissions indicated by both are the same, but the formats of the two may be different.

[0106] For example, based on the convenience of data management and data compression, the server side uses a combination of 0 and 1 (i.e., the first format mentioned above) to represent various permission parameters, such as "1001" represents the permission to access the page, and "1002" represents the permission to access the button. On the terminal side, developers can customize the use of English words (i.e., the second format mentioned above) to represent various permission parameters based on code readability, such as "MAIN_READ" represents the permission to access the page, and "BUTTON_READ" represents the permission to access the button.

[0107] Assuming that the various rights parameters obtained by the terminal from the server are {1001: true, 1002: true}, a relationship A can be established according to the first format and the second format of the predefined rights parameters, wherein the relationship A can be expressed as {MAIN_READ: 1001, BUTTON_READ: 1002}, and the relationship A is the above-mentioned permission control data.

[0108] In another possible implementation, the terminal may also directly use various permission parameters obtained from the server as permission control data.

[0109] Assuming that the various permission parameters obtained by the terminal from the server are {1001: true, 1002: true}, the terminal can directly obtain the {1001: true, 1002: true} as a relationship A, and the relationship A is the above-mentioned permission control data.

[0110] After the terminal generates the above-mentioned authority control data, it stores the authority control data locally so as to be called by the authority control unit.

[0111] Step 440: Obtaining authority control information based on the comparison result between the authority parameter and the authority control data.

[0112] The permission control information is used to indicate whether the page object is visible in the current login state.

[0113] In an embodiment of the present application, the terminal can compare the permission parameters of the page object with the various permission parameters in the permission control data through the permission control unit. If the comparison result is that the permission parameters of the page object do not exist in the permission control data, the terminal can obtain first control information, which is used to indicate that the page object is not visible in the current login state.

[0114] Optionally, if the comparison result is that the permission parameter of the page object exists in the permission control data, the terminal may obtain second control information, where the second control information is used to indicate that the page object is visible in the current login state.

[0115] In one possible implementation, the terminal may compare the permission parameters of the page object with each permission parameter in the permission control data respectively to determine whether there is a permission parameter in the permission control data that is consistent with the permission parameter of the page object. If each permission parameter in the permission control data is inconsistent with the permission parameter of the page object, it is determined that the permission parameter of the page object does not exist in the permission control data, that is, the user has the permission to access the page object in the current login state; if a permission parameter in the permission control data is consistent with the permission parameter of the page object, it is determined that the permission parameter of the page object exists in the permission control data, that is, the user has no permission to access the page object in the current login state.

[0116] For example, after the front-end framework passes the permission parameters of a page object into the permission control unit, the permission control unit can query the relationship A established above. If the permission parameters of the page object do not exist in relationship A, the permission control information of the page object is determined to be the first control information; optionally, if the permission parameters of the page object exist in relationship A, the permission control information of the page object is determined to be the second control information.

[0117] Optionally, in a possible implementation, in order to distinguish whether the permission parameters are passed in directly or automatically obtained by the permission control unit, when the permission parameters of a page object passed by the front-end framework to the permission control unit are empty, it can be assumed that the permission parameters of the page object are a specified permission parameter, or the permission control unit obtains the permission parameters of the page object through other means.

[0118] For example, when the permission control unit obtains the permission parameter of the page object through other means, taking the above-specified permission parameter indicating the user permission to access the page as an example, the developer predefines the corresponding relationship B between the page route and the permission for the page access permission control. For example, if the home page route is / index.html, the relationship B can be defined as {'index.html':MAIN_READ}. In the process of user requesting to display the page, for the page object, if the page needs to be subject to permission control, the front-end framework can pass an empty permission parameter to the permission control unit. After receiving the empty permission parameter, the permission control unit obtains the page route of the current page, and queries the above-mentioned relationship B according to the obtained page route, so as to determine that the permission parameter is specifically "MAIN_READ", and then query the relationship A to determine whether the relationship A contains the permission parameter "MAIN_READ". If the permission parameter "MAIN_READ" does not exist in the relationship A, the permission control information of the page is determined to be the first control information; optionally, if the permission parameter "MAIN_READ" exists in the relationship A, the permission control information of the page is determined to be the second control information.

[0119] Step 450: Performing permission control on the page object according to the permission control information through the permission control unit.

[0120] In the embodiment of the present application, for page objects of different granularities, the permission control operations that can be executed by the permission control unit may also be different.

[0121] For example, in a possible implementation, when the page object is a page, and the permission control information indicates that the page object is not visible in the current login state, the terminal can control the jump to the specified page through the permission control unit.

[0122] For example, when the page object is the page currently requested to be displayed, and the permission control information obtained in the above step 440 is the first control information, the terminal can control the jump to a specified page through the permission control unit; for example, the terminal can control the jump to the permission reminder page through the permission control unit, and the permission reminder page is used to remind the user that he does not have permission to access the requested page; or, if the user is currently in an offline state, the terminal can control the jump to the login interface through the permission control unit; if the user is currently in a logged-in state, the terminal can control the jump to the permission acquisition interface (such as a member recharge interface or a payment interface, etc.) through the permission control unit.

[0123] In another possible implementation, when the page object is a page component in a page or an element in the page component, and the permission control information indicates that the page object is not visible in the current login state, the terminal can set the display property of the page object to hidden through the permission control unit.

[0124] For example, when the page object is a page component or an element in a page component in the page currently requested for display, and the permission control information obtained in the above step 440 is the first control information, the terminal can set the display attribute of the page component or the element in the page component to hidden through the permission control unit.

[0125] For example, the terminal can set the display attribute of the DOM corresponding to the page component or the element in the page component to none through the permission control unit, so as to hide the page component or the element in the page component.

[0126] Among them, the scheme shown in the embodiment of the present application only introduces the above-mentioned permission control operation as page jump or hiding as an example. Optionally, the above-mentioned permission control operation can also be customized by the developer for other operations, such as closing the page, replacing the page object with a specified object (such as replacing a button with a text box), or setting the button to be visible but inoperable, etc.

[0127] Please refer to Figure 5 , which shows a schematic diagram of the permission control process involved in the embodiment of the present application. Figure 5 As shown in the figure, when a web application in the terminal is displaying a page, the process of controlling the permissions of the page object can be as follows:

[0128] S51, when the WEB application is started, the terminal sends a request to the server for obtaining permission parameters.

[0129] When the WEB application is started, the WEB application can obtain the current login status information, such as whether logged in and the logged-in user account, and send the current login status information to the server in the permission parameter acquisition request, for example, to the permission management unit in the server.

[0130] In addition to sending a permission parameter acquisition request when the WEB application is started, the WEB application will also send the above permission parameter acquisition request to the server when the login status changes.

[0131] The step of sending the permission parameter acquisition request may be executed by the permission control unit in the WEB application, or the step may be executed by other software units other than the permission control unit, for example, by the front-end framework.

[0132] S52, the server returns various permission parameters in the current login state to the terminal, and the terminal receives the various permission parameters returned by the server and generates permission control data.

[0133] Among them, the permission management unit in the server manages the various permission parameters of each user account and the various permission parameters in the non-logged-in state. After the permission management unit receives the permission parameter acquisition request sent by the terminal, it queries the various permission parameters in the current login state according to the current login status information carried therein, and returns the queried permission parameters to the terminal. After the terminal receives the above-mentioned permission parameters, the WEB application generates permission control data and stores it locally so that it can be called by the permission control unit later.

[0134] Optionally, when the login status changes, when the WEB application re-initiates a request to obtain permission parameters, the WEB application may also generate new permission control data using the newly obtained permission parameters, and update the originally stored permission control data to the new permission control data.

[0135] S53: When the user performs an operation of accessing a specified page, the terminal sends a request for obtaining page data to the server.

[0136] When a user clicks to access a specified page during use of a WEB application, the WEB application may send a page data acquisition request including the address of the specified page to a server according to the address of the specified page.

[0137] S54, the server returns the page data of the designated page to the terminal.

[0138] For example, Figure 5 As shown, the page data management unit in the server can send the page data of the specified page to the WEB application in the terminal.

[0139] S55, the front-end framework in the WEB application transfers the permission parameters of the page objects that require permission control in the specified page to the permission control unit.

[0140] Among them, when the front-end framework in the WEB application parses the page data and constructs the DOM elements of each page object in the page, if a page object needs permission control, the front-end framework can extract the permission parameters of the page object from the page data of the page object, and pass the permission parameters and the page object identifier to the permission control unit through a single executable hook function.

[0141] For example, assuming that the page object is the specified page itself and the permission parameter is "MAIN_READ", the front-end framework will pass the identifier of the specified page and the permission parameter "MAIN_READ" to the permission control unit; or, when the default permission parameter is empty, indicating the user's permission to access the page, the front-end framework can also only pass the identifier of the specified page to the permission control unit.

[0142] For another example, assuming that the page object is a button in a specified page and the permission parameter is "BUTTON_READ", the front-end framework will pass the button identifier and the permission parameter "BUTTON_READ" into the permission control unit.

[0143] S56, the permission control unit compares the permission parameter of the page object with the permission parameter in the permission control data to determine whether the page object is visible in the current login state.

[0144] After the permission control unit obtains the permission parameters passed by the front-end framework, it can query whether the permission control data contains the permission parameters of the page object. If not, it means that there is no permission to access the page object in the current login state. At this time, the permission control unit determines that the page object is not visible in the current login state; conversely, if the permission control data contains the permission parameters of the page object, it means that there is permission to access the page object in the current login state. At this time, the permission control unit determines that the page object is visible in the current login state.

[0145] S57: When the page object is not visible in the current login state, the authority control unit controls the page to jump or controls the page object to hide.

[0146] Among them, when the page object is the above-mentioned designated page itself, the permission control unit can control the page to jump to the designated page.

[0147] When the page object is a page component in a specified page or an element in a page component, the permission control unit may set the display attribute of the DOM element of the page object to none.

[0148] In the above Figure 5 In the scheme shown, if the above page object needs to perform other logic control, the front-end framework can also call other logic control units to perform other logic control on the page object. In addition, the front-end framework can also call other logic control units to perform other logic control on the page object, which is independent of the process of the front-end framework calling the permission control unit to perform logic control on the page object.

[0149] For example, suppose the above-mentioned page object is a button, which is visible to a specific user and can be deleted or added by the user. During the display process of the above-mentioned specified page, the front-end framework constructs the DOM element of the button, and before rendering the DOM, calls a single executable hook function to pass the permission parameters of the button into the permission control unit to call the permission control unit to perform permission control on the button. At the same time, the front-end framework also calls other logical control units to determine whether the button has been deleted by the user. If the permission control unit determines that the button has the right to be accessed in the current login state, and other logical control units determine that the button has not been deleted by the user, the front-end framework can render and display the DOM element of the button.

[0150] After the user subsequently executes the operation of deleting the button in the specified page, the front-end framework can call other logic control units again to determine whether the button has been deleted by the user, and remove the button from the specified page after other logic control units determine that the button has been deleted by the user. During this process, the front-end framework will not call the permission control unit to perform permission control on the button.

[0151] To summarize, the permission control method in the front-end rendering scenario provided in the embodiments of the present application, by passing the permission parameters of the page object obtained by the front-end framework into a permission control unit independent of other logical control units (the permission control unit is implemented by a custom instruction of the front-end framework), the permission control unit obtains the permission control information of the page object according to the permission parameters, and implements permission control of the page object according to the permission control information, so that the logical unit used for permission control is decoupled from other logical control units, reducing the repeated execution of the permission control unit when executing other logical control units, avoiding the waste of resources caused by unnecessary permission control processes, and thus improving the display efficiency of page objects.

[0152] In addition, the solution provided in the embodiment of the present application unifies the logical judgment of processing permissions, avoids the business coupling caused by the use of built-in judgment instructions in the framework, and when calling, only the required permission parameters need to be passed in, without other redundancy, thereby improving the readability and maintainability of the code.

[0153] Figure 6The structure block diagram of a permission control device in a front-end rendering scenario according to an exemplary embodiment is shown. The permission control device in the front-end rendering scenario can be used in a computer device to execute all or part of the steps in the above method embodiment of the present application. Among them, the permission control device in the front-end rendering scenario can be used Figure 1 In the user terminal of the system shown. The permission control device in the front-end rendering scenario may include:

[0154] A first permission parameter acquisition module 601 is used to acquire permission parameters of a page object through a front-end framework, where the page object is a page object in a page currently rendered by the front-end framework, and the permission parameters are used to indicate user permissions required to render the page object;

[0155] A parameter input module 602, used to input the permission parameter into the permission control unit through the front-end framework, wherein the permission control unit is independent of other logic control units, and the other logic control units are software units having logic control functions other than permission control;

[0156] The permission control information acquisition module 603 is used to acquire the permission control information of the page object according to the permission parameter through the permission control unit, and the permission control information is used to indicate whether the page object is visible in the current login state;

[0157] The permission control module 604 is used to perform permission control on the page object according to the permission control information through the permission control unit.

[0158] Optionally, the authority control information acquisition module 603 is used to:

[0159] The permission control unit compares the permission parameter with the permission control data, wherein the permission control data includes various permission parameters in the current login state;

[0160] The authority control information is obtained according to a comparison result between the authority parameter and the authority control data.

[0161] Optionally, when obtaining the permission control information according to the comparison result between the permission parameter and the permission control data, the permission control information obtaining module 603 is used to:

[0162] If the comparison result is that the permission parameter does not exist in the permission control data, first control information is obtained, where the first control information is used to indicate that the page object is not visible in the current login state.

[0163] Optionally, the device further comprises:

[0164] A second permission parameter acquisition module, used for acquiring the permission parameters in the current login state from the server before the permission control information acquisition module compares the permission parameters with the permission control data through the permission control unit;

[0165] The authority control data generating module is used to generate the authority control data according to the authority parameters.

[0166] Optionally, the permission control module 604 is used to control the jump to a specified page through the permission control unit when the page object is the page and the permission control information indicates that the page object is not visible in the current login state.

[0167] Optionally, the permission control module 604 is used to set the display property of the page object to hidden through the permission control unit when the page object is a page component in the page or an element in the page component, and the permission control information indicates that the page object is not visible in the current login state.

[0168] Optionally, the parameter input module 602 is used to call a specified hook function through the front-end framework to input the permission parameter into the permission control unit; the specified hook function is a hook function that can be executed once for the page object.

[0169] To summarize, the permission control method in the front-end rendering scenario provided in the embodiments of the present application, through the permission parameters of the page object obtained by the front-end framework into the permission control unit independent of other logical control units, the permission control unit obtains the permission control information of the page object according to the permission parameters, and implements the permission control of the page object according to the permission control information, so that the logical unit used for permission control is decoupled from other logical control units, reducing the repeated execution of the permission control unit when executing other logical control units, avoiding the waste of resources caused by unnecessary permission control processes, and thus improving the display efficiency of page objects.

[0170] In addition, the solution provided in the embodiment of the present application unifies the logical judgment of processing permissions, avoids the business coupling caused by the use of built-in judgment instructions in the framework, and when calling, only the required permission parameters need to be passed in, without other redundancy, thereby improving the readability and maintainability of the code.

[0171] Figure 7 FIG. 7 is a block diagram showing a structure of a computer device 700 provided by an exemplary embodiment of the present application. The computer device 700 may be Figure 1 User terminal in the system shown.

[0172] Typically, the computer device 700 includes a processor 701 and a memory 702 .

[0173] The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 701 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), and the processor 701 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0174] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 702 is used to store at least one instruction, which is used to be executed by the processor 701 to implement all or part of the steps in the above method embodiments of the present application.

[0175] In some embodiments, the computer device 700 may further optionally include: a peripheral device interface 703 and at least one peripheral device. The processor 701, the memory 702 and the peripheral device interface 703 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 703 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 704, a touch display screen 705, a camera 706, an audio circuit 707, a positioning component 708 and a power supply 709.

[0176] The peripheral device interface 703 may be used to connect at least one I / O (Input / Output) related peripheral device to the processor 701 and the memory 702 .

[0177] Radio frequency circuit 704 is used for receiving and transmitting RF (Radio Frequency, radio frequency) signal, also known as electromagnetic signal. Optionally, radio frequency circuit 704 includes: antenna system, RF transceiver, one or more amplifiers, tuner, oscillator, digital signal processor, codec chipset, user identity module card, etc. Radio frequency circuit 704 can communicate with other computer equipment through at least one wireless communication protocol. In some embodiments, radio frequency circuit 704 can also include NFC (NearField Communication, close range wireless communication) related circuit, which is not limited in this application.

[0178] The display screen 705 is used to display a UI (User Interface). When the display screen 705 is a touch display screen, the display screen 705 also has the ability to collect touch signals on the surface of the display screen 705 or above the surface.

[0179] The camera assembly 706 is used to collect images or videos. In some embodiments, the camera assembly 706 may also include a flash.

[0180] The audio circuit 707 may include a microphone and a speaker. In some embodiments, the audio circuit 707 may also include a headphone jack.

[0181] The positioning component 708 is used to locate the current geographical location of the computer device 700 to implement navigation or LBS (Location Based Service).

[0182] The power supply 709 is used to supply power to various components in the computer device 700 .

[0183] In some embodiments, the computer device 700 further includes one or more sensors 710 , including but not limited to: an acceleration sensor 711 , a gyroscope sensor 712 , a pressure sensor 713 , a fingerprint sensor 714 , an optical sensor 715 , and a proximity sensor 716 .

[0184] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the computer device 700, and the computer device 700 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.

[0185] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including a computer program (instructions), and the above program (instructions) can be executed by a processor of a computer device to complete all or part of the steps in each method embodiment of the present application. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0186] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0187] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A permission control method in a front-end rendering scenario, characterized in that: The method comprises: Obtaining, through the front-end framework, a permission parameter of a page object, wherein the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required to render the page object; The permission parameters are transmitted to the permission control unit through the front-end framework, and the permission control unit is independent of other logic control units, and the other logic control units are software units with logic control functions other than permission control; Obtaining, by the permission control unit, permission control information of the page object according to the permission parameter, the permission control information being used to indicate whether the page object is visible in the current login state; The permission control unit performs permission control on the page object according to the permission control information.

2. The method according to claim 1, characterized in that The obtaining, by the permission control unit, the permission control information of the page object according to the permission parameter includes: The permission control unit compares the permission parameter with the permission control data, wherein the permission control data includes various permission parameters in the current login state; The authority control information is obtained according to a comparison result between the authority parameter and the authority control data.

3. The method according to claim 2, characterized in that The obtaining the permission control information according to the comparison result between the permission parameter and the permission control data includes: If the comparison result is that the permission parameter does not exist in the permission control data, first control information is obtained, where the first control information is used to indicate that the page object is not visible in the current login state.

4. The method according to claim 2, characterized in that: Before the authority control unit compares the authority parameter with the authority control data, the method further includes: Obtain the various permission parameters in the current login state from the server; The authority control data is generated according to the various authority parameters.

5. The method according to any one of claims 1 to 4, characterized in that: The performing permission control on the page object according to the permission control information by the permission control unit includes: When the page object is the page, and the permission control information indicates that the page object is not visible in the current login state, the permission control unit controls the jump to the designated page.

6. The method according to any one of claims 1 to 4, characterized in that: The performing permission control on the page object according to the permission control information by the permission control unit includes: When the page object is a page component in the page or an element in the page component, and the permission control information indicates that the page object is not visible in the current login state, the display attribute of the page object is set to hidden by the permission control unit.

7. The method according to any one of claims 1 to 4, characterized in that: The transferring the permission parameter into the permission control unit through the front-end framework includes: The designated hook function is called through the front-end framework to pass the permission parameter into the permission control unit; the designated hook function is a hook function that can be executed once for the page object.

8. A permission control device in a front-end rendering scenario, characterized in that: The device comprises: A first permission parameter acquisition module is used to acquire permission parameters of a page object through a front-end framework, wherein the page object is a page object in a page currently rendered by the front-end framework, and the permission parameter is used to indicate the user permission required to render the page object; A parameter input module, used to input the permission parameters into the permission control unit through the front-end framework, wherein the permission control unit is independent of other logic control units, and the other logic control units are software units having logic control functions other than permission control; An authority control information acquisition module, used to acquire the authority control information of the page object according to the authority parameter through the authority control unit, wherein the authority control information is used to indicate whether the page object is visible in the current login state; The permission control module is used to perform permission control on the page object according to the permission control information through the permission control unit.

9. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the permission control method in the front-end rendering scenario as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the permission control method in the front-end rendering scenario as described in any one of claims 1 to 7.