WO2022267178A1 - 项目文件的管理方法、装置、电子设备及存储介质 - Google Patents

项目文件的管理方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022267178A1
WO2022267178A1 PCT/CN2021/109396 CN2021109396W WO2022267178A1 WO 2022267178 A1 WO2022267178 A1 WO 2022267178A1 CN 2021109396 W CN2021109396 W CN 2021109396W WO 2022267178 A1 WO2022267178 A1 WO 2022267178A1
Authority
WO
WIPO (PCT)
Prior art keywords
reader
file
resource
data
read
Prior art date
Application number
PCT/CN2021/109396
Other languages
English (en)
French (fr)
Inventor
郑如刚
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022267178A1 publication Critical patent/WO2022267178A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2141Access rights, e.g. capability lists, access control lists, access tables, access matrices

Definitions

  • the present application relates to the technical field of artificial intelligence, in particular to a project file management method, device, electronic equipment and storage medium.
  • XML External Entity referred to as XXE vulnerability.
  • the server injects the specified xml entity content into the project file, so that the server executes according to the specified xml entity content, resulting in the project file being blocked. Wrong execution, low security.
  • the inventor found that due to the complexity of project files, traditional project management loads all project files together without dividing project files, which makes the management of project files difficult and inefficient.
  • the first aspect of the present application provides a method for managing project files, the method comprising:
  • Resource allocation is performed on the XML resource data to obtain multiple split resource data
  • the reading request of the client is monitored, the reading request is analyzed to determine the reader's identification code, authority level and target file information to be read;
  • the target file is read in response to the read request.
  • a second aspect of the present application provides an electronic device, the electronic device includes a memory and a processor, the memory is used to store at least one computer-readable instruction, and the processor is used to execute the at least one computer-readable instruction to Implement the following steps:
  • Resource allocation is performed on the XML resource data to obtain multiple split resource data
  • the reading request of the client is monitored, the reading request is analyzed to determine the reader's identification code, authority level and target file information to be read;
  • a third aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
  • Resource allocation is performed on the XML resource data to obtain multiple split resource data
  • the reading request of the client is monitored, the reading request is analyzed to determine the reader's identification code, authority level and target file information to be read;
  • the target file is read in response to the read request.
  • a fourth aspect of the present application provides a device for managing project files, the device comprising:
  • An acquisition module configured to acquire the project file of the project to be configured, and convert the project file into XML resource data
  • a resource allocation module configured to perform resource allocation on the XML resource data to obtain multiple split resource data
  • a generating module configured to identify the permission data of the reader in each split resource data, and generate a resource list
  • the parsing module is used to analyze the read request when listening to the read request from the client, and determine the reader's identification code, authority level and target file information to be read;
  • An identification module configured to identify whether the reader's identification code exists in the resource lists of the plurality of split resources
  • a judging module configured to judge whether the reader has permission to read the target file corresponding to the target file information when the reader's identification code exists in the resource list of the plurality of split resources;
  • a reading module configured to read the target file in response to the read request when the reader has the authority to read the target file corresponding to the target file information.
  • the project file management method, device, electronic equipment, and storage medium described in this application on the one hand, through the resource allocation of XML resource data according to the authority level, the XML resource data read by personnel with different authority
  • the scope is different, which improves the management efficiency of project files
  • identify the authority data of the reader in each split resource data generate a resource list, set different resource list formats for different authority levels, and follow the resource list
  • the format converts the file information of each reader, which improves the management efficiency of project files, and the generation efficiency and accuracy of each reader's resource list; finally, identify the resources of the multiple split resources Whether the reader exists in the list, and when the reader exists in the resource list of the plurality of split resources, determine whether the reader has permission to read the target file corresponding to the target file information , by first judging whether the reader has permission to read the project file, and then judging whether the reader has permission to read the target file corresponding to the read request, and determining whether to respond according to multiple judgment results
  • the read request prevents everyone from
  • FIG. 1 is a flow chart of a project file management method provided in Embodiment 1 of the present application.
  • FIG. 2 is a structural diagram of a project file management device provided in Embodiment 2 of the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device provided in Embodiment 3 of the present application.
  • FIG. 1 is a flow chart of a project file management method provided in Embodiment 1 of the present application.
  • the project file management method can be applied to electronic devices.
  • the project file management methods provided by the method of this application can be directly integrated on the electronic devices. functions, or run in electronic devices in the form of a software development kit (Software Development Kit, SDK).
  • AI artificial intelligence
  • digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, and mechatronics.
  • Artificial intelligence software technology mainly includes several major directions such as computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, machine learning, and deep learning.
  • the project file management method specifically includes the following steps. According to different requirements, the order of the steps in the flow chart can be changed, and some of them can be omitted.
  • the server obtains the project file of the project to be configured, and processes the project file. Specifically, the Project files are converted to XML resource data.
  • the converting the project file into XML resource data includes:
  • each JSON file in the dictionary is adjusted according to a preset adjustment method, and each adjusted JSON file is converted into XML resource data.
  • the index of the source code warehouse is any one of the warehouse branch name, warehouse commit number and warehouse tag number
  • the project file is opened according to the path of the project file, Since the project file contains a JSON file with source code warehouse information, the link, index and storage path of each source code warehouse information are extracted from the JSON file and written into the corresponding dictionary according to the key-value pair, and the format Convert, convert the JSON file into XML resource data.
  • the adjustment mode of the data structure can be preset.
  • the preset adjustment mode can be to call the string.find function in python to adjust the data structure of each JSON file from a vertical data structure to a horizontal data structure.
  • replace the JSON file with XML resource data because XML has only text and has no preset data format, so by replacing the JSON file with XML resource data, the data volume of data can be reduced, and the management efficiency of project files has been improved .
  • resource allocation needs to be performed on the XML resource data corresponding to the project files to obtain multiple split resource data.
  • performing resource allocation on the XML resource data to obtain a plurality of split resource data includes:
  • the web project container creates a permission assignment class instance in the Servlet context according to the permission level in the permission data of the reader, and allocates resources to the key-value pair according to the created permission distribution class instance, and obtains multiple Split resource data.
  • the configuration file of the XML resource data when starting the web project container, read the configuration file of the XML resource data, obtain the configuration parameters according to the configuration file, and use the web project container to read the reader and the reader in the configuration parameters.
  • XML resource data corresponding to each reader, wherein the configuration parameters may include one or more readers.
  • the multiple split resource data may be stored in memory.
  • the Servlet context contains all XML resource data corresponding to the project to be configured, and converts the XML resource data into key-value pairs, wherein the web project container uses the reader
  • the permission data of each reader is used as the key
  • the XML resource data corresponding to each reader is used as the key value
  • an instance of the permission allocation class is created according to the permission level of the reader, and resource allocation is performed, for example, resources are allocated by permission level Assignment, the group with the highest authority can have the read authority of all XML resource data.
  • XML resource data leads to the leakage of core resources in project files, which improves the security of project files.
  • the XML resource data can be cleared, and external resources cannot be injected into the XML resource data. Entities, control the problem that the server reads files according to the specified configuration, resulting in file leakage, and further improves the security of project files.
  • resource allocation may be performed on the XML resource data in a module manner to obtain multiple split resource data.
  • the modules may include, but are not limited to: user authority module, core modules and business modules, the core module refers to the core code resources within the enterprise, through the resource allocation of the XML resource data, different resource allocation methods are adopted for different customer needs, which improves the management efficiency of project files.
  • each split resource data contains at least one reader, and a resource list is generated according to the authority data of the reader.
  • the identifying the permission data of the reader in each split resource data, and generating the resource list includes:
  • each file corresponds to one or more readers, and each reader can read one or more files, and each split resource data is processed according to the authority data of each reader. categorized.
  • the generation method can be set in advance, specifically, the preset generation method can be set according to the reading requirements of customers, or can be set according to business requirements.
  • parsing the file set of each reader, and generating the resource list of each reader according to a preset generation method includes:
  • Identify the authority level of each reader extract the file information from the corresponding file set according to the extraction method of the authority level, and determine the resource list format corresponding to the authority level from the preset format library;
  • a resource list for each reader is generated according to a preset generation method.
  • the authority level of each reader is different, and the project files to be read are also different, so the corresponding extraction methods are also different.
  • the files are extracted according to the corresponding extraction method
  • the file information may include other file attributes such as file name, file suffix, and file size.
  • the file sets read by readers with different authority levels are different. Readers with higher authority levels can read more files in the file set, and readers with lower authority levels can read more files. There are few files in the file set that can be read by the reader, so different resource list formats are set for different permission levels, and the file information of each reader is converted according to the format of the resource list.
  • the resource list file of the reader improves the management efficiency of the project file.
  • the resource list is generated in a targeted manner, which improves the generation efficiency and accuracy of each reader's resource list.
  • said merging the resource lists of multiple readers to obtain the resource list of each split resource includes:
  • Identify the permission level of each reader sort the permission levels in ascending order, merge the resource lists of multiple readers according to the ascending sorting result, and obtain the resource list of each split resource.
  • the resource lists of multiple readers are merged according to the level of authority.
  • the read request is analyzed to determine the reader's identification code, authority level, and target file information to be read.
  • the server is used to receive the read request, and Perform analysis to obtain the permission data of the reader and the target file information to be read.
  • the analyzing the read request to determine the reader's identification code, authority level and target file information to be read includes:
  • the identification code is used to uniquely identify the identity of the reader, and then determine the identification code and authority level of the reader according to the identity of the reader; the call interface can be used to Determine the target file information that the reader needs to read.
  • the reader may have multiple authority levels, and the target file information read for different authority levels is different.
  • the file information called by different call interfaces is different, and the target file information that the reader needs to read is called according to the authority level of the reader and the call interface in the read request, and targeted Call to ensure the accuracy of the obtained object file information.
  • the resource list of each split resource contains the identification code of the reader, and the reader is identified according to the identification code of the reader in the resource lists of the multiple split resources. .
  • the identification code for identifying whether the reader exists in the resource list of the plurality of split resources includes:
  • the preset regular expressions corresponding to different permission levels are different.
  • a regular query is performed in the resource lists of the multiple split resources, and it is determined whether the read access exists according to the query results. A person's identification number.
  • the method also includes:
  • the judging whether the reader has permission to read the target file corresponding to the target file information includes:
  • the second file information is found in the first file information, it is determined that the reader has permission to read the target file corresponding to the target file information;
  • the second file information is not found in the first file information, it is determined that the reader has no permission to read the target file corresponding to the target file information.
  • the reader may have multiple read permissions at the same time.
  • the first file information includes second file information, and the first file information is used to represent all project files that can be read within the authority of the reader, and the second file information It is used to represent the project file that the reader needs to read in the current read request, that is, the target file.
  • the second file information by querying the second file information in the first file information, if the second file information exists in the first file information, it is determined that the reader has the right to read the target file; if the second file information does not exist in the first file information, determine that the reader has no permission to read the target file.
  • the target file is read in response to the read request.
  • reading the target file in response to the read request includes:
  • the web project container invokes a preset reading method of the Servlet, and reads the target file in the form of key-value pairs according to the preset reading method.
  • the preset reading method of the Servlet is invoked through the web project container.
  • the preset reading method may be a doGet or doPost method, and the target file is read by using the doGet or doPost method.
  • the method also includes:
  • the server when the reader has no permission to read the target file, the server sends a notification of refusing to respond to the read request to the reader for confirmation.
  • the project file management method described in this embodiment performs resource allocation on the XML resource data to obtain a plurality of split resource data, and performs resource allocation on the XML resource data according to the authority level,
  • the scope of the XML resource data read by people with different authority is different, which improves the management efficiency of the project file, and after the XML resource data is loaded into the Servlet context and converted into a key-value pair, the XML resource data is processed Clear, it is impossible to inject external entities into the XML resource data, avoiding the problem of file leakage caused by the control server reading files according to the specified configuration, and improving the security of project files; on the other hand, identifying each split resource
  • the permission data of the reader in the data generates a resource list, sets different resource list formats for different permission levels, and converts the file information of each reader according to the format of the resource list.
  • the same reader is unified.
  • the resource list file of the reader improves the management efficiency of the project file.
  • the generation of the resource list is targeted to improve the generation efficiency and accuracy of each reader's resource list; finally, identify all Whether the reader exists in the resource list of the plurality of split resources, and when the reader exists in the resource list of the plurality of split resources, determine whether the reader has permission to read the The target file corresponding to the target file information, by first judging whether the reader has permission to read the project file, and then judging whether the reader has permission to read the target file corresponding to the read request, according to As a result of multiple judgments, it is determined whether to respond to the read request, preventing everyone from reading the project file, which may lead to leakage of the core file, and improves the security of the project file.
  • FIG. 2 is a structural diagram of a project file management device provided in Embodiment 2 of the present application.
  • the project file management device 20 may include a plurality of functional modules composed of program code segments.
  • the program codes of the various program segments in the project file management device 20 can be stored in the memory of the electronic device, and executed by the at least one processor to execute (see FIG. 1 for details) management of project files. Function.
  • the project file management device 20 can be divided into multiple functional modules according to the functions it performs.
  • the functional modules may include: an acquisition module 201 , a resource allocation module 202 , a generation module 203 , an analysis module 204 , an identification module 205 , a judgment module 206 and a reading module 207 .
  • the module referred to in this application refers to a series of computer-readable instruction segments that can be executed by at least one processor and can complete fixed functions, and are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
  • the acquiring module 201 is configured to acquire the project file of the project to be configured, and convert the project file into XML resource data.
  • the server obtains the project file of the project to be configured, and processes the project file. Specifically, the Project files are converted to XML resource data.
  • converting the project file into XML resource data by the obtaining module 201 includes:
  • each JSON file in the dictionary is adjusted according to a preset adjustment method, and each adjusted JSON file is converted into XML resource data.
  • the index of the source code warehouse is any one of the warehouse branch name, warehouse commit number and warehouse tag number
  • the project file is opened according to the path of the project file, Since the project file contains a JSON file with source code warehouse information, the link, index and storage path of each source code warehouse information are extracted from the JSON file and written into the corresponding dictionary according to the key-value pair, and the format Convert, convert the JSON file into XML resource data.
  • the adjustment mode of the data structure can be preset.
  • the preset adjustment mode can be to call the string.find function in python to adjust the data structure of each JSON file from a vertical data structure to a horizontal data structure.
  • replace the JSON file with XML resource data because XML has only text and has no preset data format, so by replacing the JSON file with XML resource data, the data volume of data can be reduced, and the management efficiency of project files has been improved .
  • the resource allocation module 202 is configured to perform resource allocation on the XML resource data to obtain multiple split resource data.
  • resource allocation needs to be performed on the XML resource data corresponding to the project files to obtain multiple split resource data.
  • the resource allocation module 202 performs resource allocation on the XML resource data, and obtaining multiple split resource data includes:
  • the web project container creates a permission assignment class instance in the Servlet context according to the permission level in the permission data of the reader, and allocates resources to the key-value pair according to the created permission distribution class instance, and obtains multiple Split resource data.
  • the configuration file of the XML resource data when starting the web project container, read the configuration file of the XML resource data, obtain the configuration parameters according to the configuration file, and use the web project container to read the reader and the reader in the configuration parameters.
  • XML resource data corresponding to each reader, wherein the configuration parameters may include one or more readers.
  • the multiple split resource data may be stored in memory.
  • the Servlet context contains all XML resource data corresponding to the project to be configured, and converts the XML resource data into key-value pairs, wherein the web project container uses the reader
  • the permission data of each reader is used as the key
  • the XML resource data corresponding to each reader is used as the key value
  • an instance of the permission allocation class is created according to the permission level of the reader, and resource allocation is performed, for example, resources are allocated by permission level Assignment, the group with the highest authority can have the read authority of all XML resource data.
  • XML resource data leads to the leakage of core resources in project files, which improves the security of project files.
  • the XML resource data can be cleared, and external resources cannot be injected into the XML resource data. Entities, control the problem that the server reads files according to the specified configuration, resulting in file leakage, and further improves the security of project files.
  • resource allocation may be performed on the XML resource data in a module manner to obtain multiple split resource data.
  • the modules may include, but are not limited to: user authority module, core modules and business modules, the core module refers to the core code resources within the enterprise, through the resource allocation of the XML resource data, different resource allocation methods are adopted for different customer needs, which improves the management efficiency of project files.
  • the generation module 203 is configured to identify the authority data of the reader in each split resource data, and generate a resource list.
  • each split resource data contains at least one reader, and a resource list is generated according to the authority data of the reader.
  • the generation module 203 identifies the permission data of the reader in each split resource data, and generating the resource list includes:
  • each file corresponds to one or more readers, and each reader can read one or more files, and each split resource data is processed according to the authority data of each reader. categorized.
  • the generation method can be set in advance, specifically, the preset generation method can be set according to the reading requirements of customers, or can be set according to business requirements.
  • parsing the file set of each reader, and generating the resource list of each reader according to a preset generation method includes:
  • Identify the authority level of each reader extract the file information from the corresponding file set according to the extraction method of the authority level, and determine the resource list format corresponding to the authority level from the preset format library;
  • a resource list for each reader is generated according to a preset generation method.
  • the authority level of each reader is different, and the project files to be read are also different, so the corresponding extraction methods are also different.
  • the files are extracted according to the corresponding extraction method
  • the file information may include other file attributes such as file name, file suffix, and file size.
  • the file sets read by readers with different authority levels are different.
  • the file sets that can be read by readers with higher authority levels contain more files, and the file sets that can be read by readers with lower authority levels are more.
  • the resource list files of the same reader are unified, The management efficiency of project documents is improved.
  • the resource list is generated in a targeted manner, which improves the generation efficiency and accuracy of each reader's resource list.
  • said merging the resource lists of multiple readers to obtain the resource list of each split resource includes:
  • Identify the permission level of each reader sort the permission levels in ascending order, merge the resource lists of multiple readers according to the ascending sorting result, and obtain the resource list of each split resource.
  • the resource lists of multiple readers are merged according to the level of authority.
  • the parsing module 204 is configured to parse the read request when listening to the read request from the client, and determine the reader's identification code, authority level and target file information to be read.
  • the server is used to receive the read request, and Perform analysis to obtain the permission data of the reader and the target file information to be read.
  • the parsing module 204 parses the read request, and determines the reader's identification code, authority level, and target file information to be read, including:
  • the identification code is used to uniquely identify the identity of the reader, and then determine the identification code and authority level of the reader according to the identity of the reader; the call interface can be used to Determine the target file information that the reader needs to read.
  • the reader may have multiple authority levels, and the target file information read for different authority levels is different.
  • the file information called by different call interfaces is different, and the target file information that the reader needs to read is called according to the authority level of the reader and the call interface in the read request, and targeted Call to ensure the accuracy of the obtained object file information.
  • the identifying module 205 is configured to identify whether the reader's identification code exists in the resource lists of the plurality of split resources.
  • the resource list of each split resource contains the identification code of the reader, and the reader is identified according to the identification code of the reader in the resource lists of the multiple split resources. .
  • the identification module 205 identifying whether the reader's identification code exists in the resource lists of the multiple split resources includes:
  • the preset regular expressions corresponding to different permission levels are different.
  • a regular query is performed in the resource lists of the multiple split resources, and it is determined whether the read access exists according to the query results. A person's identification number.
  • a judging module 206 configured to judge whether the reader has permission to read the target file corresponding to the target file information when the reader's identification code exists in the resource lists of the multiple split resources.
  • the judging module 206 judging whether the reader has permission to read the target file corresponding to the target file information includes:
  • the second file information is found in the first file information, it is determined that the reader has permission to read the target file corresponding to the target file information;
  • the second file information is not found in the first file information, it is determined that the reader has no permission to read the target file corresponding to the target file information.
  • the reader may have multiple read permissions at the same time.
  • the first file information includes second file information, and the first file information is used to represent all project files that can be read within the authority of the reader, and the second file information It is used to represent the project file that the reader needs to read in the current read request, that is, the target file.
  • the second file information by querying the second file information in the first file information, if the second file information exists in the first file information, it is determined that the reader has the right to read the target file; if the second file information does not exist in the first file information, determine that the reader has no permission to read the target file.
  • the reading module 207 is configured to read the target file in response to the read request when the reader has the right to read the target file corresponding to the target file information.
  • the target file is read in response to the read request.
  • the reading module 207 reading the target file in response to the read request includes:
  • the web project container invokes a preset reading method of the Servlet, and reads the target file in the form of key-value pairs according to the preset reading method.
  • the preset reading method of the Servlet is invoked through the web project container.
  • the preset reading method may be a doGet or doPost method, and the target file is read by using the doGet or doPost method.
  • a notification of refusal to respond to the read request is sent to the reader according to a preset sending method.
  • the server when the reader has no permission to read the target file, the server sends a notification of refusing to respond to the read request to the reader for confirmation.
  • the project file management device described in this embodiment performs resource allocation on the XML resource data to obtain a plurality of split resource data, and performs resource allocation on the XML resource data according to the authority level,
  • the scope of the XML resource data read by people with different authority is different, which improves the management efficiency of the project file, and after the XML resource data is loaded into the Servlet context and converted into a key-value pair, the XML resource data is processed Clear, it is impossible to inject external entities into the XML resource data, avoiding the problem of file leakage caused by the control server reading files according to the specified configuration, and improving the security of project files; on the other hand, identifying each split resource
  • the permission data of the reader in the data generates a resource list, sets different resource list formats for different permission levels, and converts the file information of each reader according to the format of the resource list.
  • the same reader is unified.
  • the resource list file of the reader improves the management efficiency of the project file.
  • the generation of the resource list is targeted to improve the generation efficiency and accuracy of each reader's resource list; finally, identify all Whether the reader exists in the resource list of the plurality of split resources, and when the reader exists in the resource list of the plurality of split resources, determine whether the reader has permission to read the The target file corresponding to the target file information, by first judging whether the reader has permission to read the project file, and then judging whether the reader has permission to read the target file corresponding to the read request, according to As a result of multiple judgments, it is determined whether to respond to the read request, preventing everyone from reading the project file, which may lead to leakage of the core file, and improves the security of the project file.
  • the electronic device 3 includes a memory 31 , at least one processor 32 , at least one communication bus 33 and a transceiver 34 .
  • the structure of the electronic device shown in Figure 3 does not constitute a limitation of the embodiment of the present application, it can be a bus structure or a star structure, and the electronic device 3 can also include a ratio diagram more or less other hardware or software, or a different arrangement of components.
  • the electronic device 3 is an electronic device that can automatically perform numerical calculation and/or information processing according to preset or stored instructions, and its hardware includes but not limited to microprocessors, application-specific integrated circuits , programmable gate arrays, digital processors and embedded devices, etc.
  • the electronic device 3 may also include a client device, which includes but is not limited to any electronic product that can interact with the client through a keyboard, mouse, remote control, touch pad, or voice-activated device, for example, Personal computers, tablets, smartphones, digital cameras, etc.
  • the electronic device 3 is only an example, and other existing or future electronic products that can be adapted to this application should also be included in the scope of protection of this application, and are included here by reference .
  • the memory 31 is used to store program codes and various data, such as the management device 20 of project files installed in the electronic device 3, and realize high-speed, automatic Complete program or data access.
  • Described memory 31 comprises read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM) , One-time Programmable Read-Only Memory (OTPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (EEPROM), Only Memory, CD-ROM) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
  • the at least one processor 32 may be composed of an integrated circuit, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions packaged, including a Or a combination of multiple central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and various control chips.
  • the at least one processor 32 is the control core (Control Unit) of the electronic device 3, and uses various interfaces and lines to connect the various components of the entire electronic device 3, by running or executing programs stored in the memory 31 or module, and call the data stored in the memory 31 to execute various functions of the electronic device 3 and process data.
  • Control Unit Control Unit
  • the at least one communication bus 33 is configured to realize connection and communication between the memory 31 and the at least one processor 32 and so on.
  • the electronic device 3 may also include a power supply (such as a battery) for supplying power to various components.
  • the power supply may be logically connected to the at least one processor 32 through a power management device, thereby Realize the functions of managing charging, discharging, and power consumption management.
  • the power supply may also include one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
  • the electronic device 3 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the above-mentioned integrated units implemented in the form of software function modules can be stored in a computer-readable storage medium.
  • the above-mentioned software function modules are stored in a storage medium, and include several instructions to make a computer device (which may be a personal computer, electronic device, or network device, etc.) or a processor (processor) execute the methods described in various embodiments of the present application part.
  • the at least one processor 32 can execute the operating means of the electronic device 3 and installed various applications (such as the project file management means 20), program codes etc., for example, the various modules mentioned above.
  • Program codes are stored in the memory 31 , and the at least one processor 32 can invoke the program codes stored in the memory 31 to execute related functions.
  • the various modules described in FIG. 2 are program codes stored in the memory 31 and executed by the at least one processor 32, so as to realize the functions of the various modules to achieve the purpose of project file management .
  • the memory 31 stores a plurality of computer-readable instructions, and the plurality of computer-readable instructions are executed by the at least one processor 32 to realize the function of project file management.
  • the computer program can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 31 and executed by the processor 32 to complete this Application.
  • the one or more modules/units may be a series of computer-readable instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 3 .
  • the computer program can be divided into an acquisition module 201 , a resource allocation module 202 , a generation module 203 , an analysis module 204 , an identification module 205 , a judgment module 206 and a reading module 207 .
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function, etc.; The data created using the node, etc.
  • the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, and may be located in one place or distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software function modules.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Storage Device Security (AREA)

Abstract

本申请涉及人工智能技术领域,提供一种项目文件的管理方法、装置、电子设备及存储介质,所述方法包括:获取待配置项目的项目文件,将项目文件转换为XML资源数据进行资源分配,得到多个拆分资源数据;识别每个拆分资源数据中的读取人的权限数据,生成资源清单;监听并解析读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;当读取人有权限读取目标文件信息对应的目标文件时,响应于读取请求读取目标文件。本申请通过识别每个拆分资源数据中的读取人的权限数据,生成资源清单,统一了相同读取人的资源清单文件,提高了项目文件的管理效率。

Description

项目文件的管理方法、装置、电子设备及存储介质
本申请要求于2021年6月22日提交中国专利局,申请号为202110693573.7申请名称为“项目文件的管理方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,具体涉及一种项目文件的管理方法、装置、电子设备及存储介质。
背景技术
目前最流行的木马实体外部注入手段为XML External Entity,简称XXE漏洞,现有技术通过服务器在项目文件中注入指定的xml实体内容,从而让服务器按照指定的xml实体内容进行执行,导致项目文件被错误的执行,安全性低,然而,发明人发现由于项目文件复杂,传统项目管理都是将所有项目文件加载在一起,未对项目文件进行划分,导致项目文件的管理难度大,管理效率低下。
发明内容
鉴于以上内容,有必要提出一种项目文件的管理方法、装置、电子设备及存储介质,通过识别每个拆分资源数据中的读取人的权限数据,生成资源清单,统一了相同读取人的资源清单文件,提高了项目文件的管理效率。
本申请的第一方面提供一种项目文件的管理方法,所述方法包括:
获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
对所述XML资源数据进行资源分配,得到多个拆分资源数据;
识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
本申请的第二方面提供一种电子设备,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:
获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
对所述XML资源数据进行资源分配,得到多个拆分资源数据;
识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请 求读取所述目标文件。
本申请的第三方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
对所述XML资源数据进行资源分配,得到多个拆分资源数据;
识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
本申请的第四方面提供一种项目文件的管理装置,所述装置包括:
获取模块,用于获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
资源分配模块,用于对所述XML资源数据进行资源分配,得到多个拆分资源数据;
生成模块,用于识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
解析模块,用于当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
识别模块,用于识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
判断模块,用于当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
读取模块,用于当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
综上所述,本申请所述的项目文件的管理方法、装置、电子设备及存储介质,一方面,通过根据权限等级对XML资源数据进行资源分配,不同权限的人员读取的XML资源数据的范围不同,提高了项目文件的管理效率;另一方面,识别每个拆分资源数据中的读取人的权限数据,生成资源清单,针对不同的权限等级设置不同的资源清单格式,按照资源清单格式对每个读取人的文件信息进行格式转换,提高了项目文件的管理效率,及每个读取人的资源清单的生成效率和准确率;最后,识别所述多个拆分资源的资源清单中是否存在所述读取人,当所述多个拆分资源的资源清单中存在所述读取人时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件,通过先判断所述读取人是否有权限读取所述项目文件,再判断所述读取人是否有权限读取所述读取请求对应的目标文件,根据多次判断结果,确定是否响应所述读取请求,避免所有人都去读取所述项目文件,可能导致出现核心文件泄露的情况,提高了项目文件的安全性。
附图说明
图1是本申请实施例一提供的项目文件的管理方法的流程图。
图2是本申请实施例二提供的项目文件的管理装置的结构图。
图3是本申请实施例三提供的电子设备的结构示意图。
具体实施方式
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施 例中的特征可以相互组合。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
实施例一
图1是本申请实施例一提供的项目文件的管理方法的流程图。
在本实施例中,所述项目文件的管理方法可以应用于电子设备中,对于需要进行项目文件的管理的电子设备,可以直接在电子设备上集成本申请的方法所提供的项目文件的管理的功能,或者以软件开发工具包(Software Development Kit,SDK)的形式运行在电子设备中。
本申请实施例可以基于人工智能技术对相关的数据进行获取和处理。其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。
人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、机器人技术、生物识别技术、语音处理技术、自然语言处理技术以及机器学习、深度学习等几大方向。
如图1所示,所述项目文件的管理方法具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些可以省略。
S11,获取待配置项目的项目文件,将所述项目文件转换为XML资源数据。
本实施例中,在完成一个项目时,为了确保项目文件的安全性,需要对项目文件进行管理,服务端获取待配置项目的项目文件,对所述项目文件进行处理,具体地,将所述项目文件转换为XML资源数据。
在一个可选的实施例中,所述将所述项目文件转换为XML资源数据包括:
根据所述项目文件的路径打开所述项目文件,解析所述项目文件生成包含有源代码仓库信息的JSON文件;
解析所述JSON文件,并从所述JSON文件提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中;
读取所述字典,并打印读取的所述字典;
按照预设的调整方式调整所述字典中每个JSON文件的数据结构,将调整后的每个JSON文件转换为XML资源数据。
本实施例中,所述源代码仓库的索引为仓库分支名、仓库commit号和仓库tag号中的任意一个,在得到项目文件的路径时,根据所述项目文件的路径打开所述项目文件,由于所述项目文件中包含有源代码仓库信息的JSON文件,从所述JSON文件中提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中,进行格式转换,将所述JSON文件转换为XML资源数据。
本实施例中,可以预先设置数据结构的调整方式,例如,预设的调整方式可以为调用python中的string.find功能,将每个JSON文件的数据结构由纵向数据结构调整为横向数据结构,并将所述JSON文件替换为XML资源数据,由于XML只有文字没有预设的数据格式,故通过将所述JSON文件替换为XML资源数据,可以减少数据的数据量,提高了项目文件的管理效率。
S12,对所述XML资源数据进行资源分配,得到多个拆分资源数据。
本实施例中,在进行项目文件管理时,需要将所述项目文件对应的XML资源数据进行资源分配,得到多个拆分资源数据。
在一个可选的实施例中,所述对所述XML资源数据进行资源分配,得到多个拆分资源数据包括:
采用预设的web项目容器读取所述XML资源数据的配置参数中的读取人的权限数据及每个读取人对应的XML资源数据;
创建一个Servlet上下文,并将所述读取人的权限数据及每个读取人对应的XML资源数据转换为键值对,加载到Servlet上下文中,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值;
所述web项目容器根据所述读取人的权限数据中的权限等级在所述Servlet上下文创建权限分配类实例,并根据创建的权限分配类实例对所述键值对进行资源分配,得到多个拆分资源数据。
本实施例中,在启动web项目容器时,读取所述XML资源数据的配置文件,根据所述配置文件得到配置参数,采用所述web项目容器读取所述配置参数中的读取人及每个读取人对应的XML资源数据,其中,所述配置参数中可以包括一个或者多个读取人。
本实施例中,可以将所述多个拆分资源数据存储至内存中。
本实施例中,所述Servlet上下文中包含有所述待配置项目对应的所有XML资源数据,并将所述XML资源数据转换为键值对,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值,根据读取人的权限等级创建权限分配类实例,并进行资源分配,例如,通过权限等级的方式进行资源分配,最高权限的组可以拥有全部XML资源数据的读取权限。
本实施例中,通过根据权限等级对XML资源数据进行资源分配,不同权限的人员读取的XML资源数据的范围不同,提高了项目文件的管理效率,同时避免了所有人都可以读取所述XML资源数据导致项目文件中的核心资源泄露的问题,提高了项目文件的安全性。
在其他一些可选的实施例中,在将所述XML资源数据加载到Servlet上下文,并转换为键值对后,可以将所述XML资源数据进行清除,无法在所述XML资源数据中注入外部实体,控制服务器按照指定的配置进行文件读取导致文件泄露的问题,进一步提高了项目文件的安全性。
在其他一些可选的实施例中,可以按照模块方式对所述XML资源数据进行资源分配,得到多个拆分资源数据,具体地,所述模块可以包括,但不限于:用户权限模块、核心模块及业务模块,所述核心模块是指企业内部核心代码资源,通过对所述XML资源数据进行资源分配,针对不同的客户需求采用的不同的资源分配方式,提高了项目文件的管理效率。
S13,识别每个拆分资源数据中的读取人的权限数据,生成资源清单。
本实施例中,每个拆分资源数据中包含有至少一个读取人,根据所述读取人的权限数据生成资源清单。
在一个可选的实施例中,所述识别每个拆分资源数据中的读取人的权限数据,生成资源清单包括:
解析每个拆分资源数据,获取每个读取人的权限数据,其中,所述权限数据中包含有读取人的识别码、可读取文件的文件名称、后缀和class路径;
根据每个读取人的可读取文件的文件名称、后缀和class路径对所述每个拆分资源数据中的文件进行归类,得到每个读取人的文件集;
解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单;
合并多个读取人的资源清单得到每个拆分资源的资源清单。
本实施例中,每个文件对应有一个或者多个读取人,并且每个读取人可以读取一个或者多个文件,根据每个读取人的权限数据对每个拆分资源数据进行归类。
本实施例中,可以预先设置生成方式,具体地,所述预设的生成方式可以根据客户的读取需求进行设定,也可以根据业务需求进行设定。
进一步地,所述解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单包括:
识别每个读取人的权限等级,按照所述权限等级的提取方式从对应的文件集中提取出文件信息,及从预设格式库中确定出与所述权限等级对应的资源清单格式;
按照所述资源清单格式对所述文件信息进行转换,得到目标信息;
根据所述目标信息,按照预设的生成方式生成每个读取人的资源清单。
本实施例中,每个读取人的权限等级不同,读取的项目文件也不同,故对应的提取方式也不同,根据识别到的每个读取人的权限等级按照对应的提取方式提取文件信息,具体地,所述文件信息可以包括文件名称、文件后缀、文件大小等其他文件属性。
本实施例中,不同权限等级的读取人读取的文件集不同,读取人,权限等级高的读取人员可读取的文件集中包含的文件较多,读取人权限等级低的读取人员可读取的文件集中包含的文件较少,故针对不同的权限等级设置不同的资源清单格式,按照资源清单格式对每个读取人的文件信息进行格式转换,一方面,统一了相同读取人的资源清单文件,提高了项目文件的管理效率,另一方面,具有针对性的进行资源清单的生成,提高了每个读取人的资源清单的生成效率和准确率。
进一步地,所述合并多个读取人的资源清单得到每个拆分资源的资源清单包括:
识别每个读取人的权限等级,对所述权限等级进行升序排序,根据升序排序结果合并多个读取人的资源清单,得到每个拆分资源的资源清单。
本实施例中,为了更好的对项目文件管理,按照权限等级的高低合并多个读取人的资源清单。
S14,当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息。
本实施例中,根据读取人的权限等级对XML资源数据进行分配后,当监听到客户端发送的读取请求时,服务端用于接收所述读取请求,并对所述读取请求进行解析,得到读取人的权限数据及需要读取的目标文件信息。
在一个可选的实施例中,所述解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息包括:
解析所述读取请求获取读取人的识别码和调用接口;
根据所述读取人的识别码从预设的权限等级数据库中确定出所述读取人的权限等级;
根据所述读取请求及所述调用接口调用所述读取人需要读取的目标文件信息。
本实施例中,所述识别码用于唯一识别所述读取人的身份,根据所述读取人的身份进而确定所述读取人的识别码和权限等级;所述调用接口可以用于确定所述读取人需要读取的目标文件信息。
本实施例中,读取人可以拥有多个权限等级,针对不同的权限等级读取的目标文件信息不同。
本实施例中,不同的调用接口调用的文件信息不同,根据读取人的权限等级及所述读取请求中的调用接口调用所述读取人需要读取的目标文件信息,进行针对性的调用,确保得到的目标文件信息的准确率。
S15,识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码。
本实施例中,每个拆分资源的资源清单中包含有读取人的识别码,在所述多个拆分资源的资源清单中根据所述读取人的识别码识别所述读取人。
在一个可选的实施例中,所述识别所述多个拆分资源的资源清单中是否存在所述读 取人的识别码包括:
从预设的正则表达式库中确定出与所述读取人的权限等级对应的预设的正则表达式;
根据所述预设的正则表达式在所述多个拆分资源的资源清单中进行正则查询;
当在所述多个拆分资源的资源清单中查询到所述读取人的识别码时,确定所述多个拆分资源的资源清单中存在所述读取人的识别码;或者
当在所述多个拆分资源的资源清单中未查询到所述读取人的识别码时,确定所述多个拆分资源的资源清单中不存在所述读取人的识别码。
本实施例中,不同权限等级对应的预设的正则表达式不同,根据对应的正则表达式在所述多个拆分资源的资源清单中进行正则查询,根据查询结果确定是否存在所述读取人的识别码。
进一步地,所述方法还包括:
当所述多个拆分资源的资源清单中不存在所述读取人的识别码时,拒绝响应所述客户端的读取请求。
本实施例中,通过采用正则查询在所述多个拆分资源的资源清单中确定是否存在所述读取人,当在资源清单中查询到所述读取人的识别码时,确定所述读取人有权限读取所述项目文件;当在资源清单中未查询到所述读取人的识别码时,确定所述读取人无权限读取所述项目文件,确保了项目文件的安全性。
S16,当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件。
本实施例中,当确定所述读取人有权限读取所述项目文件中,需要进一步确定所述读取人是否有权限读取请求的目标文件。
在一个可选的实施例中,所述判断所述读取人是否有权限读取所述目标文件信息对应的目标文件包括:
从所述读取人的权限数据对应的资源清单中获取所述读取人对应的文件集,并解析所述文件集得到所述读取人的第一文件信息;
识别所述读取人的目标权限等级,按照所述目标权限等级对应的资源清单格式对所述目标文件信息进行转换得到第二文件信息;
查询所述第一文件信息中是否存在所述第二文件信息;
当在所述第一文件信息中查询到所述第二文件信息时,确定所述读取人有权限读取所述目标文件信息对应的目标文件;或者
当在所述第一文件信息中未查询到所述第二文件信息时,确定所述读取人无权限读取所述目标文件信息对应的目标文件。
本实施例中,读取人可能同时存在多个读取权限,在确定读取人可以读取所述目标文件信息时,识别读取人可以读取所述目标文件信息的目标权限等级,即读取所述目标文件信息的哪些文件。
本实施例中,所述第一文件信息中包含有第二文件信息,所述第一文件信息用以表征所述读取人权限范围内可以读取的所有项目文件,所述第二文件信息用以表征所述读取人当前读取请求需要读取的项目文件,即目标文件。
本实施例中,通过在所述第一文件信息中查询第二文件信息,若所述第二文件信息存在于所述第一文件信息中,确定所述读取人有权限读取所述目标文件;若所述第二文件信息不存在与所述第一文件信息中,确定所述读取人无权限读取所述目标文件。
本实施例中,通过先判断所述读取人是否有权限读取所述项目文件,再判断所述读取人是否有权限读取所述读取请求对应的目标文件,根据多次判断结果,确定是否响应所述读取请求,避免所有人都去读取所述项目文件,可能导致出现核心文件泄露的情况, 提高了项目文件的安全性。
S17,当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
本实施例中,在确定所述读取人有权限读取所述目标文件时,响应于所述读取请求读取所述目标文件。
在一个可选的实施例中,所述响应于所述读取请求读取所述目标文件包括:
所述web项目容器调用Servlet的预设读取方法,并按照所述预设的读取方法以键值对的方式读取所述目标文件。
本实施例中,通过web项目容器调用Servlet的预设读取方法,具体地,所述预设读取方法可以为doGet或者doPost方法,采用doGet或者doPost方法读取所述目标文件。
S18,当所述读取人无权限读取所述目标文件信息对应的目标文件时,拒绝响应所述客户端的读取请求。
进一步地,所述方法还包括:
按照预设的发送方式发送拒绝响应所述读取请求的通知至所述读取人。
本实施例中,当所述读取人无权限读取所述目标文件时,服务端发送拒绝响应所述读取请求的通知至所述读取人进行确认。
综上所述,本实施例所述的项目文件的管理方法,一方面,对所述XML资源数据进行资源分配,得到多个拆分资源数据,通过根据权限等级对XML资源数据进行资源分配,不同权限的人员读取的XML资源数据的范围不同,提高了项目文件的管理效率,并在将所述XML资源数据加载到Servlet上下文,并转换为键值对后,将所述XML资源数据进行清除,无法在所述XML资源数据中注入外部实体,避免了控制服务器按照指定的配置进行文件读取导致文件泄露的问题,提高了项目文件的安全性;另一方面,识别每个拆分资源数据中的读取人的权限数据,生成资源清单,针对不同的权限等级设置不同的资源清单格式,按照资源清单格式对每个读取人的文件信息进行格式转换,一方面,统一了相同读取人的资源清单文件,提高了项目文件的管理效率,另一方面,具有针对性的进行资源清单的生成,提高了每个读取人的资源清单的生成效率和准确率;最后,识别所述多个拆分资源的资源清单中是否存在所述读取人,当所述多个拆分资源的资源清单中存在所述读取人时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件,通过先判断所述读取人是否有权限读取所述项目文件,再判断所述读取人是否有权限读取所述读取请求对应的目标文件,根据多次判断结果,确定是否响应所述读取请求,避免所有人都去读取所述项目文件,可能导致出现核心文件泄露的情况,提高了项目文件的安全性。
实施例二
图2是本申请实施例二提供的项目文件的管理装置的结构图。
在一些实施例中,所述项目文件的管理装置20可以包括多个由程序代码段所组成的功能模块。所述项目文件的管理装置20中的各个程序段的程序代码可以存储于电子设备的存储器中,并由所述至少一个处理器所执行,以执行(详见图1描述)项目文件的管理的功能。
本实施例中,所述项目文件的管理装置20根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:获取模块201、资源分配模块202、生成模块203、解析模块204、识别模块205、判断模块206及读取模块207。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。在本实施例中,关于各模块的功能将在后续的实施例中详述。
获取模块201,用于获取待配置项目的项目文件,将所述项目文件转换为XML资 源数据。
本实施例中,在完成一个项目时,为了确保项目文件的安全性,需要对项目文件进行管理,服务端获取待配置项目的项目文件,对所述项目文件进行处理,具体地,将所述项目文件转换为XML资源数据。
在一个可选的实施例中,所述获取模块201将所述项目文件转换为XML资源数据包括:
根据所述项目文件的路径打开所述项目文件,解析所述项目文件生成包含有源代码仓库信息的JSON文件;
解析所述JSON文件,并从所述JSON文件提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中;
读取所述字典,并打印读取的所述字典;
按照预设的调整方式调整所述字典中每个JSON文件的数据结构,将调整后的每个JSON文件转换为XML资源数据。
本实施例中,所述源代码仓库的索引为仓库分支名、仓库commit号和仓库tag号中的任意一个,在得到项目文件的路径时,根据所述项目文件的路径打开所述项目文件,由于所述项目文件中包含有源代码仓库信息的JSON文件,从所述JSON文件中提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中,进行格式转换,将所述JSON文件转换为XML资源数据。
本实施例中,可以预先设置数据结构的调整方式,例如,预设的调整方式可以为调用python中的string.find功能,将每个JSON文件的数据结构由纵向数据结构调整为横向数据结构,并将所述JSON文件替换为XML资源数据,由于XML只有文字没有预设的数据格式,故通过将所述JSON文件替换为XML资源数据,可以减少数据的数据量,提高了项目文件的管理效率。
资源分配模块202,用于对所述XML资源数据进行资源分配,得到多个拆分资源数据。
本实施例中,在进行项目文件管理时,需要将所述项目文件对应的XML资源数据进行资源分配,得到多个拆分资源数据。
在一个可选的实施例中,所述资源分配模块202对所述XML资源数据进行资源分配,得到多个拆分资源数据包括:
采用预设的web项目容器读取所述XML资源数据的配置参数中的读取人的权限数据及每个读取人对应的XML资源数据;
创建一个Servlet上下文,并将所述读取人的权限数据及每个读取人对应的XML资源数据转换为键值对,加载到Servlet上下文中,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值;
所述web项目容器根据所述读取人的权限数据中的权限等级在所述Servlet上下文创建权限分配类实例,并根据创建的权限分配类实例对所述键值对进行资源分配,得到多个拆分资源数据。
本实施例中,在启动web项目容器时,读取所述XML资源数据的配置文件,根据所述配置文件得到配置参数,采用所述web项目容器读取所述配置参数中的读取人及每个读取人对应的XML资源数据,其中,所述配置参数中可以包括一个或者多个读取人。
本实施例中,可以将所述多个拆分资源数据存储至内存中。
本实施例中,所述Servlet上下文中包含有所述待配置项目对应的所有XML资源数据,并将所述XML资源数据转换为键值对,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值,根据读取人的权限等级创建权限分配类实例,并进行资源分配,例如,通过权限等级的方式进行资源分配, 最高权限的组可以拥有全部XML资源数据的读取权限。
本实施例中,通过根据权限等级对XML资源数据进行资源分配,不同权限的人员读取的XML资源数据的范围不同,提高了项目文件的管理效率,同时避免了所有人都可以读取所述XML资源数据导致项目文件中的核心资源泄露的问题,提高了项目文件的安全性。
在其他一些可选的实施例中,在将所述XML资源数据加载到Servlet上下文,并转换为键值对后,可以将所述XML资源数据进行清除,无法在所述XML资源数据中注入外部实体,控制服务器按照指定的配置进行文件读取导致文件泄露的问题,进一步提高了项目文件的安全性。
在其他一些可选的实施例中,可以按照模块方式对所述XML资源数据进行资源分配,得到多个拆分资源数据,具体地,所述模块可以包括,但不限于:用户权限模块、核心模块及业务模块,所述核心模块是指企业内部核心代码资源,通过对所述XML资源数据进行资源分配,针对不同的客户需求采用的不同的资源分配方式,提高了项目文件的管理效率。
生成模块203,用于识别每个拆分资源数据中的读取人的权限数据,生成资源清单。
本实施例中,每个拆分资源数据中包含有至少一个读取人,根据所述读取人的权限数据生成资源清单。
在一个可选的实施例中,所述生成模块203识别每个拆分资源数据中的读取人的权限数据,生成资源清单包括:
解析每个拆分资源数据,获取每个读取人的权限数据,其中,所述权限数据中包含有读取人的识别码、可读取文件的文件名称、后缀和class路径;
根据每个读取人的可读取文件的文件名称、后缀和class路径对所述每个拆分资源数据中的文件进行归类,得到每个读取人的文件集;
解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单;
合并多个读取人的资源清单得到每个拆分资源的资源清单。
本实施例中,每个文件对应有一个或者多个读取人,并且每个读取人可以读取一个或者多个文件,根据每个读取人的权限数据对每个拆分资源数据进行归类。
本实施例中,可以预先设置生成方式,具体地,所述预设的生成方式可以根据客户的读取需求进行设定,也可以根据业务需求进行设定。
进一步地,所述解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单包括:
识别每个读取人的权限等级,按照所述权限等级的提取方式从对应的文件集中提取出文件信息,及从预设格式库中确定出与所述权限等级对应的资源清单格式;
按照所述资源清单格式对所述文件信息进行转换,得到目标信息;
根据所述目标信息,按照预设的生成方式生成每个读取人的资源清单。
本实施例中,每个读取人的权限等级不同,读取的项目文件也不同,故对应的提取方式也不同,根据识别到的每个读取人的权限等级按照对应的提取方式提取文件信息,具体地,所述文件信息可以包括文件名称、文件后缀、文件大小等其他文件属性。
本实施例中,不同权限等级读取人读取的文件集不同,权限等级高的读取人员可读取的文件集中包含的文件较多,权限等级低的读取人员可读取的文件集中包含的文件较少,故针对不同的权限等级设置不同的资源清单格式,按照资源清单格式对每个读取人的文件信息进行格式转换,一方面,统一了相同读取人的资源清单文件,提高了项目文件的管理效率,另一方面,具有针对性的进行资源清单的生成,提高了每个读取人的资源清单的生成效率和准确率。
进一步地,所述合并多个读取人的资源清单得到每个拆分资源的资源清单包括:
识别每个读取人的权限等级,对所述权限等级进行升序排序,根据升序排序结果合并多个读取人的资源清单,得到每个拆分资源的资源清单。
本实施例中,为了更好的对项目文件管理,按照权限等级的高低合并多个读取人的资源清单。
解析模块204,用于当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息。
本实施例中,根据读取人的权限等级对XML资源数据进行分配后,当监听到客户端发送的读取请求时,服务端用于接收所述读取请求,并对所述读取请求进行解析,得到读取人的权限数据及需要读取的目标文件信息。
在一个可选的实施例中,所述解析模块204解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息包括:
解析所述读取请求获取读取人的识别码和调用接口;
根据所述读取人的识别码从预设的权限等级数据库中确定出所述读取人的权限等级;
根据所述读取请求及所述调用接口调用所述读取人需要读取的目标文件信息。
本实施例中,所述识别码用于唯一识别所述读取人的身份,根据所述读取人的身份进而确定所述读取人的识别码和权限等级;所述调用接口可以用于确定所述读取人需要读取的目标文件信息。
本实施例中,读取人可以拥有多个权限等级,针对不同的权限等级读取的目标文件信息不同。
本实施例中,不同的调用接口调用的文件信息不同,根据读取人的权限等级及所述读取请求中的调用接口调用所述读取人需要读取的目标文件信息,进行针对性的调用,确保得到的目标文件信息的准确率。
识别模块205,用于识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码。
本实施例中,每个拆分资源的资源清单中包含有读取人的识别码,在所述多个拆分资源的资源清单中根据所述读取人的识别码识别所述读取人。
在一个可选的实施例中,所述识别模块205识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码包括:
从预设的正则表达式库中确定出与所述读取人的权限等级对应的预设的正则表达式;
根据所述预设的正则表达式在所述多个拆分资源的资源清单中进行正则查询;
当在所述多个拆分资源的资源清单中查询到所述读取人的识别码时,确定所述多个拆分资源的资源清单中存在所述读取人的识别码;或者
当在所述多个拆分资源的资源清单中未查询到所述读取人的识别码时,确定所述多个拆分资源的资源清单中不存在所述读取人的识别码。
本实施例中,不同权限等级对应的预设的正则表达式不同,根据对应的正则表达式在所述多个拆分资源的资源清单中进行正则查询,根据查询结果确定是否存在所述读取人的识别码。
进一步地,当所述多个拆分资源的资源清单中不存在所述读取人的识别码时,拒绝响应所述客户端的读取请求。
本实施例中,通过采用正则查询在所述多个拆分资源的资源清单中确定是否存在所述读取人,当在资源清单中查询到所述读取人的识别码时,确定所述读取人有权限读取所述项目文件;当在资源清单中未查询到所述读取人的识别码时,确定所述读取人无权限读取所述项目文件,确保了项目文件的安全性。
判断模块206,用于当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件。
本实施例中,当确定所述读取人有权限读取所述项目文件中,需要进一步确定所述读取人是否有权限读取请求的目标文件。
在一个可选的实施例中,所述判断模块206判断所述读取人是否有权限读取所述目标文件信息对应的目标文件包括:
从所述读取人的权限数据对应的资源清单中获取所述读取人对应的文件集,并解析所述文件集得到所述读取人的第一文件信息;
识别所述读取人的目标权限等级,按照所述目标权限等级对应的资源清单格式对所述目标文件信息进行转换得到第二文件信息;
查询所述第一文件信息中是否存在所述第二文件信息;
当在所述第一文件信息中查询到所述第二文件信息时,确定所述读取人有权限读取所述目标文件信息对应的目标文件;或者
当在所述第一文件信息中未查询到所述第二文件信息时,确定所述读取人无权限读取所述目标文件信息对应的目标文件。
本实施例中,读取人可能同时存在多个读取权限,在确定读取人可以读取所述目标文件信息时,识别读取人可以读取所述目标文件信息的目标权限等级,即读取所述目标文件信息的哪些文件。
本实施例中,所述第一文件信息中包含有第二文件信息,所述第一文件信息用以表征所述读取人权限范围内可以读取的所有项目文件,所述第二文件信息用以表征所述读取人当前读取请求需要读取的项目文件,即目标文件。
本实施例中,通过在所述第一文件信息中查询第二文件信息,若所述第二文件信息存在于所述第一文件信息中,确定所述读取人有权限读取所述目标文件;若所述第二文件信息不存在与所述第一文件信息中,确定所述读取人无权限读取所述目标文件。
本实施例中,通过先判断所述读取人是否有权限读取所述项目文件,再判断所述读取人是否有权限读取所述读取请求对应的目标文件,根据多次判断结果,确定是否响应所述读取请求,避免所有人都去读取所述项目文件,可能导致出现核心文件泄露的情况,提高了项目文件的安全性。
读取模块207,用于当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
本实施例中,在确定所述读取人有权限读取所述目标文件时,响应于所述读取请求读取所述目标文件。
在一个可选的实施例中,所述读取模块207响应于所述读取请求读取所述目标文件包括:
所述web项目容器调用Servlet的预设读取方法,并按照所述预设的读取方法以键值对的方式读取所述目标文件。
本实施例中,通过web项目容器调用Servlet的预设读取方法,具体地,所述预设读取方法可以为doGet或者doPost方法,采用doGet或者doPost方法读取所述目标文件。
进一步地,当所述读取人无权限读取所述目标文件信息对应的目标文件时,拒绝响应所述客户端的读取请求。
进一步地,按照预设的发送方式发送拒绝响应所述读取请求的通知至所述读取人。
本实施例中,当所述读取人无权限读取所述目标文件时,服务端发送拒绝响应所述读取请求的通知至所述读取人进行确认。
综上所述,本实施例所述的项目文件的管理装置,一方面,对所述XML资源数据 进行资源分配,得到多个拆分资源数据,通过根据权限等级对XML资源数据进行资源分配,不同权限的人员读取的XML资源数据的范围不同,提高了项目文件的管理效率,并在将所述XML资源数据加载到Servlet上下文,并转换为键值对后,将所述XML资源数据进行清除,无法在所述XML资源数据中注入外部实体,避免了控制服务器按照指定的配置进行文件读取导致文件泄露的问题,提高了项目文件的安全性;另一方面,识别每个拆分资源数据中的读取人的权限数据,生成资源清单,针对不同的权限等级设置不同的资源清单格式,按照资源清单格式对每个读取人的文件信息进行格式转换,一方面,统一了相同读取人的资源清单文件,提高了项目文件的管理效率,另一方面,具有针对性的进行资源清单的生成,提高了每个读取人的资源清单的生成效率和准确率;最后,识别所述多个拆分资源的资源清单中是否存在所述读取人,当所述多个拆分资源的资源清单中存在所述读取人时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件,通过先判断所述读取人是否有权限读取所述项目文件,再判断所述读取人是否有权限读取所述读取请求对应的目标文件,根据多次判断结果,确定是否响应所述读取请求,避免所有人都去读取所述项目文件,可能导致出现核心文件泄露的情况,提高了项目文件的安全性。
实施例三
参阅图3所示,为本申请实施例三提供的电子设备的结构示意图。在本申请较佳实施例中,所述电子设备3包括存储器31、至少一个处理器32、至少一条通信总线33及收发器34。
本领域技术人员应该了解,图3示出的电子设备的结构并不构成本申请实施例的限定,既可以是总线型结构,也可以是星形结构,所述电子设备3还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置。
在一些实施例中,所述电子设备3是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的电子设备,其硬件包括但不限于微处理器、专用集成电路、可编程门阵列、数字处理器及嵌入式设备等。所述电子设备3还可包括客户设备,所述客户设备包括但不限于任何一种可与客户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、数码相机等。
需要说明的是,所述电子设备3仅为举例,其他现有的或今后可能出现的电子产品如可适应于本申请,也应包含在本申请的保护范围以内,并以引用方式包含于此。
在一些实施例中,所述存储器31用于存储程序代码和各种数据,例如安装在所述电子设备3中的项目文件的管理装置20,并在电子设备3的运行过程中实现高速、自动地完成程序或数据的存取。所述存储器31包括只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子擦除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其他介质。
在一些实施例中,所述至少一个处理器32可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述至少一个处理器32是所述电子设备3的控制核心(Control Unit),利用各种接口和线路连接整个电子设备3的各个部件,通过运行或执行存储在所述存储器31内的程序或者模块,以及调用存储在所述存储器31内 的数据,以执行电子设备3的各种功能和处理数据。
在一些实施例中,所述至少一条通信总线33被设置为实现所述存储器31以及所述至少一个处理器32等之间的连接通信。
尽管未示出,所述电子设备3还可以包括给各个部件供电的电源(比如电池),可选的,电源可以通过电源管理装置与所述至少一个处理器32逻辑相连,从而通过电源管理装置实现管理充电、放电、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备3还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,电子设备,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的部分。
在进一步的实施例中,结合图2,所述至少一个处理器32可执行所述电子设备3的操作装置以及安装的各类应用程序(如所述的项目文件的管理装置20)、程序代码等,例如,上述的各个模块。
所述存储器31中存储有程序代码,且所述至少一个处理器32可调用所述存储器31中存储的程序代码以执行相关的功能。例如,图2中所述的各个模块是存储在所述存储器31中的程序代码,并由所述至少一个处理器32所执行,从而实现所述各个模块的功能以达到项目文件的管理的目的。
在本申请的一个实施例中,所述存储器31存储多个计算机可读指令,所述多个计算机可读指令被所述至少一个处理器32所执行以实现项目文件的管理的功能。
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器31中,并由所述处理器32执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机程序在所述电子设备3中的执行过程。例如,所述计算机程序可以被分割成获取模块201、资源分配模块202、生成模块203、解析模块204、识别模块205、判断模块206及读取模块207。
具体地,所述至少一个处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
进一步地,所述计算机可读存储介质可以是非易失性,也可以是易失性。
进一步地,所述计算机可读存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,既可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或,单数不排除复数。本申请中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种项目文件的管理方法,其中,所述项目文件的管理方法包括:
    获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
    对所述XML资源数据进行资源分配,得到多个拆分资源数据;
    识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
    当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
    识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
    当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
    当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
  2. 如权利要求1所述的项目文件的管理方法,其中,所述识别每个拆分资源数据中的读取人的权限数据,生成资源清单包括:
    解析每个拆分资源数据,获取每个读取人的权限数据,其中,所述权限数据中包含有读取人的识别码、可读取文件的文件名称、后缀和class路径;
    根据每个读取人的可读取文件的文件名称、后缀和class路径对所述每个拆分资源数据中的文件进行归类,得到每个读取人的文件集;
    解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单;
    合并多个读取人的资源清单得到每个拆分资源的资源清单。
  3. 如权利要求2所述的项目文件的管理方法,其中,所述解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单包括:
    识别每个读取人的权限等级,按照所述权限等级的提取方式从对应的文件集中提取出文件信息,及从预设格式库中确定出与所述权限等级对应的资源清单格式;
    按照所述资源清单格式对所述文件信息进行转换,得到目标信息;
    根据所述目标信息,按照预设的生成方式生成每个读取人的资源清单。
  4. 如权利要求1所述的项目文件的管理方法,其中,所述将所述项目文件转换为XML资源数据包括:
    根据所述项目文件的路径打开所述项目文件,解析所述项目文件生成包含有源代码仓库信息的JSON文件;
    解析所述JSON文件,并从所述JSON文件提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中;
    读取所述字典,并打印读取的所述字典;
    按照预设的调整方式调整所述字典中每个JSON文件的数据结构,将调整后的每个JSON文件转换为XML资源数据。
  5. 如权利要求1所述的项目文件的管理方法,其中,所述对所述XML资源数据进行资源分配,得到多个拆分资源数据包括:
    采用预设的web项目容器读取所述XML资源数据的配置参数中的读取人的权限数据及每个读取人对应的XML资源数据;
    创建一个Servlet上下文,并将所述读取人的权限数据及每个读取人对应的XML资源数据转换为键值对,加载到Servlet上下文中,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值;
    所述web项目容器根据所述读取人的权限数据中的权限等级在所述Servlet上下文创建权限分配类实例,并根据创建的权限分配类实例对所述键值对进行资源分配,得到多个拆分 资源数据。
  6. 如权利要求1所述的项目文件的管理方法,其中,所述解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息包括:
    解析所述读取请求获取读取人的识别码和调用接口;
    根据所述读取人的识别码从预设的权限等级数据库中确定出所述读取人的权限等级;
    根据所述读取请求及所述调用接口调用所述读取人需要读取的目标文件信息。
  7. 如权利要求1所述的项目文件的管理方法,其中,所述判断所述读取人是否有权限读取所述目标文件信息对应的目标文件包括:
    从所述读取人的权限数据对应的资源清单中获取所述读取人对应的文件集,并解析所述文件集得到所述读取人的第一文件信息;
    识别所述读取人的目标权限等级,按照所述目标权限等级对应的资源清单格式对所述目标文件信息进行转换得到第二文件信息;
    查询所述第一文件信息中是否存在所述第二文件信息;
    当在所述第一文件信息中查询到所述第二文件信息时,确定所述读取人有权限读取所述目标文件信息对应的目标文件;或者
    当在所述第一文件信息中未查询到所述第二文件信息时,确定所述读取人无权限读取所述目标文件信息对应的目标文件。
  8. 一种电子设备,其中,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:
    获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
    对所述XML资源数据进行资源分配,得到多个拆分资源数据;
    识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
    当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
    识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
    当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
    当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
  9. 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述识别每个拆分资源数据中的读取人的权限数据,生成资源清单时,具体包括:
    解析每个拆分资源数据,获取每个读取人的权限数据,其中,所述权限数据中包含有读取人的识别码、可读取文件的文件名称、后缀和class路径;
    根据每个读取人的可读取文件的文件名称、后缀和class路径对所述每个拆分资源数据中的文件进行归类,得到每个读取人的文件集;
    解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单;
    合并多个读取人的资源清单得到每个拆分资源的资源清单。
  10. 如权利要求9所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单时,具体包括:
    识别每个读取人的权限等级,按照所述权限等级的提取方式从对应的文件集中提取出文件信息,及从预设格式库中确定出与所述权限等级对应的资源清单格式;
    按照所述资源清单格式对所述文件信息进行转换,得到目标信息;
    根据所述目标信息,按照预设的生成方式生成每个读取人的资源清单。
  11. 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述将所述项目文件转换为XML资源数据时,具体包括:
    根据所述项目文件的路径打开所述项目文件,解析所述项目文件生成包含有源代码仓库信息的JSON文件;
    解析所述JSON文件,并从所述JSON文件提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中;
    读取所述字典,并打印读取的所述字典;
    按照预设的调整方式调整所述字典中每个JSON文件的数据结构,将调整后的每个JSON文件转换为XML资源数据。
  12. 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述对所述XML资源数据进行资源分配,得到多个拆分资源数据时,具体包括:
    采用预设的web项目容器读取所述XML资源数据的配置参数中的读取人的权限数据及每个读取人对应的XML资源数据;
    创建一个Servlet上下文,并将所述读取人的权限数据及每个读取人对应的XML资源数据转换为键值对,加载到Servlet上下文中,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值;
    所述web项目容器根据所述读取人的权限数据中的权限等级在所述Servlet上下文创建权限分配类实例,并根据创建的权限分配类实例对所述键值对进行资源分配,得到多个拆分资源数据。
  13. 如权利要求8所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息时,具体包括:
    解析所述读取请求获取读取人的识别码和调用接口;
    根据所述读取人的识别码从预设的权限等级数据库中确定出所述读取人的权限等级;
    根据所述读取请求及所述调用接口调用所述读取人需要读取的目标文件信息。
  14. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
    获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
    对所述XML资源数据进行资源分配,得到多个拆分资源数据;
    识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
    当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
    识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
    当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
    当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
  15. 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述识别每个拆分资源数据中的读取人的权限数据,生成资源清单时,具体包括:
    解析每个拆分资源数据,获取每个读取人的权限数据,其中,所述权限数据中包含有读取人的识别码、可读取文件的文件名称、后缀和class路径;
    根据每个读取人的可读取文件的文件名称、后缀和class路径对所述每个拆分资源数 据中的文件进行归类,得到每个读取人的文件集;
    解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单;
    合并多个读取人的资源清单得到每个拆分资源的资源清单。
  16. 如权利要求15所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述解析所述每个读取人的文件集,并按照预设的生成方式生成每个读取人的资源清单时,具体包括:
    识别每个读取人的权限等级,按照所述权限等级的提取方式从对应的文件集中提取出文件信息,及从预设格式库中确定出与所述权限等级对应的资源清单格式;
    按照所述资源清单格式对所述文件信息进行转换,得到目标信息;
    根据所述目标信息,按照预设的生成方式生成每个读取人的资源清单。
  17. 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述将所述项目文件转换为XML资源数据时,具体包括:
    根据所述项目文件的路径打开所述项目文件,解析所述项目文件生成包含有源代码仓库信息的JSON文件;
    解析所述JSON文件,并从所述JSON文件提取出每个源代码仓库信息的链接、索引及存储路径按照键值对写入对应的字典中;
    读取所述字典,并打印读取的所述字典;
    按照预设的调整方式调整所述字典中每个JSON文件的数据结构,将调整后的每个JSON文件转换为XML资源数据。
  18. 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述对所述XML资源数据进行资源分配,得到多个拆分资源数据时,具体包括:
    采用预设的web项目容器读取所述XML资源数据的配置参数中的读取人的权限数据及每个读取人对应的XML资源数据;
    创建一个Servlet上下文,并将所述读取人的权限数据及每个读取人对应的XML资源数据转换为键值对,加载到Servlet上下文中,其中,所述web项目容器以所述读取人的权限数据作为键,及所述每个读取人对应的XML资源数据作为键值;
    所述web项目容器根据所述读取人的权限数据中的权限等级在所述Servlet上下文创建权限分配类实例,并根据创建的权限分配类实例对所述键值对进行资源分配,得到多个拆分资源数据。
  19. 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息时,具体包括:
    解析所述读取请求获取读取人的识别码和调用接口;
    根据所述读取人的识别码从预设的权限等级数据库中确定出所述读取人的权限等级;
    根据所述读取请求及所述调用接口调用所述读取人需要读取的目标文件信息。
  20. 一种项目文件的管理装置,其中,所述项目文件的管理装置包括:
    获取模块,用于获取待配置项目的项目文件,将所述项目文件转换为XML资源数据;
    资源分配模块,用于对所述XML资源数据进行资源分配,得到多个拆分资源数据;
    生成模块,用于识别每个拆分资源数据中的读取人的权限数据,生成资源清单;
    解析模块,用于当监听到客户端的读取请求时,解析所述读取请求,确定出读取人的识别码、权限等级及需要读取的目标文件信息;
    识别模块,用于识别所述多个拆分资源的资源清单中是否存在所述读取人的识别码;
    判断模块,用于当所述多个拆分资源的资源清单中存在所述读取人的识别码时,判 断所述读取人是否有权限读取所述目标文件信息对应的目标文件;
    读取模块,用于当所述读取人有权限读取所述目标文件信息对应的目标文件时,响应于所述读取请求读取所述目标文件。
PCT/CN2021/109396 2021-06-22 2021-07-29 项目文件的管理方法、装置、电子设备及存储介质 WO2022267178A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110693573.7A CN113343302A (zh) 2021-06-22 2021-06-22 项目文件的管理方法、装置、电子设备及存储介质
CN202110693573.7 2021-06-22

Publications (1)

Publication Number Publication Date
WO2022267178A1 true WO2022267178A1 (zh) 2022-12-29

Family

ID=77477880

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/109396 WO2022267178A1 (zh) 2021-06-22 2021-07-29 项目文件的管理方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN113343302A (zh)
WO (1) WO2022267178A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051937A (zh) * 2006-05-10 2007-10-10 华为技术有限公司 一种基于xml的用户权限管理方法及系统
CN102314573A (zh) * 2010-07-01 2012-01-11 英业达股份有限公司 项目管理系统
CN110110151A (zh) * 2018-01-05 2019-08-09 北大方正集团有限公司 资源包解析入库的方法、系统、计算机设备和存储介质
WO2020010724A1 (zh) * 2018-07-13 2020-01-16 平安科技(深圳)有限公司 前端静态资源的管理方法、装置、计算机设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9020912B1 (en) * 2012-02-20 2015-04-28 F5 Networks, Inc. Methods for accessing data in a compressed file system and devices thereof
CN111881397B (zh) * 2020-06-15 2023-11-21 明博教育科技股份有限公司 一种给静态页面添加访问控制的方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051937A (zh) * 2006-05-10 2007-10-10 华为技术有限公司 一种基于xml的用户权限管理方法及系统
CN102314573A (zh) * 2010-07-01 2012-01-11 英业达股份有限公司 项目管理系统
CN110110151A (zh) * 2018-01-05 2019-08-09 北大方正集团有限公司 资源包解析入库的方法、系统、计算机设备和存储介质
WO2020010724A1 (zh) * 2018-07-13 2020-01-16 平安科技(深圳)有限公司 前端静态资源的管理方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN113343302A (zh) 2021-09-03

Similar Documents

Publication Publication Date Title
CN108804140B (zh) 一种批量指令解析方法、装置及设备
US11829368B2 (en) Systems and methods for management of data analytics platforms using metadata
US20210133622A1 (en) Ml-based event handling
US8914323B1 (en) Policy-based data-centric access control in a sorted, distributed key-value data store
US8140531B2 (en) Process and method for classifying structured data
WO2022142016A1 (zh) 基于规则引擎的参数转换方法、装置、设备及介质
US20110047125A1 (en) Configuration item management device and configuration item management method
US20120254434A1 (en) Placement goal-based database instance consolidation
CN112711581A (zh) 医疗数据校验方法、装置、电子设备及存储介质
WO2023029509A1 (zh) 动态服务发布方法、装置、电子设备及存储介质
WO2022095518A1 (zh) 接口自动化测试方法、装置、计算机设备及存储介质
US20110055373A1 (en) Service identification for resources in a computing environment
CN113535677B (zh) 数据分析查询管理方法、装置、计算机设备及存储介质
CN113962597A (zh) 一种数据分析方法、装置、电子设备及存储介质
WO2022267178A1 (zh) 项目文件的管理方法、装置、电子设备及存储介质
CN112347126A (zh) 大数据处理方法、装置、设备及介质
US11449677B2 (en) Cognitive hierarchical content distribution
CN113722324B (zh) 基于人工智能的报表生成方法、装置、电子设备及介质
CN116226315A (zh) 基于人工智能的敏感信息检测方法、装置及相关设备
US20100070458A1 (en) Rule creation method and rule creating apparatus
CN115292580A (zh) 数据查询方法、装置、计算机设备及存储介质
CN114418585A (zh) 智能合约生成方法、装置及相关设备
CN114239538A (zh) 断言处理方法、装置、计算机设备及存储介质
US11704222B2 (en) Event log processing
CN107818122A (zh) 一种代理组件、搜索管理方法及搜索管理系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21946665

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE