Authority management method and device of mirror image file, electronic equipment and storage medium
By binding the tag information of the image file to achieve flexible permission management, verifying user and time permissions based on the access token, it solves the problem that traditional private mirror permission verification cannot meet flexible needs, and improves the security and management efficiency of the image file .
Patent Information
- Application Number
- CN202411124445.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-12
AI Technical Summary
The permission verification of traditional private mirrors cannot achieve flexible time period access permissions according to different user needs, and cannot effectively ensure the security of the mirror files.
By obtaining the tag information of the image file, the access user group and access time permissions are bound to the image file, and the user information in the access token and access time are verified, the access terminal is granted corresponding access rights, and the access terminal is in the pre-order Set the time interval to poll the expiration tag information, and automatically unbind and delete expiration permissions.
It realizes flexible permission management for mirror files, grants access permissions for different time periods according to different users, improves the security and management efficiency of mirror files, and avoids system problems caused by data format errors.
Smart Images

Figure CN118940237A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information access security, and in particular to a method for managing permissions of image files, and also to an image file permissions management device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] With the continuous development of container applications, container application scenarios are also increasing. The use of container images is divided into public images and private images. Public images are accessible to everyone, and private images usually contain sensitive or proprietary data and configuration information. The sharing and access of this information need to be strictly controlled. The permission verification of traditional private images is generally obtained through token verification. However, the usage time of this permission is permanent, and it is impossible to share it within different specified time periods according to different user needs. As the usage time increases, the security of private images cannot be effectively guaranteed.
[0003] Therefore, how to perform more flexible permission management on the image file so as to grant access rights for different time periods to different users and further ensure the security of the image file is a problem to be solved urgently by those skilled in the art. Summary of the invention
[0004] The purpose of the present application is to provide a method for managing the permissions of an image file, which can perform more flexible permission management on the image file, so as to grant access rights for different time periods to different users, thereby further ensuring the security of the image file; another purpose of the present application is to provide a device for managing the permissions of an image file, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above-mentioned beneficial effects.
[0005] In a first aspect, the present application provides a method for managing permissions of an image file, comprising:
[0006] Obtaining tag information of each image file, and binding each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time authority of the accessible user group;
[0007] When receiving an access request sent by an access terminal, determining the target image file and the access token of the access terminal according to the access request; wherein the access token includes user information and accessible time of the access terminal;
[0008] Determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information;
[0009] When both the user information and the accessible time are verified, the access terminal is granted access rights to the target image file, so that the access terminal can access the target image file using the access rights.
[0010] Optionally, the image file rights management method further includes:
[0011] For each image file, when label management information about the image file is received, a corresponding management operation is performed according to the label management information corresponding to the label information of the image file;
[0012] The management operation includes one or more combinations of a tag information adding operation, a tag information modifying operation, and a tag information deleting operation.
[0013] Optionally, the image file rights management method further includes:
[0014] For each image file, polling each tag information of the image file at a preset time interval to determine whether the access time permission in each tag information has expired;
[0015] Unbinding the tag information of the expired access time authority from the image file, and deleting the tag information of the expired access time authority;
[0016] Determine the accessible user group in the tag information whose access time permission has expired, and delete the API access permission of the accessible user group.
[0017] Optionally, the image file rights management method further includes:
[0018] For each image file, generate and save a log file corresponding to the image file;
[0019] The log file includes access records and / or tag information management records of the image file.
[0020] Optionally, the tag information further includes an access rights level of the accessible user group;
[0021] Correspondingly, when both the user information and the accessible time are verified, granting the access terminal access rights to the target image file so that the access terminal can access the target image file using the access rights, including:
[0022] When both the user information and the accessible time are verified, granting the access terminal access rights to the target image file, so that the access terminal can access the target image file according to the access right level in the access right;
[0023] The access permission level includes one or more combinations of a read-only level, a write-only level, a read-write level, and a copy level.
[0024] Optionally, after obtaining the tag information of each image file and binding each tag information with the corresponding image file, the method further includes:
[0025] For each tag information, the tag information is encoded according to a preset standard protocol to generate an access token corresponding to the tag information;
[0026] Determine an accessible user group in the tag information, and send the access token to each user terminal in the accessible user group, so that the user terminal, as the access terminal, initiates the access request using the access token;
[0027] Accordingly, the user information is verified using the accessible user group in the target tag information, and the accessible time is verified using the access time authority in the target tag information, including:
[0028] Decoding the access token according to the decoding rule corresponding to the preset standard protocol, obtaining the user information and the accessible time, and determining the time point when the access request is received;
[0029] When the user information matches the accessible user group in the target tag information, and the accessible time is consistent with the access time authority in the target tag information, and the actual time node satisfies the access time authority, it is determined that the verification is passed;
[0030] When the user information does not hit the accessible user group in the target tag information, and / or the accessible time is inconsistent with the access time authority in the target tag information, and / or the actual time node does not satisfy the access time authority, it is determined that the verification fails.
[0031] Optionally, obtaining label information of each image file and binding each label information with a corresponding image file includes:
[0032] Obtaining label information of each of the image files;
[0033] For each piece of label information, format checking is performed on the label information according to a preset label format;
[0034] When the format check passes, the label information is bound to the corresponding image file;
[0035] When the format check fails, an error prompt is output.
[0036] In a second aspect, the present application also provides a permission management device for an image file, comprising:
[0037] A binding module, used to obtain tag information of each image file, and bind each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time authority of the accessible user group;
[0038] A determination module, configured to determine, when receiving an access request sent by an access terminal, a target image file and an access token of the access terminal according to the access request; wherein the access token includes user information and an accessible time of the access terminal;
[0039] A verification module, used to determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information;
[0040] The access module is used to grant the access terminal access rights to the target image file when both the user information and the accessible time are verified, so that the access terminal can access the target image file using the access rights.
[0041] In a third aspect, the present application further discloses an electronic device, comprising:
[0042] Memory for storing computer programs;
[0043] A processor is used to implement the steps of any one of the image file rights management methods described above when executing the computer program.
[0044] In a fourth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the image file permission management methods described above are implemented.
[0045] In a fifth aspect, the present invention further discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of any one of the image file permission management methods described above.
[0046] The present application provides a method for managing permissions of image files, comprising: obtaining tag information of each image file, and binding each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time permission of the accessible user group; when an access request sent by an access terminal is received, determining a target image file and an access token of the access terminal according to the access request; wherein the access token includes user information and an accessible time of the access terminal; determining target tag information of the target image file, and verifying the user information using the accessible user group in the target tag information, and verifying the accessible time using the access time permission in the target tag information; when both the user information and the accessible time are verified, granting the access terminal access rights to the target image file, so that the access terminal can access the target image file using the access rights.
[0047] By applying the technical solution provided by the present application, for each image file, different access time permissions for the image file can be set for different users (i.e., user groups including one or more users), and the permissions can be bound to the corresponding image file in the form of tag information. Thus, when the access terminal initiates access to a certain image file (target image file) based on its own access token, the accessible user group in the target image file and the access time permissions of the accessible user group can be used to verify the user information and accessible time of the access terminal in the access token. Obviously, if the two match, the verification is passed. If any one of the conditions does not match, the verification fails. On this basis, when the verification passes, the access terminal can be granted access rights to the target image file. Thus, the access terminal can use the access rights to access the target image file. It can be seen that the present technical solution can grant access rights for different time periods to different users, effectively ensuring the flexibility of image file permission management and the security of image files.
[0048] In one embodiment of the present application, before binding the tag information with the corresponding image file, the format is first checked using a preset tag format to effectively ensure the standardization, accuracy and uniformity of each tag information, avoid system problems and user troubles caused by data format errors, and make subsequent image file permission management more accurate, convenient and quick.
[0049] The image file permission management device, electronic device, computer-readable storage medium and computer program product provided in this application also have the above-mentioned technical effects, and this application will not repeat them here. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.
[0051] Figure 1 A flowchart of a method for managing permissions of an image file provided in this application;
[0052] Figure 2 A flowchart of another image file permissions management method provided by this application;
[0053] Figure 3 A schematic diagram of the structure of a permission management device for image files provided by the present application;
[0054] Figure 4 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0055] The core of the present application is to provide a method for managing the permissions of an image file, which can perform more flexible permission management on the image file, so as to grant access rights for different time periods to different users, thereby further ensuring the security of the image file; another core of the present application is to provide a device for managing the permissions of an image file, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above-mentioned beneficial effects.
[0056] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0057] The embodiment of the present application provides a method for managing permissions of an image file.
[0058] Please refer to Figure 1 , Figure 1 The flowchart of a method for managing permissions of an image file provided by the present application is as follows. The method for managing permissions of an image file may include the following S101 to S104:
[0059] S101: Obtain tag information of each image file, and bind each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time authority of the accessible user group.
[0060] This step aims to realize the binding process of the image file and its corresponding tag information. Specifically, there are multiple image files stored in the system and stored through corresponding storage media. For each image file, the user can create corresponding tag information for it according to actual needs. Different users / user groups can set different tag information through the user terminal. Therefore, one image file may correspond to multiple tag information. Further, after completing the creation of the tag information, the background server of the system can bind the tag information with the corresponding image file.
[0061] Among them, for any tag information, it at least includes an accessible user group and the access time permission of the accessible user group. The accessible user group refers to the user group that can access the image file corresponding to the tag information, which may include user information of one or more users; the access time permission of the accessible user group refers to the time when all users in the accessible user group can access the image file corresponding to the tag information, which may include the start time and the end time. On this basis, for any image file, the accessible user group and its accessible time contained in different tag information are different.
[0062] In one embodiment of the present application, the above-mentioned obtaining the tag information of each image file and binding each tag information with the corresponding image file may include:
[0063] Get the label information of each image file;
[0064] For each piece of label information, format verification is performed on the label information according to a preset label format;
[0065] When the format check passes, the label information is bound to the corresponding image file;
[0066] When the format check fails, an error message is output.
[0067] The embodiment of the present application provides a method for implementing binding processing of an image file and its corresponding tag information. For any image file, after the user creates the corresponding tag information for it, the background server can first perform a format check on the tag information before binding the tag information with the image file, and perform the binding operation of the image file and the tag information after the format check passes. On the contrary, if the check fails, it is considered that the currently created tag information is unqualified, and an error prompt can be output at this time.
[0068] In order to implement the format check operation on the label information, a standard label format can be pre-set, that is, the above-mentioned preset label format, and then format check can be performed on each newly created label information according to the preset label format. Obviously, when the format of the label information meets the preset label format, it can be considered that the format check has passed; when the format of the label information does not meet the preset label format, it is considered that the format check has failed.
[0069] It can be seen that before binding the tag information with the corresponding image file, the embodiment of the present application first uses the preset tag format to perform format verification on it, so as to effectively ensure the standardization, accuracy and uniformity of each tag information, avoid system problems and user troubles caused by data format errors, and make the subsequent permission management of the image file more accurate, convenient and quick.
[0070] In one embodiment of the present application, the format checking of the label information according to the preset label format may include:
[0071] Verify whether each identifier in the tag information is a valid identifier;
[0072] Verify whether the tag type in the tag information matches the standard tag type library;
[0073] Verify whether the access time permission in the tag information conforms to the standard time format;
[0074] Verify whether the start time of the access time permission in the tag information is less than the end time;
[0075] Verify whether the access time permission in the tag information is within the maximum allowed time range;
[0076] Verify whether the access time permissions in the tag information are duplicated with the access time permissions in other tags.
[0077] The embodiment of the present application provides a method for implementing format verification of tag information according to a preset tag format, which implements various verifications of identifiers, tag types, and access time permissions in tag information. Among them, identifiers may include but are not limited to user identifiers of each user in the accessible user group, file identifiers of corresponding image files, and tag information identifiers, etc. Different identifiers are preset with different standard formats to determine their validity; tag types may include basic tags, functional tags, security tags, etc., and tag type verification can be implemented through a pre-created standard tag type library.
[0078] It is understandable that by formatting the tag information, the standardization, accuracy and uniformity of each tag information can be effectively guaranteed, thereby avoiding system problems and user troubles caused by data format errors, making the subsequent permission management of the image file more accurate, convenient and quick.
[0079] S102: When receiving an access request sent by an access terminal, determining a target image file and an access token of the access terminal according to the access request; wherein the access token includes user information and accessible time of the access terminal.
[0080] S103: Determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information.
[0081] The above steps are intended to implement the legitimacy verification of the access token of the access terminal during the image file access process, so as to complete the image file access when the verification passes. Specifically, the visitor (any user) can initiate an access request for a certain image file (i.e., the above-mentioned target image file) through the access terminal (i.e., the user terminal that initiates the access request), and the background server can parse and determine the target image file that the access terminal needs to access based on the access request, and obtain the access token carried therein; further, the background server can determine the target tag information of the target image file, and use the target tag information to verify the access token. It can be imagined that only when the access token verification passes, the subsequent target image file access operation can be continued.
[0082] Among them, the access token is issued to the access terminal by the backend server after the target tag information is bound to the target image file when the visitor creates the target tag information for the target image file through the access terminal, and it contains the user information of the access terminal and its accessible time. On this basis, the process of verifying the access token based on the target tag information is as follows: verifying the user information using the accessible user group in the target tag information; and verifying the accessible time using the access time authority in the target tag information.
[0083] In one embodiment of the present application, after obtaining the tag information of each image file and binding each tag information with the corresponding image file, the following may also be included:
[0084] For each tag information, encode the tag information according to a preset standard protocol to generate an access token corresponding to the tag information;
[0085] Determine the accessible user group in the tag information, and send the access token to each user terminal in the accessible user group, so that the user terminal, as an access terminal, initiates an access request using the access token;
[0086] Accordingly, the above-mentioned verification of user information by using the accessible user group in the target tag information and verification of the accessible time by using the access time authority in the target tag information may include:
[0087] Decode the access token according to the decoding rules corresponding to the preset standard protocol, obtain user information and accessible time, and determine the time point when the access request is received;
[0088] When the user information hits the accessible user group in the target tag information, and the accessible time is consistent with the access time permission in the target tag information, and the actual time node satisfies the access time permission, it is determined that the verification is passed;
[0089] When the user information does not hit the accessible user group in the target tag information, and / or the accessible time is inconsistent with the access time authority in the target tag information, and / or the actual time node does not meet the access time authority, it is determined that the verification fails.
[0090] The embodiment of the present application provides a method for generating an access token and an implementation method for verifying the access token. Specifically, for each tag information, after binding it with the corresponding image file, the tag information can be encoded according to a pre-set standard protocol to generate its corresponding access token; as mentioned above, the tag information includes an accessible user group, which is a user group that can access the image file corresponding to the tag information, which can include user information of one or more users, based on which, the access token can be sent to each user terminal in the accessible user group, thereby, each user terminal in the accessible user group can initiate an access request to the corresponding image file based on the access token.
[0091] Furthermore, when the access token is verified using the target tag information of the target image file, it can be decoded according to the decoding rules corresponding to the preset standard protocol to obtain the user information and accessible time therein, and determine the time node when the access request is received. Then, it can be verified whether the user information in the access token hits the accessible user group in the target tag information, whether the accessible time in the access token is consistent with the access time authority in the target tag information, and whether the time node when the access request is received complies with the access time authority in the target tag information. If all three of the above are met, it can be determined that the access token verification has passed. If any of the above conditions is not met, it can be determined that the access token verification has failed.
[0092] S104: When both the user information and the accessible time are verified, the access terminal is granted access rights to the target image file, so that the access terminal can access the target image file using the access rights.
[0093] This step aims to achieve access to the target image file after the access token is verified. Specifically, when the user information and the accessible time are verified, that is, when the legitimacy of the access token is verified, the backend server can grant the access terminal access to the target image file, and the access terminal can access the target image file according to the access permission.
[0094] In one embodiment of the present application, the above-mentioned tag information may also include the access permission level of the accessible user group;
[0095] Accordingly, when both the user information and the accessible time are verified, granting the access terminal access rights to the target image file so that the access terminal accesses the target image file using the access rights may include:
[0096] When both the user information and the accessible time are verified, the access terminal is granted access rights to the target image file, so that the access terminal can access the target image file according to the access rights level in the access rights;
[0097] The access permission level includes one or more combinations of read-only level, write-only level, read-write level, and copy level.
[0098] Specifically, different access rights levels can be set for different accessible user groups, that is, the tag information can further include the access rights level of the accessible user group, such as read-only level, write-only level, read-write level, copy level, etc., so that when the access terminal accesses the target image file according to the access rights, it can only achieve file access at the corresponding access rights level. For example, if the accessible user group in the tag information is an administrator user group, the corresponding access rights level can be set to the read-write level; if the accessible user group in the tag information is an enterprise-level user group, the corresponding access rights level can be set to the copy level; if the accessible user group in the tag information is a general user group, the corresponding access rights level can be set to the read-only level, thereby achieving image file access at different permission levels for different users.
[0099] It can be seen that the permission management method for the image file provided in the embodiment of the present application can set different access time permissions for each image file for different users (i.e., user groups containing one or more users), and bind it to the corresponding image file in the form of tag information. Therefore, when the access terminal initiates access to a certain image file (target image file) based on its own access token, the accessible user group in the target image file and the access time permissions of the accessible user group can be used to verify the user information and accessible time of the access terminal in the access token. Obviously, if the two match, the verification passes. If any one of the conditions does not match, the verification fails. On this basis, when the verification passes, the access terminal can be granted access rights to the target image file. Therefore, the access terminal can use the access rights to access the target image file. It can be seen that the technical solution can grant access rights for different time periods to different users, effectively ensuring the flexibility of image file permission management and the security of image files.
[0100] Based on the above embodiments:
[0101] In one embodiment of the present application, the image file rights management method may further include:
[0102] For each image file, when label management information about the image file is received, a corresponding management operation is performed according to the label information of the image file corresponding to the label management information;
[0103] The management operation includes one or more combinations of a tag information adding operation, a tag information modifying operation, and a tag information deleting operation.
[0104] The permission management method of the image file provided in the embodiment of the present application can further realize the tag information management of the image file. Specifically, for each image file, the user can manage the tag information corresponding to the user bound to it, for example, add or delete the corresponding accessible user in the accessible user group, modify the time information of the access time permission, modify the access permission level, etc., as well as add new tag information to a certain image file, delete the old tag information, etc. It can be understood that the modification of the tag information is determined by the modification personnel according to actual needs, and this application does not limit this.
[0105] In one embodiment of the present application, the image file rights management method may further include:
[0106] For each image file, poll each tag information of the image file at a preset time interval to determine whether the access time permission in each tag information has expired;
[0107] Unbind the tag information with expired access time permissions from the image file, and delete the tag information with expired access time permissions;
[0108] The accessible user group in the tag information whose access time permission has expired is determined, and the API (Application Programming Interface) access permission of the accessible user group is deleted.
[0109] The permission management method for the image file provided in the embodiment of the present application can further realize the expiration detection of the tag information, so as to delete the expired tag information. Specifically, for each image file in the system, each tag information bound to it can be polled regularly to detect whether it is expired. For example, the access time permission is set to 2024.01.01-2024.06.01 in a certain tag information. Then, when the actual time exceeds 2024.06.01, it can be considered that the tag information has expired. Further, the expired tag information can be untied from the corresponding image file and deleted. At the same time, the API access rights of the accessible user group in the tag information can be further released, so that all users in the access user group can no longer continue to access the image file corresponding to the expired tag information. Of course, the value of the above-mentioned preset time interval does not affect the implementation of the present technical solution, and can be set by the technical personnel according to actual needs, and the embodiment of the present application does not limit this.
[0110] It can be seen that after detecting that the accessible time period has ended, the embodiment of the present application will automatically delete the access rights of the corresponding accessible user group to the corresponding image file, effectively ensuring the security and privacy of the image file.
[0111] In one embodiment of the present application, the image file rights management method may further include:
[0112] For each image file, generate and save a log file corresponding to the image file;
[0113] The log file includes the access record of the image file and / or the tag information management record.
[0114] The permission management method for image files provided in the embodiment of the present application can further implement a log recording function. In the process of tag information setting and binding and subsequent image file access, for each image file, detailed log records can be made for the tag information management operations and file access operations that occurred thereto, so as to generate corresponding access records and tag information management records, and save them. Thus, the administrator can view these log records through the front-end interface to facilitate subsequent permission auditing and accountability.
[0115] Based on the above embodiments, the embodiment of the present application provides another method for managing permissions of image files.
[0116] First, the image file rights management method provided in the embodiment of the present application can be implemented based on the following functional modules:
[0117] 1. Label design:
[0118] When designing the tag structure, a hierarchical tag system can be used. For example, it can be divided into basic tags (such as operating system type, software version), functional tags (such as development, testing, production), security tags (such as encryption level), and newly added dynamic timestamp tags. Each tag is stored in the form of a key-value pair, such as {tag_type: "time-limited", tag_name: "ProjectX-Collaboration", start_date: "2023-04-01", end_date: "2023-04-15"}, where tag_type is used to distinguish the tag type, tag_name is the tag name, start_date and end_date define the effective time range of the permission, the former is the start time, and the latter is the end time.
[0119] 2. Tag parsing engine:
[0120] Build a tag parsing engine to parse all tags on each image file and dynamically generate corresponding permission rules based on dynamic timestamp tags. The tag parsing engine can monitor the tag library in real time and immediately trigger the permission change process once the dynamic timestamp tag reaches its validity period.
[0121] 3. Permission model:
[0122] Design a fine-grained permission model that supports multiple permission levels such as read, write, clone, etc. In the subsequent permission allocation, the corresponding permission set can be automatically generated or revoked by combining user roles (such as administrator, developer, guest) and image tags.
[0123] 4. Access token generation:
[0124] For users who are granted access rights, the system can generate a time-limited access token. The access token contains information such as user ID, image ID, permission type, effective start and end time, and is encoded using standard protocols such as JWT (JSON WebTokens, an open standard based on JSON) to ensure security.
[0125] 5. Scheduled task service:
[0126] The background scheduled task service is used to check the dynamic timestamp tags of all image files and their associated access tokens. When the access token is about to expire or has expired, the service automatically removes the relevant records from the permission database and notifies the cloud platform to revoke the corresponding API access rights.
[0127] 6. Event-driven architecture:
[0128] Combined with the event-driven architecture, once a change in the dynamic timestamp tag is detected, the event processor is immediately triggered to execute the permission recovery logic to ensure the immediacy of permission revocation.
[0129] For further information, please refer to Figure 2 , Figure 2 A flowchart of another image file permission management method provided by this application, the implementation process of which is as follows:
[0130] 1. Creation and modification of labels:
[0131] Users can select specific image files through the front-end user interface and create or modify tags for them. Tag information can include the shareable time period (start time and end time), target user group (can be a group of one or more users), and access permission level (read-only, read-write, etc.). Tag information is stored in the database after format verification and associated with the corresponding image file.
[0132] 2. Time period sharing:
[0133] The backend server shares the private image with the specified target user group at the start time according to the time period information in the tag. Users in the target user group can access and use the image file through the front-end user interface and perform corresponding operations according to the permission level set in the tag.
[0134] 3. Automatic permission management:
[0135] When the sharing period ends, the backend server will automatically perform the permission deletion operation. Specifically, the backend server will traverse all image files and target user group information associated with expired tags in the database; for each expired tag, the backend server will delete the corresponding target user group's access rights to the image file to ensure that the target user group can no longer access the image file; at the same time, the backend server will update the database access log to record the permission deletion operation and timestamp information.
[0136] 4. Permission audit and logging:
[0137] The system can record all operations related to image file sharing and access, and store these records in the database. The record content may include but is not limited to: the creation, modification, and deletion time of tags, the addition and deletion time of target user groups, the user's access time, operation content, etc. Therefore, the administrator can view these records through the front-end user interface for subsequent permission audits and accountability.
[0138] Finally, regarding the format verification of the above tag information, the implementation process is as follows:
[0139] During the creation or modification of an image tag, the system can call the tag data format verification method to verify the image tag. This method can use regular expressions to verify each part of the tag one by one according to the predefined tag format rules. If the verification passes, the subsequent permission allocation process will continue; if the verification fails, the tag will be rejected and detailed error prompt information will be returned.
[0140] 1. Set label format:
[0141] First, you need to clarify the format rules of the tag, which will serve as the basis for verification. Generally speaking, a tag may contain multiple parts, which can be a json data structure, such as:
[0142] {
[0143] "label": {
[0144] "id": "test12345",
[0145] "image_id": "image1223333",
[0146] "user_id": "user1",
[0147] "type": "environment",
[0148] "description": "This is an example tag for the developmentenvironment.",
[0149] "start_time": "2023-07-17T12:00:00Z",
[0150] "end_time": "2023-07-18T12:00:00Z",
[0151] }
[0152] in:
[0153] (1) id: Tag ID unique identifier, used to uniquely identify a tag in the system. The association between a tag and an image file is achieved through the image ID, ensuring that each image can have multiple tags and each tag can be associated with multiple users.
[0154] (2) image_id: The unique identifier of the image file associated with the tag.
[0155] (3) userid: A list of one or more user identifiers that specifies the users who have access rights during the time period defined by the tag.
[0156] (4) description: Checks whether it contains only printable ASCII characters.
[0157] (5) type: tag type, which can be verified by string matching. For example, this can be achieved by storing various standard tag types in a set and checking whether the tag type in the tag is in the set, thereby verifying whether it belongs to one of the predefined tag types.
[0158] (6) start_time / end_time: indicates the valid time range of the image file. The start time and end time of the time period should conform to the predetermined date and time format, such as the ISO 8601 standard format (YYYY-MM-DD HH:MM). The start time should be earlier than or equal to the end time to ensure the validity of the time period.
[0159] 2. Regular expression format check + integrity check:
[0160] (1) Use regular expressions to verify each part of the label.
[0161] Regular expressions can accurately describe the pattern of a string, ensuring that each part of the label conforms to the expected format. Based on the above format rules, a regular expression can be designed to verify the structure and format of the data label to ensure compliance with standard specifications:
[0162] "image_id": "[a-zA-Z0-9_\-]+", ensure that the format complies with the verification rules;
[0163] "user_id": "[a-zA-Z0-9_\-]+", make sure it is a valid UUID;
[0164] "type": "(environment|version|security|otherType)"; otherType is a placeholder and should be replaced with all legal types when actually used;
[0165] Time period verification: Use regular expressions to verify whether the format of the time label conforms to the "YYYY-MM-DD to YYYY-MM-DD" specification; check whether the start time is less than the end time to ensure the logical correctness of the time label; verify whether the time period defined by the time label is within the maximum time range allowed by the system, for example, no more than one year; check whether there are duplicate time labels on the same image file to avoid granting users multiple permissions in the same time period.
[0166] (2) Integrity check: In addition to the format check in (1), an integrity check can also be performed to ensure that the label contains all necessary information. This process can be achieved by checking whether the label string contains all predefined parts (such as image_id, type, and time period). In addition, these parts can appear in different orders and can be separated by specific delimiters (such as spaces).
[0167] 3. Exception handling:
[0168] If all checks pass, the label is accepted and the subsequent permission allocation process continues; if any check fails, the label is rejected and detailed error information is returned to guide the user to make corrections.
[0169] 4. Automation Integration:
[0170] Integrate the tag data format verification method into the automated process of the image management system to ensure that each creation or modification of an image tag is strictly verified. The system will then re-evaluate the permission status of the user associated with the tag and perform corresponding permission updates. This is achieved by adding corresponding verification logic and error handling mechanisms to the system.
[0171] It can be understood that, through the design and implementation of the above data verification method, the accuracy and consistency of the label data can be ensured, avoiding system problems or user troubles caused by data format errors.
[0172] It can be seen that the image file permission management method provided in the embodiment of the present application has the following advantages:
[0173] (1) Flexible permission management: By adding different labels to image files, they can be shared with specific users according to time periods, meeting users' flexible needs.
[0174] (2) Automatic permission deletion: After the sharing period ends, the system can automatically delete the user group's access rights to the corresponding image file to ensure data security and privacy;
[0175] (3) Permission audit and logging: The system records all operations related to image file sharing and access, providing strong support for subsequent permission audits and accountability;
[0176] (4) Efficient management efficiency: Through automated permission management and logging functions, the administrator's workload is reduced and management efficiency is improved.
[0177] An embodiment of the present application provides a device for managing permissions of an image file.
[0178] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a permission management device for an image file provided by the present application. The permission management device for an image file may include:
[0179] Binding module 1, used to obtain label information of each image file, and bind each label information with the corresponding image file; wherein the label information includes the accessible user group and the access time authority of the accessible user group;
[0180] Determination module 2, for determining the target image file and the access token of the access terminal according to the access request when receiving the access request sent by the access terminal; wherein the access token includes the user information and the accessible time of the access terminal;
[0181] Verification module 3, used to determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information;
[0182] The access module 4 is used to grant the access terminal access rights to the target image file when both the user information and the accessible time are verified, so that the access terminal can access the target image file using the access rights.
[0183] It can be seen that the image file rights management device provided in the embodiment of the present application can set different access time rights for each image file for different users (i.e., user groups including one or more users), and bind it to the corresponding image file in the form of tag information. Therefore, when the access terminal initiates access to a certain image file (target image file) based on its own access token, the accessible user group in the target image file and the access time rights of the accessible user group can be used to verify the user information and accessible time of the access terminal in the access token. Obviously, if the two match, the verification is passed. If any one of the conditions does not match, the verification fails. On this basis, when the verification passes, the access terminal can be granted access rights to the target image file, and thus, the access terminal can use the access rights to access the target image file. It can be seen that the technical solution can grant access rights of different time periods to different users, effectively ensuring the flexibility of image file rights management and the security of image files.
[0184] In one embodiment of the present application, the image file permission management device may also include a management module, which is used for each image file, when receiving tag management information about the image file, to perform corresponding management operations according to the tag information of the image file corresponding to the tag management information; wherein the management operation includes a combination of one or more of a tag information adding operation, a tag information modifying operation, and a tag information deleting operation.
[0185] In one embodiment of the present application, the image file permission management device may also include a monitoring module, which is used to poll each tag information of the image file at a preset time interval for each image file to determine whether the access time permission in each tag information has expired; unbind the tag information with expired access time permission from the image file, and delete the tag information with expired access time permission; determine the accessible user group in the tag information with expired access time permission, and delete the API access permission of the accessible user group.
[0186] In one embodiment of the present application, the image file rights management device may further include a log module for generating and saving a log file corresponding to each image file; wherein the log file includes an access record and / or a tag information management record of the image file.
[0187] In one embodiment of the present application, the above-mentioned tag information may also include the access permission level of the accessible user group; accordingly, the above-mentioned access module 4 may be specifically used to grant the access terminal access permission to the target image file when both the user information and the accessible time are verified, so that the access terminal can access the target image file according to the access permission level in the access permission; wherein the access permission level includes a combination of one or more of the read-only level, write-only level, read-write level, and copy level.
[0188] In one embodiment of the present application, the image file rights management device may further include an encoding module, which is used to, after obtaining the tag information of each image file and binding each tag information with the corresponding image file, encode the tag information according to a preset standard protocol for each tag information to generate an access token corresponding to the tag information; determine the accessible user group in the tag information, and issue the access token to each user terminal in the accessible user group, so that the user terminal, as an access terminal, initiates an access request using the access token;
[0189] Correspondingly, the above-mentioned verification module 3 can be specifically used to decode the access token according to the decoding rules corresponding to the preset standard protocol, obtain user information and accessible time, and determine the time node when the access request is received; when the user information hits the accessible user group in the target tag information, and the accessible time is consistent with the access time authority in the target tag information, and the actual time node satisfies the access time authority, it is determined that the verification is passed; when the user information does not hit the accessible user group in the target tag information, and / or the accessible time is inconsistent with the access time authority in the target tag information, and / or the actual time node does not satisfy the access time authority, it is determined that the verification fails.
[0190] In one embodiment of the present application, the above-mentioned binding module 1 can be specifically used to obtain the label information of each image file; for each label information, the label information is format checked according to a preset label format; when the format check passes, the label information is bound to the corresponding image file; when the format check fails, an error prompt is output.
[0191] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0192] An embodiment of the present application provides an electronic device.
[0193] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:
[0194] A memory 11, used for storing computer programs;
[0195] The processor 10 can implement the steps of any one of the above-mentioned image file rights management methods when executing a computer program.
[0196] like Figure 4 , which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.
[0197] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.
[0198] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of the method for managing permissions of an image file.
[0199] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:
[0200] Obtaining tag information of each image file, and binding each tag information with the corresponding image file; wherein the tag information includes the accessible user group and the access time authority of the accessible user group;
[0201] When receiving an access request sent by an access terminal, determining the target image file and the access token of the access terminal according to the access request; wherein the access token includes user information and accessible time of the access terminal;
[0202] Determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information;
[0203] When both the user information and the accessible time are verified, the access terminal is granted access rights to the target image file, so that the access terminal can access the target image file using the access rights.
[0204] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.
[0205] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0206] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.
[0207] Of course, it should be noted that Figure 4 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Figure 4 More or fewer components than shown, or combinations of certain components.
[0208] An embodiment of the present application provides a computer-readable storage medium.
[0209] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned methods for managing permissions of an image file can be implemented.
[0210] Among them, the computer-readable storage medium can be any available medium that can be stored in a computer or a data storage device such as a server or data center that includes one or more available media integrated. For example, it can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk) and other media that can store computer program codes.
[0211] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0212] An embodiment of the present application provides a computer program product.
[0213] The computer program product provided in the embodiment of the present application includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of any one of the above-mentioned image file permission management methods can be implemented.
[0214] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of them can be implemented in the form of a computer program product.
[0215] Among them, the computer program product may include one or more computer programs / instructions, and when the computer program / instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application may be generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line, etc.) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0216] For an introduction to the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0217] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0218] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0219] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0220] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A method for managing permissions of an image file, characterized in that: include: Obtaining tag information of each image file, and binding each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time authority of the accessible user group; When receiving an access request sent by an access terminal, determining the target image file and the access token of the access terminal according to the access request; wherein the access token includes user information and accessible time of the access terminal; Determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information; When both the user information and the accessible time are verified, the access terminal is granted access rights to the target image file, so that the access terminal can access the target image file using the access rights.
2. The image file rights management method according to claim 1, characterized in that: Also includes: For each image file, when label management information about the image file is received, a corresponding management operation is performed according to the label management information corresponding to the label information of the image file; The management operation includes one or more combinations of a tag information adding operation, a tag information modifying operation, and a tag information deleting operation.
3. The image file rights management method according to claim 1, characterized in that: Also includes: For each image file, polling each tag information of the image file at a preset time interval to determine whether the access time permission in each tag information has expired; Unbinding the tag information of the expired access time permission from the image file, and deleting the tag information of the expired access time permission; Determine the accessible user group in the tag information whose access time permission has expired, and delete the API access permission of the accessible user group.
4. The image file rights management method according to claim 2 or 3, characterized in that: Also includes: For each image file, generate and save a log file corresponding to the image file; The log file includes access records and / or tag information management records of the image file.
5. The image file rights management method according to claim 1, characterized in that: The tag information also includes the access permission level of the accessible user group; Correspondingly, when both the user information and the accessible time are verified, granting the access terminal access rights to the target image file so that the access terminal can access the target image file using the access rights, including: When both the user information and the accessible time are verified, granting the access terminal access rights to the target image file, so that the access terminal can access the target image file according to the access right level in the access right; The access permission level includes one or more combinations of a read-only level, a write-only level, a read-write level, and a copy level.
6. The image file rights management method according to claim 1, characterized in that: After obtaining the label information of each image file and binding each of the label information with the corresponding image file, the process further includes: For each tag information, the tag information is encoded according to a preset standard protocol to generate an access token corresponding to the tag information; Determine an accessible user group in the tag information, and send the access token to each user terminal in the accessible user group, so that the user terminal, as the access terminal, initiates the access request using the access token; Accordingly, the user information is verified using the accessible user group in the target tag information, and the accessible time is verified using the access time authority in the target tag information, including: Decoding the access token according to the decoding rule corresponding to the preset standard protocol, obtaining the user information and the accessible time, and determining the time point when the access request is received; When the user information matches the accessible user group in the target tag information, and the accessible time is consistent with the access time authority in the target tag information, and the actual time node satisfies the access time authority, it is determined that the verification is passed; When the user information does not hit the accessible user group in the target tag information, and / or the accessible time is inconsistent with the access time authority in the target tag information, and / or the actual time node does not satisfy the access time authority, it is determined that the verification fails.
7. The image file rights management method according to claim 1, characterized in that: Obtaining label information of each image file and binding each label information with the corresponding image file includes: Obtaining label information of each of the image files; For each piece of label information, format checking is performed on the label information according to a preset label format; When the format check passes, the label information is bound to the corresponding image file; When the format check fails, an error message is output.
8. A device for managing permissions of an image file, characterized in that: A binding module, used to obtain tag information of each image file, and bind each tag information with the corresponding image file; wherein the tag information includes an accessible user group and an access time authority of the accessible user group; A determination module, configured to determine, when receiving an access request sent by an access terminal, a target image file and an access token of the access terminal according to the access request; wherein the access token includes user information and an accessible time of the access terminal; A verification module, used to determine the target tag information of the target image file, and verify the user information using the accessible user group in the target tag information, and verify the accessible time using the access time authority in the target tag information; The access module is used to grant the access terminal access rights to the target image file when both the user information and the accessible time are verified, so that the access terminal can access the target image file using the access rights.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the image file rights management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image file rights management method according to any one of claims 1 to 7 are implemented.
