CN115221447A - Page menu authority control method, device, equipment and storage medium - Google Patents

Page menu authority control method, device, equipment and storage medium Download PDF

Info

Publication number
CN115221447A
CN115221447A CN202210875316.XA CN202210875316A CN115221447A CN 115221447 A CN115221447 A CN 115221447A CN 202210875316 A CN202210875316 A CN 202210875316A CN 115221447 A CN115221447 A CN 115221447A
Authority
CN
China
Prior art keywords
menu
information
routing
target
terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210875316.XA
Other languages
Chinese (zh)
Inventor
陶德威
李凌
张英彬
曹忠乾
宋琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202210875316.XA priority Critical patent/CN115221447A/en
Publication of CN115221447A publication Critical patent/CN115221447A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application discloses a method, a device, equipment and a storage medium for controlling the authority of a page menu, wherein the method comprises the following steps: acquiring a target role corresponding to a user to which a terminal belongs and target routing information associated with the target role; determining target menu information owned by the target role according to the incidence relation between the preset routing information and the menu information so as to determine a target menu structure based on the target menu information; obtaining routing structure information according to the target routing information and the target menu structure; and sending the routing structure information to the terminal so that the terminal dynamically loads the routing structure information to display a page menu for the user. According to the technical scheme of the embodiment of the application, the universality and the flexibility in the authority design are realized through the combination of the route and the menu.

Description

Page menu authority control method, device, equipment and storage medium
Technical Field
The application relates to the technical field of computers, and provides a page menu authority control method, a page menu authority control device, an electronic device and a computer readable storage medium.
Background
As the internet has evolved, web application systems have existed in various industries. Permission control is an essential link in the design of a web application architecture, for example: different users, after they log on to the system, can only see pages within their scope of authority.
At present, there are two common methods, firstly, a terminal hard-codes routing information in a routing file, adds a role identifier, and compares the role identifier with a role identifier returned by a server, thereby controlling the page menu authority. Secondly, the server associates the role with the routing information and dynamically returns the routing information, so that the terminal controls the page menu authority.
Disclosure of Invention
The application aims to provide a page menu permission control method, a page menu permission control device, an electronic device and a computer readable storage medium, and generality and flexibility in permission design are achieved through combination of routing and menus.
The application provides a page menu authority control method, which comprises the following steps: acquiring a target role corresponding to a user to which a terminal belongs and target routing information associated with the target role; determining target menu information owned by the target role according to the incidence relation between preset routing information and menu information so as to determine a target menu structure based on the target menu information; obtaining routing structure information according to the target routing information and the target menu structure; and sending the routing structure information to the terminal so that the terminal dynamically loads the routing structure information to display a page menu for the user.
Further, before obtaining a target role corresponding to a user to which the terminal belongs and target routing information associated with the target role, the method further includes: inputting all routing information required by a project; inputting menu information corresponding to the items; mounting the routing information on the corresponding menu information; and configuring the incidence relation between each role and the menu information so as to determine the routing information associated with each role.
Further, all routing information required for the entry item includes: all routing information required by a project is input into a routing management page, wherein the routing information comprises at least one of a title, a routing name, a routing path and a routing component path; and if the routing information comprises the routing component path, checking the routing component path in the routing information.
Further, the entering of the menu information corresponding to the item includes: inputting menu information corresponding to the item in a menu management interface, wherein the menu information comprises a menu name and a menu category; and adjusting the parent-child structure and the menu sequence of the menu information according to the configuration requirement to determine the menu structure.
Further, the mounting the routing information on the corresponding menu information includes: configuring a menu and a routing association table; determining specified menu information in the menu management interface; and receiving an adding instruction, and adding the specified routing information carried in the adding instruction into the menu and routing association table so as to associate the specified menu information with the specified routing information.
Further, the obtaining of the target role corresponding to the user to which the terminal belongs includes: when the terminal calls a local information interface with an authentication identifier, acquiring the authentication identifier, and extracting a user identifier of the user from the authentication identifier; and inquiring the target role associated with the user according to the user identification.
Further, the sending the routing structure information to the terminal includes: encoding the routing structure information, and encrypting the encoded routing structure information to obtain encrypted information; and sending the encrypted information to the terminal so that the routing structure information is dynamically loaded after the terminal decrypts and inversely codes the encrypted information.
The present application further provides a device for controlling authority of a page menu, the device includes: the terminal comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a target role corresponding to a user to which the terminal belongs and target routing information associated with the target role; the determining module is used for determining target menu information owned by the target role according to the incidence relation between preset routing information and menu information and the target routing information, and determining a target menu structure based on the target menu information; the structure module is used for obtaining routing structure information according to the target routing information and the target menu structure; and the sending module is used for sending the routing structure information to the terminal so as to enable the terminal to dynamically load the routing structure information and display a page menu for the user.
The present application further proposes an electronic device, which includes: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the electronic device to implement the method as described above.
The present application also proposes a computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor of a computer, cause the computer to carry out the method as described above.
Compared with the prior art, the method has the following beneficial effects:
according to the technical scheme, target routing information associated with a target role of a user is obtained, then menu information is determined based on the target routing information, so that a menu structure is determined, designated routing structure information owned by the user is obtained according to the menu structure and the obtained designated routing information, and a terminal dynamically loads the routing structure information and displays a corresponding page menu; based on the combination of the routing and the menu, the universality and the flexibility in the authority design are realized, for the terminal, a routing file table does not need to be configured locally, hard coding is not needed to judge whether the routing authority exists, the routing information is only maintained in the server, and operation and maintenance personnel do not need to perceive the existence of the routing, so that the maintenance cost is low.
Drawings
FIG. 1 illustrates a schematic diagram of one implementation environment to which the present application relates;
FIG. 2 is a flowchart illustrating a method for controlling authority of a page menu according to an exemplary embodiment of the present application;
FIG. 3 illustrates a diagram of a menu structure and routing structure information shown in an exemplary embodiment of the present application;
FIG. 4 shows a flow chart in an exemplary embodiment before step S110 in the embodiment shown in FIG. 2;
FIG. 5 shows a flow chart of step S101 in the embodiment shown in FIG. 4 in an exemplary embodiment;
FIG. 6 shows a flowchart of step S102 in the embodiment shown in FIG. 4 in an exemplary embodiment;
FIG. 7 shows a flowchart of step S103 in an exemplary embodiment, based on the embodiment shown in FIG. 5;
FIG. 8 shows a flow chart of step S110 in the embodiment shown in FIG. 1 in an exemplary embodiment;
FIG. 9 shows a flowchart of step S130 in the embodiment shown in FIG. 1 in an exemplary embodiment;
FIG. 10 is a schematic configuration flow diagram of another page menu permission control method according to the present application;
FIG. 11 is a flowchart illustrating another method for controlling page menu permissions according to an exemplary embodiment of the present application;
FIG. 12 is a diagram illustrating a structure of a page menu authority control apparatus according to an exemplary embodiment of the present application;
fig. 13 shows a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flowcharts shown in the figures are illustrative only and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should also be noted that: reference to "a plurality" in this application means two or more. "and/or" describes the association relationship of the associated object, indicating that there may be three relationships, for example, a and/or B may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Referring to fig. 1, fig. 1 is a schematic diagram of an implementation environment related to the present application. The implementation environment includes a terminal 10 and a server 20, and the terminal 10 and the server 20 may be connected through a network, which may be a wired network or a wireless network, and is not limited herein.
The server 20 is configured to control the authority of the page menu displayed by the terminal 10, and for different users, only the page menu within the authority range can be seen; the terminal 10 is used for displaying a corresponding page menu to the user based on the authority control of the server.
Optionally, the server 20 obtains a target role corresponding to the user to which the terminal 10 belongs, and target routing information associated with the target role; determining target menu information owned by a target role according to the incidence relation between preset routing information and the menu information so as to determine a target menu structure based on the target menu information; obtaining routing structure information according to the target routing information and the target menu structure; and sending the routing structure information to the terminal so that the terminal dynamically loads the routing structure information to display a page menu for the user.
The terminal 10 receives the routing structure information sent by the server, and dynamically loads the routing structure information to display a page menu for the user.
The method and the device improve flexibility and convenience in authority design through combination of routing and menus.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like, which is not limited herein.
The terminal includes, but is not limited to, a smart phone, a tablet, a notebook, a computer, an intelligent voice interaction device, an intelligent appliance, a vehicle-mounted terminal, an aircraft, and the like.
The following describes the authority control method in detail based on the implementation environment shown in fig. 1:
referring to fig. 2, fig. 2 is a flowchart of a page menu permission control method according to an exemplary embodiment of the present application, where the page menu permission control method is executed by the server shown in fig. 1, the page menu permission control method includes steps S110 to S140, and the following detailed description is provided:
s110, acquiring a target role corresponding to a user to which the terminal belongs and target routing information associated with the target role.
It should be noted that, a correspondence table between users and roles is pre-stored in the server, and different users all have roles in the server, and the roles are different and have different permissions corresponding to the roles; for example, if the role is an administrator role, the administrator role is granted with all permissions, that is, the administrator role can acquire any data of the server; another example is that the role is a restriction role, which can learn the restricted specified data; therefore, the target role corresponding to the user to which the terminal belongs can be determined according to the corresponding relation table of the user and the role.
Optionally, one user may correspond to one role, and one user may also correspond to multiple roles; when the user of the terminal corresponds to two roles, two target roles can be obtained. Of course, when the user to which the terminal belongs corresponds to two roles, one role may be selected from the two roles as the target role, for example, a role with a high authority may be selected as the target role, and for example, one role may be selected as the target role based on an instruction of the terminal.
The routing information refers to key information for the terminal to perform page hopping, such as a routing name and a routing path.
In the embodiment of the application, the role and the routing information have an association relationship, and after the target role is determined, the association relationship between the role and the routing information determines the target routing information associated with the target role, wherein the target routing information is the routing information of the authority possessed by the target role.
S120, determining target menu information owned by the target role according to the incidence relation between the preset routing information and the menu information and the target routing information, and determining a target menu structure based on the target menu information.
In the embodiment of the application, the incidence relation between the preset routing information and the menu information is stored in the server, so that after the target routing information associated with the target role is determined, the target routing information can be matched with the incidence relation between the preset routing information and the menu information, and the target menu information owned by the target role is further determined; the menu information refers to information describing a menu, such as a menu name, category, order, content, and the like.
Optionally, the number of the menu information corresponds to the number of the routing information, that is, how many pieces of routing information exist, for example, the menu 1 and the menu 2 owned by the target role1 can be determined, and then the routing information 1 and the routing information 2 corresponding to the menu information of the menu 1 and the menu 2, respectively, can be determined.
It should be noted that the target menu structure may be determined based on the target menu information, and the menu structure is used to determine how to assemble the route. The menu structure refers to a tree-structured order of menus, which includes a parent-child structure between two menu nodes, and an order between two child menus (or parent menus).
In the embodiment of the present application, the target menu structure may be determined based on at least one of a menu category, a menu order, and menu content in the target menu information.
S130, obtaining the routing structure information according to the target routing information and the target menu structure.
It can be understood that, since the routing information is associated with the menu information, after the target menu structure is obtained, the target routing information may be organized based on the target menu structure to obtain the routing structure information, where the routing structure information includes both the routing structure and the routing information. For example, as shown in fig. 3, if the menu structure is that menu 1 is a parent menu, menu 2 and menu 3 are submenus of menu 1, menu 2 is located in front of menu 3, and menus 1, 2, and 3 respectively correspond to routing information 1, 2, and 3, then routing structure information of routing information 1, and routing information 2 and routing information 3 under routing information 1 are obtained.
S140, the routing structure information is sent to the terminal, so that the terminal dynamically loads the routing information to display a page menu for the user.
In the embodiment of the application, after the routing structure information is determined, the routing structure information is sent to the terminal, the terminal can asynchronously and dynamically load the routing structure information, that is, the corresponding routing information is loaded according to the routing structure, the page menu authority is controlled, the page menu for a user is displayed, and then the user can only see the limited menus, such as only the menu 1 and the menu 2.
In the embodiment of the application, target routing information associated with a target role of a user is obtained, then menu information is determined based on the target routing information, so that a menu structure is determined, designated routing structure information owned by the user is obtained according to the menu structure and the obtained designated routing information, and a terminal dynamically loads the routing structure information and displays a corresponding page menu; based on the combination of routing and menus, the universality and flexibility in authority design are realized, and for a terminal, a routing file table does not need to be configured locally, and hard coding is not needed to judge whether the routing authority exists or not.
It is to be noted that the method for controlling page menu permission in the embodiment of the present application further includes a configuration process, as shown in fig. 4, where fig. 4 shows a flowchart in an exemplary embodiment before step S110 in the embodiment shown in fig. 2, and includes:
and S101, recording all routing information required by the project.
And S102, inputting menu information corresponding to the items.
S103, mounting the routing information in the corresponding menu information.
S104, configuring the association relation between each role and the menu information so as to determine the routing information associated with each role.
In the embodiment of the application, the routing information and the menu information are input, and the routing information is mounted on the corresponding menu information so as to be associated with the menu information; the entry sequence of the routing information and the menu information may be performed simultaneously, or the routing information may be entered first, or the menu information may be entered first, which is not limited herein.
Optionally, the routing information and the menu information may be entered through an interface, or may be entered through a script; for example, routing information and menu information are input through an interface in a developer mode, and the script can be executed by exporting an information input script in a test environment and a formal environment in the later period without inputting the interface.
Optionally, the route information is mounted on the corresponding menu information, which may be a preset relationship between the menu and the route, and the corresponding mounting is performed. The relationship between the menu information and the routing information can be dynamically configured according to requirements.
After the menu information and the routing information are configured, the association relationship between the roles and the menu information is configured, where one role may correspond to one menu authority or to multiple menu authorities, and is not limited herein.
By configuring the association relationship between the roles and the menu information, that is, performing authorization processing, it can be understood that, through the above configuration process, the roles and the menu information have association information, and the routing information is mounted on the menu information, so that after obtaining the target role, the routing information indirectly associated with the target role can be obtained. For example, after the target role of the user to which the terminal belongs is acquired, the menu information associated with the target role, which is configured in advance in S104, may be searched based on the target role, and then the routing information corresponding to the menu information may be determined based on the mounting relationship in S103.
In an example of the embodiment of the present application, before configuring an association relationship between each role and menu information, the method further includes: and establishing a role, and associating the role with the user. Namely, the server establishes a new role, acquires user information, and further associates the user information with the role so as to authorize the role corresponding to each user.
In the embodiment of the application, the control of the page menu authority can be achieved only by maintaining the data of the server and carrying out simple configuration.
Optionally, as shown in fig. 5, fig. 5 shows a flowchart of step S101 in the embodiment shown in fig. 4 in an exemplary embodiment, wherein the process of entering all routing information required by the item includes:
and S510, all routing information required by the entry is input into a routing management page, wherein the routing information comprises at least one of a title, a routing name, a routing path and a routing component path.
In the embodiment of the application, a route management interface is firstly displayed, and all route information required by a project is input in the route management interface according to an input instruction input by a user, wherein the route information comprises a title and is used for displaying the name of a left navigation menu; the route name is used for distinguishing the menu by the user, and the user clicks the menu to carry out page jump based on the route; a routing path for page jump, i.e. to what page to jump; the routing component path is used for page file jumping, namely, jumping to what page file.
In some examples, the routing information further includes field information such as whether to be presented as a menu, whether to enable caching, and the like, and of course, the field information included in the routing information may also be flexibly expanded according to actual needs.
S520, if the routing information comprises the routing component path, the routing component path in the routing information is verified.
In order to ensure the accuracy of the forwarding, in the embodiment of the present application, the routing component path in the routing information needs to be checked to check whether the routing component path is filled accurately.
Optionally, an import and export technology of JS (JavaScript) is used to check whether the route of the routing component is filled accurately, and if not, an error prompt is given to facilitate correction.
Optionally, as shown in fig. 6, fig. 6 is a flowchart of step S102 shown in fig. 4 in an exemplary embodiment, where the process of entering the menu information corresponding to the item includes:
s610, inputting menu information corresponding to the items in a menu management interface, wherein the menu information comprises menu names and menu categories.
In the embodiment of the application, a menu management interface is displayed, and menu information is input in the menu management interface according to an input instruction input by a user. The menus displayed in the menu management interface are tree structures, namely, the menu nodes in the tree structures have parent-child relationships and precedence relationships. The information contained in each menu node comprises a menu name and a menu category, the menu category comprises a target menu, a page menu and a button menu, wherein the directory menu comprises a non-leaf node menu in a left navigation bar menu, the page menu is a leaf node menu, page tuning jump can be carried out by clicking the leaf node menu, and the button menu is a control element for adding or editing and the like in a page.
S620, adjusting the parent-child structure and the menu sequence of the menu information according to the configuration requirement to determine the menu structure.
It is understood that the menu nodes in the tree structure can be adjusted according to the configuration requirement, for example, the menu nodes in the tree structure are dragged to change the parent-child structure and the menu order of the menu information, i.e., the tree structure order, where the tree structure order is used to determine the menu structure of the left navigation bar.
Optionally, as shown in fig. 7, fig. 7 is a flowchart of step S103 in an exemplary embodiment based on fig. 5, where the process of mounting the routing information on the corresponding menu information includes:
s710, configuring a menu and a route association table.
S720, determining the appointed menu information in the menu management interface.
And S730, receiving an adding instruction, and adding the specified routing information carried in the adding instruction into the menu and routing association table so as to associate the specified menu information with the specified routing information.
In the embodiment of the application, a menu and route association table can be newly created, and the menu information and the route information in the menu and route association table have an association relationship.
In the menu management interface, the left side is displayed as a menu tree structure, and the right side is displayed as a routing menu association table. Firstly selecting appointed menu information of a menu tree structure, and determining the appointed menu information in a menu management interface through touch control, mouse and other operations; after the appointed menu information is determined, an adding instruction is received in a menu management interface, the adding instruction comprises but is not limited to an instruction obtained based on touch operation input by a user, appointed routing information is carried in the adding instruction, the appointed routing information is added into a menu and routing association table, the appointed menu information is associated with the appointed routing information, and therefore the corresponding routing information is mounted on the corresponding menu information.
Optionally, as shown in fig. 8, fig. 8 is a flowchart of step S110 shown in fig. 1 in an exemplary embodiment, where the process of acquiring the target role corresponding to the user to which the terminal belongs includes:
s111, when the terminal carries the authentication identifier to call a local information interface, acquiring the authentication identifier, and extracting the user identifier of the user from the authentication identifier.
In the embodiment of the application, the authentication identifier of the terminal refers to an authentication identifier after the terminal is verified, and represents the validity of the terminal; optionally, the authentication identifier of the terminal is a JWT (JSON Web Token) identifier, and the JWT has been widely applied to various distributed applications as a stateless authentication identifier; the JWT token is used to authenticate the validity and legitimacy of the user.
The terminal carries the authentication identifier to call an information interface of the server, and then the server can intercept the request of the terminal through the information interface and acquire the authentication identifier from the request. It should be noted that the authentication identifier carries a user identifier of the user, where the user identifier includes, but is not limited to, a user account, a user identity identifier, and the like.
After obtaining the authentication identifier, for example, after acquiring JWT, the server analyzes body (body) in JWT by using unbase64 (function that returns decoded base64 character string in binary form), thereby extracting the user identifier.
In the embodiment of the application, the authentication identifier is sent to the terminal by the server. For example, when a user logs in a terminal, the terminal sends login information of the user to a server, the server authenticates the identity of the terminal according to the login information, when the authentication passes, an authentication identifier is sent to the terminal, wherein the login information can be a user name and a password, the server verifies the correctness of the user name and the password, the authentication identifier is sent to the terminal, and the terminal can apply for a corresponding page menu to be displayed to the server after receiving the authentication identifier.
And S112, inquiring the target role associated with the user according to the user identification.
As mentioned above, the server stores the corresponding relationship between the user and the role, specifically, the corresponding relationship between the user identifier and the role, and further queries the target role associated with the user according to the user identifier.
Optionally, as shown in fig. 9, fig. 9 is a flowchart of step S130 shown in fig. 1 in an exemplary embodiment, where the process of sending the routing structure information to the terminal includes:
s131, the routing structure information is coded, and the coded routing structure information is encrypted to obtain encrypted information.
In the embodiment of the application, in order to ensure the accuracy and the safety of information transmission, the routing structure information is encoded to determine that the information is not scrambled, and the encoded routing structure information is encrypted to ensure the safety of the information.
Optionally, base64 (a code representing binary data based on 64 printable characters) is performed on the routing structure information, and the encoded routing structure information is encrypted by a 3DES (Triple DES, triple data encryption algorithm) algorithm.
S132, the encrypted information is sent to the terminal, so that the routing structure information is dynamically loaded after the terminal decrypts and de-encodes the encrypted information.
And the server sends the encrypted information to the terminal, and the terminal decodes and de-encodes the encrypted information to obtain the routing information.
Optionally, the server sends the encrypted information to the terminal through a local information interface.
Here, the dynamic loading of the routing structure information by the terminal will be described.
As described above, the routing structure information includes the routing information and the routing structure, so the terminal performs recursive processing according to the routing information structure, and simultaneously uses the requirer runtime dynamic import technology to load the page component corresponding to the component path in the routing information, thereby obtaining a dynamic routing array, adding the dynamic routing array to the route of the VUE (one of the terminal frames), recursively traversing the assembled dynamic routing array, and displaying the name of the left menu bar by reading the title in the route according to the structure of the route and the left menu navigation bar of the information display system. A certain system is provided with four menu pages A, B, C and D. Two roles are newly established on a role management interface of the system, wherein role1, role2, role1 are associated with menus of A and B, and role2 is associated with menus of C and D. Second, the system user1 is associated with role1 and user2 is associated with role2. When user1 logs in the system, it can only see the A and B menus on the left menu navigation bar, and when user2 logs in the system, it can only see the C and D menus.
For convenience of understanding, the present embodiment describes the authority control method with a more specific example. The authority control method aims to solve the problem of dynamic change of the authority of the terminal page, and terminal developers do not need to change terminal codes, so that the system is easy to expand. The page menu authority control method comprises a configuration process and an application process; the configuration process, as shown in fig. 10, includes:
and S1010, entering a routing management interface, and inputting routing information into the routing management interface according to the service requirement.
The routing information comprises field information such as title, routing path, routing component, whether to be displayed as a menu, whether to start caching and the like, and the routing management can also expand the field if the later service is needed.
And S1020, checking the routing information.
And clicking a route check button of the interface, checking whether the route of the component is accurately filled by using the import technology of the JS, if not, giving an error prompt, correcting by a developer, and checking the route information again after correction.
And S1030, entering a menu management interface, and inputting menu information in the menu management interface.
When the routing information passes the verification, entering a menu management interface, wherein the menu of the menu management interface is displayed in a tree structure, and each menu node comprises the following information: the menu name, the menu category (directory menu, page menu, button menu), wherein the directory menu is the non-leaf node menu in the navigation bar menu on the left side of the system, the page menu is the leaf node menu, and the button menu is the new or edit button in the page. Meanwhile, the nodes of the menu tree can be dragged to change the tree structure sequence of the menu, and the sequence determines the menu structure of the left navigation bar of the system.
And S1040, mounting the route according to the relation between the menu and the route.
And associating the menu with the route in a menu management interface according to the relationship between the menu and the route. For example, in the menu management interface, the left side is the menu tree structure and the right side is the routing menu association table. Firstly selecting a menu, secondly, searching a route according to a route name by a search box in a menu management interface, adding the route into a menu route association table, associating the menu with the route, wherein the menu and the route are in one-to-one correspondence. At the same time, the route is allowed to be removed from the route association table, thereby releasing the relationship between the route and the menu.
And S1050, entering a role management interface, and configuring the association relationship between the role and the menu.
When configuring the association relationship between the role and the menu, the process may also be similar to the association configuration process between the menu and the route, which is not described herein again. The relationship between the role ID and the route ID (namely, the route information) is related through the association configuration of the role ID and the menu ID (namely, the menu information), and then the order of the menus determines how to assemble the route structure.
As shown in fig. 11, the terminal dynamically loads and displays the left menu navigation bar, which specifically includes the following steps:
and S1110, the user logs in the interface at the terminal to log in.
After the user name and the password are input in the terminal login interface, the server verifies the accuracy of the user name and the password and returns the JWT identification.
S1120, the terminal calls an interface of the server for acquiring the user information.
And after the terminal acquires the JWT, the JWT is taken to acquire a user information interface.
S1130, the server obtains the user-associated roles, and obtains routing information and menu information according to the roles.
The server intercepts the terminal request through a user information interface, acquires the JWT, analyzes the body in the JWT by using the unbase64 so as to extract the user ID, and inquires the role associated with the user according to the user ID so as to acquire the routing information and the menu information owned by the role.
S1140, the server assembles the routing structure information with the authority according to the menu structure and the acquired authority routing information, encrypts the routing structure information and sends the encrypted routing structure information to the terminal.
The routing structure directly determines the display structure of the left navigation bar of the system; the routing without permission can not be returned to the terminal, and the terminal does not need to carry out any judgment filtering operation.
The server assembles a routing structure, carries out base64 encoding before returning to the terminal to prevent Chinese messy codes, and then encrypts routing information by using 3 DES.
S1150, after the terminal decrypts the routing structure information, the page component corresponding to the routing path is loaded, and the routing information is assembled.
And after the routing information is acquired, assembling a routing information structure required by the terminal framework, and then loading the page component corresponding to the component path in the routing information by using a require runtime dynamic import technology, thereby acquiring the dynamic routing information.
S1160, adding the organized dynamic routing information to the total routing set.
The dynamic routing array is added to the VUE's total routing set.
And S1170, traversing the total route set to display a menu navigation bar on the left side of the system.
And recursively traversing the assembled routing information structure, and displaying a system left menu navigation bar according to the routing structure and the information.
The following specific examples are described by taking user login and different page presentations in a product service design center as examples.
Assuming a menu navigation bar on the left side of the system, performing rule management, performing system management, and performing rule management on a regular real-column page, a rule template page and a newly-built rule instance; under the system management, there are user interface, user group interface and management menu interface.
1. The routing table information is shown in table 1 below:
Figure BDA0003759841130000131
TABLE 1
And 2, recording the routing information into a database according to the routing table.
3, in a menu management interface, according to service requirements, inputting a corresponding menu structure, for example: the rule-managed menu information is as follows: menu name: rule management, menu category: a directory; a rule implementation menu is newly established, the rule implementation menu is a sub-menu managed by rules, and the information is as follows: menu name: rule column, menu category: a page menu; the menu information of a newly-added rule instance is newly established as follows: menu name: new rule examples, menu category: a menu of buttons. The remaining menus are configured in accordance with the above structure.
And 4, mounting the routing information on a menu, such as: and associating the route managed by the rule with the menu managed by the rule, searching the route according to the name of the route managed by the rule on a menu management interface, and adding the searched route into a menu route association table. The rest of the menus are associated with the routes as above.
And 5, establishing two roles, namely a rule management role and a system management role, in the role management interface. The rule management role is associated with a rule management menu, a rule implementation menu, a rule template menu and a newly-built rule implementation menu; the system management role is associated with a system management menu, a user group management menu and a management menu interface, and in essence, the role ID is associated with the routing ID.
Two users, e.g., users test1 and test2, are newly created. Finally, test1 is associated with the rule management role, and test2 is associated with the system management role. When the test1 user logs in successfully, JWT is obtained, then JWT calls a server interface, the server firstly obtains a routing ID with authority according to roles, then obtains routing structure information according to the association between the routing ID and the menu tree structure, and finally the routing structure information returned by the interface only contains routing information of rule management, rule examples, rule templates and newly added rule entities. The specific structure of the routing structure information is as follows:
[
{
"component":"@/layout/index",
"enableCache":0,
"icon":"rule_manager,
"id":"802022",
"isMenu":1,
"name":"ruleManager",
"path":"/ruleManager",
"remark": rule manages routing ",
"title": rule management "// parent menu page is rule management
"children":[
{
"children":[],
"component":"@/views/ruleModel/index",
"enableCache":0,
"icon":"rule_model,
"id":"802023",
"isMenu":1,
"name":"ruleModel",
"path":"/ruleModel",
"remark": regular template routing ",
"title": rule template "
The page of the "},// sub-menu is a rule template
{
"children":[],
"component":"@/views/ruleInstance/index",
"enableCache":0,
"icon":"rule_instance,
"id":"802024",
"isMenu":1,
"name":"ruleInstance",
"path":"/ruleInstance",
"Remark": rule instance routing ",
"title": rule instance "},// sub-menu page is rule instance
{
"children":[],
"component":"@/views/ruleInstance/createIndex",
"enableCache":0,
"icon":"",
"id":"802025",
"isMenu":0,
"name":"ruleInstanceCreate",
"path":"/ruleInstanceCreate",
' remark ': newly adding rule instance routing ',
"title": new rule instance,// submenu page is the New rule instance
}]
}
]
7, the routing structure information server adopts base64 for coding and also adopts 3DES encryption technology for encryption and transmission to the terminal.
8, after the terminal receives the routing structure information and performs decryption and decoding processing, the terminal starts to use a recursion algorithm to traverse the routing structure, and in the recursion process, the route component page is loaded by using a require ([ "module path ], resolve) technology of JS, and a specific loading function is as follows:
export const loadView=(view)=>{
return(resolve)=>require([`${path}`],resolve)
}
the final assembled accessible routes are placed into the accessRoutes array.
The terminal framework (vue, angular. Exact) will cause the method of router.
And 10, finally, traversing the accessways by using a recursive algorithm, and combining a terminal UI framework (element-UI) to dynamically display the left menu navigation bar.
And 11, finally, the test1 user can only see a rule management menu, a rule list menu and a rule template menu, and cannot see a system management menu, a user group management menu and a management menu interface.
12, if the test2 user logs in, repeating the step 6, and finally displaying a system management menu, a user group management menu and a management menu interface on the left menu navigation bar, wherein the rule management menu, the rule implementation menu and the rule template menu cannot be seen.
13, if the page authority of the user needs to be changed, the page authority can be controlled only by the role configuration. If the order of the menus of the navigation bar on the left side of the system is required to be adjusted, the menu management interface is only needed to be reached, and the order of the menus is adjusted.
According to the method provided by the embodiment of the application, the menu is associated with the route in the middle, the role ID is not directly associated with the menu ID but is associated with the route ID, the routing information with the authority can be obtained according to the structure of the menu and the association of the menu and the route, finally, when a user logs in, the role routing information owned by the user is returned, the terminal dynamically loads the routing information and displays the corresponding menu, terminal developers do not need to change terminal codes, therefore, the expandability of the system is achieved, and operation and maintenance personnel do not need to sense the existence of the route when configuring the authority, and therefore the maintainability of the system is achieved.
The following describes embodiments of an apparatus of the present application, which may be used to execute a method for controlling authority of a page menu in the above embodiments of the present application. For details that are not disclosed in the embodiments of the device of the present application, please refer to the embodiments of the page menu permission control method described above in the present application.
As shown in fig. 12, fig. 12 is a schematic structural diagram of a page menu permission control apparatus according to an exemplary embodiment of the present application, where the apparatus is deployed in a server, and the apparatus includes:
an obtaining module 1210, configured to obtain a target role corresponding to a user to which a terminal belongs and target routing information associated with the target role;
the determining module 1220 is configured to determine target menu information owned by a target role according to the preset association relationship between the routing information and the menu information and the target routing information, and determine a target menu structure based on the target menu information;
a structure module 1230, configured to obtain routing structure information according to the target routing information and the target menu structure;
a sending module 1240, configured to send the routing structure information to the terminal, so that the terminal dynamically loads the routing structure information, so as to display a page menu for the user.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes a configuration module, configured to enter all routing information required by the project; inputting menu information corresponding to the items; mounting the routing information on corresponding menu information; and configuring the association relation between each role and the menu information so as to determine the routing information associated with each role.
In some embodiments of the present application, based on the foregoing solution, the configuration module is further configured to enter all routing information required for the project in the routing management page, where the routing information includes at least one of a title, a routing name, a routing path, and a routing component path; and if the routing information comprises the routing component path, checking the routing component path in the routing information.
In some embodiments of the present application, based on the foregoing scheme, the configuration module is further configured to enter menu information corresponding to an item in a menu management interface, where the menu information includes a menu name and a menu category; and adjusting the parent-child structure and the menu sequence of the menu information according to the configuration requirement to determine the menu structure.
In some embodiments of the present application, based on the foregoing solution, the configuration module is further configured to configure a menu and route association table; determining specified menu information in a menu management interface; and receiving an adding instruction, and adding the specified routing information carried in the adding instruction into a menu and routing association table to associate the specified menu information with the specified routing information.
In some embodiments of the present application, based on the foregoing solution, the obtaining module 1210 is further configured to obtain the authentication identifier when the terminal carries the authentication identifier and calls a local information interface, and extract the user identifier of the user from the authentication identifier; and inquiring the target role associated with the user according to the user identification.
In some embodiments of the present application, based on the foregoing scheme, the sending module 1240 is further configured to encode the routing structure information, and encrypt the encoded routing structure information to obtain encrypted information; and sending the encrypted information to the terminal so that the routing structure information is dynamically loaded after the terminal decrypts and de-encodes the encrypted information.
It should be noted that the apparatus provided in the foregoing embodiment and the method provided in the foregoing embodiment belong to the same concept, and the specific manner in which each module and unit execute operations has been described in detail in the method embodiment, and is not described again here.
The device of the embodiment of the application acquires target routing information associated with a target role of a user, then determines menu information based on the target routing information so as to determine a menu structure, acquires specified routing structure information owned by the user according to the menu structure and the acquired specified routing information, and dynamically loads the routing structure information by the terminal and displays a corresponding page menu; based on the combination of the routing and the menu, the universality and the flexibility in the authority design are realized, for the terminal, a routing file table does not need to be configured locally, hard coding is not needed to judge whether the routing authority exists, the routing information is only maintained in the server, and operation and maintenance personnel do not need to perceive the existence of the routing, so that the maintenance cost is low.
In an exemplary embodiment, an electronic device includes one or more processors; storage means for storing one or more programs which, when executed by one or more processors, cause an electronic device to implement the method as before. It is to be understood that the electronic device may be deployed within a server.
Fig. 13 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
It should be noted that the electronic device is only an example adapted to the application and should not be considered as providing any limitation to the scope of the application. The electronic device is also not to be construed as requiring reliance on, or necessity of, one or more components of the exemplary electronic device illustrated in fig. 13.
As shown in fig. 13, in an exemplary embodiment, the electronic device includes a processing component 1301, a memory 1302, a power component 1303, a multimedia component 1304, an audio component 1305, a processor 1306, a sensor component 1307, and a communications component 1308. The above components are not all necessary, and the electronic device may add other components or reduce some components according to its own functional requirements, which is not limited in this embodiment.
The processing component 1301 generally controls the overall operation of the electronic device, such as operations associated with display, data communication, and log data synchronization. The processing component 1301 may include one or more processors 1306 to execute instructions to perform all or a portion of the steps of the operations described above. Further, processing component 1301 may include one or more modules that facilitate interaction between processing component 1301 and other components. For example, the processing component 1301 may include a multimedia module to facilitate interaction between the multimedia component 1304 and the processing component 1301.
The memory 1302 is configured to store various types of data to support operation at the electronic device, examples of which include instructions for any application or method operating on the electronic device. The memory 1302 stores one or more modules configured to be executed by the one or more processors 1306 to perform all or a portion of the steps of the methods described in the embodiments above.
The power supply component 1303 provides power to various components of the electronic device. The power components 1303 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for an electronic device.
The multimedia component 1304 includes a screen that provides an output interface between the electronic device and the user. In some embodiments, the screen may include a TP (Touch Panel) and an LCD (Liquid Crystal Display). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
The audio component 1305 is configured to output and/or input an audio signal. For example, the audio component 1305 includes a microphone configured to receive external audio signals when the electronic device is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. In some embodiments, the audio component 1305 also includes a speaker for outputting audio signals.
The sensor component 1307 includes one or more sensors for providing various aspects of status assessment for the electronic device. For example, the sensor component 1307 can detect an open/closed state of the electronic device, and can also detect a temperature change of the electronic device.
The communication component 1308 is configured to facilitate communication between the electronic device and other devices in a wired or wireless manner. The electronic device may access a Wireless network based on a communication standard, such as Wi-Fi (Wireless-Fidelity, wireless network).
It will be appreciated that the configuration shown in fig. 13 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 13 or have different components than shown in fig. 13. Each of the components shown in fig. 13 may be implemented in hardware, software, or a combination thereof.
In an exemplary embodiment, a computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist separately without being incorporated in the electronic device.
It should be noted that the computer readable storage medium shown in the embodiments of the present application may be, for example, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
The above description is only a preferred exemplary embodiment of the present application, and is not intended to limit the embodiments of the present application, and those skilled in the art can easily make various changes and modifications according to the main concept and spirit of the present application, so that the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for controlling authority of a page menu is characterized by comprising the following steps:
acquiring a target role corresponding to a user to which a terminal belongs and target routing information associated with the target role;
determining target menu information owned by the target role according to the incidence relation between preset routing information and menu information so as to determine a target menu structure based on the target menu information;
obtaining routing structure information according to the target routing information and the target menu structure;
and sending the routing structure information to the terminal so that the terminal dynamically loads the routing structure information to display a page menu for the user.
2. The method according to claim 1, wherein before obtaining the target role corresponding to the user to which the terminal belongs and the target routing information associated with the target role, the method further comprises:
inputting all routing information required by a project;
inputting menu information corresponding to the items;
mounting the routing information on the corresponding menu information;
and configuring the incidence relation between each role and the menu information so as to determine the routing information associated with each role.
3. The method according to claim 2, characterized in that all routing information required for entry of an item comprises:
all routing information required by a project is input into a routing management page, wherein the routing information comprises at least one of a title, a routing name, a routing path and a routing component path;
and if the routing information comprises the routing component path, checking the routing component path in the routing information.
4. The method of claim 2, wherein entering the menu information corresponding to the item comprises:
inputting menu information corresponding to the item in a menu management interface, wherein the menu information comprises a menu name and a menu category;
and adjusting the parent-child structure and the menu sequence of the menu information according to the configuration requirement to determine the menu structure.
5. The method of claim 4, wherein the mounting the routing information on the corresponding menu information comprises:
configuring a menu and a routing association table;
determining specified menu information in the menu management interface;
and receiving an adding instruction, and adding the specified routing information carried in the adding instruction into the menu and routing association table so as to associate the specified menu information with the specified routing information.
6. The method of claim 1, wherein the obtaining of the target role corresponding to the user to which the terminal belongs comprises:
when the terminal calls a local information interface with an authentication identifier, acquiring the authentication identifier, and extracting a user identifier of the user from the authentication identifier;
and inquiring the target role associated with the user according to the user identification.
7. The method of claim 1, wherein sending the routing structure information to the terminal comprises:
encoding the routing structure information, and encrypting the encoded routing structure information to obtain encrypted information;
and sending the encrypted information to the terminal so that the routing structure information is dynamically loaded after the terminal decrypts and inversely codes the encrypted information.
8. A page menu permission control apparatus, the apparatus comprising:
the terminal comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a target role corresponding to a user to which the terminal belongs and target routing information associated with the target role;
the determining module is used for determining target menu information owned by the target role according to the incidence relation between preset routing information and menu information and the target routing information, and determining a target menu structure based on the target menu information;
the structure module is used for obtaining routing structure information according to the target routing information and the target menu structure;
and the sending module is used for sending the routing structure information to the terminal so as to enable the terminal to dynamically load the routing structure information and display a page menu for the user.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs that, when executed by the one or more processors, cause the electronic device to perform the method of any of claims 1-7.
10. A computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor of a computer, cause the computer to perform the method of any one of claims 1 to 7.
CN202210875316.XA 2022-07-22 2022-07-22 Page menu authority control method, device, equipment and storage medium Pending CN115221447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210875316.XA CN115221447A (en) 2022-07-22 2022-07-22 Page menu authority control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210875316.XA CN115221447A (en) 2022-07-22 2022-07-22 Page menu authority control method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115221447A true CN115221447A (en) 2022-10-21

Family

ID=83614817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210875316.XA Pending CN115221447A (en) 2022-07-22 2022-07-22 Page menu authority control method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115221447A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686683A (en) * 2022-11-21 2023-02-03 广州市保伦电子有限公司 Menu navigation dynamic generation method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686683A (en) * 2022-11-21 2023-02-03 广州市保伦电子有限公司 Menu navigation dynamic generation method, device, equipment and medium
CN115686683B (en) * 2022-11-21 2023-09-08 广东保伦电子股份有限公司 Menu navigation dynamic generation method, device, equipment and medium

Similar Documents

Publication Publication Date Title
US10735196B2 (en) Password-less authentication for access management
US10157275B1 (en) Techniques for access management based on multi-factor authentication including knowledge-based authentication
US10693859B2 (en) Restricting access for a single sign-on (SSO) session
US10462142B2 (en) Techniques for implementing a data storage device as a security device for managing access to resources
JP6707127B2 (en) Access server authenticity check initiated by end user
EP2684330B1 (en) Method and system for granting access to a secured website
US10225283B2 (en) Protection against end user account locking denial of service (DOS)
US20150089616A1 (en) Techniques for user authentication
US11714693B2 (en) Data driven API conversion
US11283793B2 (en) Securing user sessions
US20170322929A1 (en) Script manager for distributed systems
CN111833507B (en) Visitor authentication method, device, equipment and computer readable storage medium
US11947710B2 (en) Real-time feature level software security
US11750590B2 (en) Single sign-on (SSO) user techniques using client side encryption and decryption
US10003592B2 (en) Active directory for user authentication in a historization system
CN111031037A (en) Authentication method and device for object storage service and electronic equipment
CN118214615B (en) Unified management method and device for background authorization of multiple social media platforms
CN115221447A (en) Page menu authority control method, device, equipment and storage medium
US20100250607A1 (en) Personal information management apparatus and personal information management method
CN114745164B (en) Service processing method, device, electronic equipment and computer readable medium
CN113141251B (en) Method and device for logging in website
CN116720166A (en) User management method, device, terminal equipment and storage medium
CN116887382A (en) Network allocation method, device, equipment, medium and program product of intelligent equipment
CN118629110A (en) Temporary unlocking method and device for intelligent lock, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination