Remote printing permission control method and device, electronic equipment and medium
By setting up administrators and shared accounts, designing data tables and performing permission verification, the communication security problem during remote printing is solved, and the security and reliability of remote printing operations are achieved.
Patent Information
- Application Number
- CN202411610908.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-25
AI Technical Summary
During remote printing, communication between the server and the printing device is vulnerable to the risk of cyber attacks and data breaches, resulting in insecure printing data.
By setting up an administrator account and a shared account, the design data table contains user information, role information and permission information, obtain the role and permission information of the shared account based on the HTTP interface, and compare it with the preset interface permission information to determine whether the shared account is qualified to print access.
It realizes the security and reliability of the server when receiving HTTP requests during remote printing, prevents illegal operations from happening, and improves the security and reliability of remote printing operations.
Smart Images

Figure CN119690361A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of remote printing authority control, and in particular to a remote printing authority control method, device, electronic equipment and medium. Background Art
[0002] The first step in the printing process is to draw printing elements on the drawing board, including text, pictures, barcodes, etc. This process can involve a variety of drawing techniques and user interface design to improve the user's operating experience. At this time, image processing technology can be used to optimize the quality of graphic elements and ensure the accuracy and clarity of the final printing effect. Next, the drawing board data is converted into printing protocol data through the image library and printing SDK.
[0003] In the process of transmitting printing protocol data, there are two solutions, Bluetooth transmission and remote printing, each with its own security and technical considerations. In the Bluetooth transmission solution, the mobile phone APP enters the correct Bluetooth connection code within the printer range. In this process, security is a key factor. Although Bluetooth transmission is relatively safe, its security depends on the correct connection code input. If the user enters incorrectly multiple times, the device may be exposed to an unsafe network environment, threatening data transmission. In the remote printing process, the server directly transmits the printing protocol data to the printer after receiving the printing instruction. Remote printing relies on network connection and is vulnerable to network attacks and data leakage. The communication between the server and the printing device may be intercepted or tampered with by hackers, resulting in insecure printing data. Summary of the invention
[0004] In view of this, it is necessary to provide a remote printing permission control method, device, electronic device and medium to achieve the purpose of securely and reliably receiving HTTP requests from the server during remote printing and intercepting illegal operations of users.
[0005] In order to achieve the above object, the present invention provides a remote printing permission control method, comprising: Set up an administrator account, set permissions for shared accounts based on the administrator account, and design corresponding data tables based on the administrator account and shared account, where the data tables contain user information, role information, and permission information; When the shared account sends a print request based on the HTTP interface, the role information and permission information of the shared account are obtained based on the data table; Based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification.
[0006] In a possible implementation, setting an administrator account includes: Initialize the user, and connect the initialized user and printer based on Bluetooth technology to complete the administrator verification; Compare the printer number and printer key to confirm that the administrator has been successfully authenticated and design the corresponding data table.
[0007] In a possible implementation, the design data table includes: Design the user table for the administrator account and the shared account, where the user table includes the user information of the administrator account and the user information of the shared account; Design a machine role table for the administrator account and the shared account, where the machine role table includes a unique identifier associated with the administrator account and the shared account and the printer; Design a role rights and interests table for administrator accounts and shared accounts, where the role rights and interests table includes the rights and interests relationship between the administrator account and the shared account.
[0008] In a possible implementation, the rights and interests of the administrator account include at least: system setting permission, text printing permission, text batch printing permission, picture printing permission, file printing permission, PDF file printing permission and sharing invitation permission.
[0009] In a possible implementation, determining whether the shared account has the printing access qualification based on the shared account role information and the correspondence between the shared account permission information and the preset interface permission information includes: Get the user information of the shared account and the printer number; According to the user information and the printer number, a data table corresponding to the role information of the shared account is searched to determine the role information of the shared account on the printer; According to the role information of the shared account, query the data table corresponding to the shared account permission information to determine the shared account permission information; According to the correspondence between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification.
[0010] In a possible implementation, determining whether the shared account has the printing access qualification according to the correspondence between the shared account permission information and the preset interface permission information includes: Customize the required permission verification metadata based on the permission verification method to determine the interface permission information; Use Spring AOP aspects for permission verification.
[0011] In a possible implementation, obtaining the user information of the shared account and obtaining the printer number includes: Parse user information from the Authorization header; Get the machine_no from the request header to determine the printer number.
[0012] In a second aspect, the present invention further provides a remote printing authority control device, comprising: Define a module for setting up administrator accounts and shared accounts, and design corresponding data tables based on the administrator accounts and shared accounts, where the data tables contain user information, role information, and permission information; An acquisition module, used for acquiring the role information and permission information of the shared account based on the data table when the shared account sends a print request based on the HTTP interface; The permission determination module is used to determine whether the shared account has the printing access qualification based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information.
[0013] In a third aspect, the present invention further provides an electronic device, comprising: a processor and a memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the remote printing authority control method as described above are implemented.
[0014] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the remote printing permission control method as described above.
[0015] The beneficial effects of the present invention are as follows: firstly, an administrator account and a shared account are set, and corresponding data tables are designed according to the administrator account and the shared account, wherein the data tables contain user information, role information and permission information; complex user permission management and role allocation are supported by designing data tables to ensure the security and flexibility of the system, and then when the shared account sends a print request based on the HTTP interface, the role information and permission information of the shared account are obtained based on the data table; and based on the shared account role information, according to the corresponding relationship between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification. Thus, the purpose of ensuring the security and reliability of remote printing operations through the permission verification mechanism is achieved, and users are prevented from performing illegal operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A method flow chart of an embodiment of a remote printing authority control method provided by the present invention; Figure 2 for Figure 1 A method flow chart of an embodiment of step S103; Figure 3 is a schematic diagram of an embodiment of a remote printing authority control device provided by the present invention; Figure 4 It is a schematic diagram of the operating environment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0018] A specific embodiment of the present invention discloses a remote printing permission control method, please refer to Figure 1 ,include: S101, setting an administrator account, setting permissions for a shared account based on the administrator account, and designing corresponding data tables based on the administrator account and the shared account, wherein the data tables include user information, role information, and permission information; S102, when the shared account sends a print request based on the HTTP interface, obtaining the role information and permission information of the shared account based on the data table; S103: Based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information, determine whether the shared account has the printing access qualification.
[0019] In this embodiment, firstly, an administrator account and a shared account are set, and corresponding data tables are designed according to the administrator account and the shared account, wherein the data tables contain user information, role information and permission information; complex user permission management and role allocation are supported by designing data tables to ensure the security and flexibility of the system, and then when the shared account sends a print request based on the HTTP interface, the role information and permission information of the shared account are obtained based on the data table; and based on the shared account role information, according to the corresponding relationship between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification. Thus, the purpose of ensuring the security and reliability of remote printing operations through the permission verification mechanism is achieved, and users are prevented from performing illegal operations.
[0020] In step S101, the administrator account is a user with advanced permissions, and can create, delete and modify the accounts and permissions of other users. A shared account is a user that usually has limited permissions. In this embodiment, the number of shared accounts is not limited, and the permissions of each shared account may also be different.
[0021] In some embodiments, setting an administrator account includes: Initialize the user, and connect the initialized user and printer based on Bluetooth technology to complete the administrator verification; Compare the printer number and printer key to confirm that the administrator has been successfully authenticated and design the corresponding data table.
[0022] In this embodiment, the printer administrator setting process is as follows: User A (administrator) connects to the printer via APP Bluetooth and completes administrator verification. The system compares the printer number (such as D11-0000001) with the printer key to confirm that the verification is successful. User A is set as the administrator (admin) of the printer and written into the machine_user_role table.
[0023] Then proceed with data table design, including: User table (user): stores basic information of users; Role table (role): stores basic information of roles, such as role ID and name; Machine role table (machine_user_role): stores the role relationship between a user and a specific machine, including user ID, printer number, and role ID; Role privilege table (role_privilege): stores the relationship between roles and permissions, including role IDs and permission identifiers.
[0024] In some embodiments, the design data table includes: Design the user table for the administrator account and the shared account, where the user table includes the user information of the administrator account and the user information of the shared account; Design a machine role table for the administrator account and the shared account, where the machine role table includes a unique identifier associated with the administrator account and the shared account and the printer; Design a role rights and interests table for administrator accounts and shared accounts, where the role rights and interests table includes the rights and interests relationship between the administrator account and the shared account.
[0025] In this embodiment, the user table represents the primary key of the user, which uniquely identifies each user, including but not limited to the user's phone number, the user's email address, the user's password, the user's nickname, and the URL address of the user's avatar.
[0026] The role table is the primary key of the role, which uniquely identifies each role. The specific role names are such as "admin", "share".
[0027] The machine role table is the primary key of the record, uniquely identifying each machine role relationship, and is the unique identification code of the machine. user_id: The user ID associated with the machine. role_id: The role ID of the user on a specific machine In a specific embodiment, user management can manage the basic information of all users, including phone number, email address, password, nickname and avatar, through the user table. Role management can define different roles, such as admin and share, and assign different permissions to different roles through the role table. Machine role relationship can manage the role relationship between users and specific machines through the machine_user_role table to ensure that users can have different role permissions on different machines. Permission management can assign specific permissions to different roles through the role_privilege table, such as text printing, image printing, etc.
[0028] In some embodiments, the shared account role information is used to determine whether the shared account has the printing access qualification according to the corresponding relationship between the shared account permission information and the preset interface permission information. Figure 2 ,include: S201, obtaining user information of a shared account and obtaining a printer number; S202, searching a data table corresponding to the role information of the shared account according to the user information and the printer number, and determining the role information of the shared account on the printer; S203, querying a data table corresponding to the shared account authority information according to the role information of the shared account, and determining the shared account authority information; S204: Determine whether the shared account has print access qualifications based on the correspondence between the shared account permission information and the preset interface permission information.
[0029] In this example, add a custom annotation @RequiredPrivilege to the method that needs permission check, and specify the required permission identifier (such as @RequiredPrivilege("text_print")). Use Spring AOP (aspect-oriented programming) to perform permission check before method execution. The AOP aspect intercepts methods annotated with @RequiredPrivilege and performs permission check before executing these methods.
[0030] The client includes the Authorization field in the HTTP request header and passes the user's login credentials (usually a JWT Token). The backend parses the Token through the Spring Security framework and obtains user information (such as user ID).
[0031] Through the Token in the Authorization header, the backend service can obtain the detailed information of the currently logged-in user for subsequent permission verification. Extract machine_no from the request header, which represents the printer number of the remote operation. Query the machine_user_role table by the user ID and printer number to obtain the role of the current user on the printer (such as admin or share). Query the role_privilege table according to the role ID to obtain the permission set corresponding to the role. Compare the permissions required by the interface (specified by the @RequiredPrivilege annotation) with the user's permission set. If the permissions match, the printing operation is allowed. If the permissions do not match, intercept the request and return a permission error.
[0032] In a specific embodiment, user A connects to the printer via Bluetooth and completes administrator verification. The system associates the printer resource with user A and sets it as the admin user. User A invites user B and associates user B with the printer resource and sets it as a share user. User B will have specific permissions. User B initiates a print operation, and the system performs permission verification through the AOP aspect: if the permissions match, the print operation is allowed. If the permissions do not match, a permission error is returned. The HTTP request parameters are converted into printer protocol data (such as CPCL protocol) and sent to the corresponding printer through the MQTT server. User B calls the / api / remote / text / print interface to print text. Since user B has the text_print permission, the operation is successful. User B calls the / api / remote / text / batch / print interface to print text in batches. Since user B does not have the text_batch_print permission, the operation is intercepted. User B tries to print text on another printer (such as D11-0000002). Since user B does not have the permission for the machine, the operation is intercepted.
[0033] Based on the above remote printing permission control method, the embodiment of the present invention also provides a remote printing permission control device, see Figure 3 ,include: A definition module 310 is used to set an administrator account, set permissions for a shared account based on the administrator account, and design corresponding data tables according to the administrator account and the shared account, wherein the data tables include user information, role information, and permission information; The acquisition module 320 is used to acquire the role information and permission information of the shared account based on the data table when the shared account sends a print request based on the HTTP interface; The authority determination module 330 is used to determine whether the shared account has the printing access qualification based on the shared account role information and the corresponding relationship between the shared account authority information and the preset interface authority information.
[0034] like Figure 4 As shown, based on the above remote printing permission control method, the present invention also provides an electronic device, which can be a computing electronic device such as a mobile terminal, a desktop computer, a notebook, a palm computer, and a server. The electronic device includes a processor 410, a memory 420, and a display 430. Figure 4 Only some components of the electronic device are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0035] In some embodiments, the memory 420 may be an internal storage unit of the electronic device, such as a hard disk or memory of the electronic device. In other embodiments, the memory 420 may also be an external storage electronic device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the memory 420 may also include both an internal storage unit of the electronic device and an external storage electronic device. The memory 420 is used to store application software and various types of data installed in the electronic device, such as program codes for installing the electronic device. The memory 420 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a remote printing permission control program 440 is stored on the memory 420, and the remote printing permission control program 440 can be executed by the processor 410, thereby realizing the remote printing permission control method of each embodiment of the present application.
[0036] In some embodiments, the processor 410 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run program codes stored in the memory 420 or process data, such as executing a remote printing permission control method.
[0037] In some embodiments, the display 430 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 430 is used to display information on the remote printing authority control electronic device and to display a visual user interface. The components 410-430 of the electronic device communicate with each other via a system bus.
[0038] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0039] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A remote printing permission control method, characterized in that: include: Set up an administrator account, set permissions for shared accounts based on the administrator account, and design corresponding data tables based on the administrator account and shared account, where the data tables contain user information, role information, and permission information; When the shared account sends a print request based on the HTTP interface, the role information and permission information of the shared account are obtained based on the data table; Based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification.
2. The remote printing permission control method according to claim 1, characterized in that: The step of setting up an administrator account includes: Initialize the user, and connect the initialized user and printer based on Bluetooth technology to complete the administrator verification; Compare the printer number and printer key to confirm that the administrator has been successfully authenticated and design the corresponding data table.
3. The remote printing permission control method according to claim 1, characterized in that: The design data sheet includes: Design the user table for the administrator account and the shared account, where the user table includes the user information of the administrator account and the user information of the shared account; Design a machine role table for the administrator account and the shared account, where the machine role table includes a unique identifier associated with the administrator account and the shared account and the printer; Design a role rights and interests table for administrator accounts and shared accounts, where the role rights and interests table includes the rights and interests relationship between the administrator account and the shared account.
4. The remote printing permission control method according to claim 3, characterized in that: The rights and interests of the administrator account include at least: system setting permission, text printing permission, text batch printing permission, image printing permission, file printing permission, PDF file printing permission and sharing invitation permission.
5. The remote printing permission control method according to claim 3, characterized in that: The determining whether the shared account has the printing access qualification based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information includes: Get the user information of the shared account and the printer number; According to the user information and the printer number, a data table corresponding to the role information of the shared account is searched to determine the role information of the shared account on the printer; According to the role information of the shared account, query the data table corresponding to the shared account permission information to determine the shared account permission information; According to the correspondence between the shared account permission information and the preset interface permission information, it is determined whether the shared account has the printing access qualification.
6. The remote printing permission control method according to claim 5, characterized in that: The determining whether the shared account has the printing access qualification according to the correspondence between the shared account permission information and the preset interface permission information includes: Customize the annotations required for permission verification according to the permission verification method to determine the interface permission information; Use Spring AOP aspects for permission verification.
7. The remote printing permission control method according to claim 5, characterized in that: The obtaining of user information of the shared account and the obtaining of the printer number include: Parse user information from the Authorization header; Get the machine_no from the request header to determine the printer number.
8. A remote printing permission control device, characterized in that: include: Define a module for setting up an administrator account, setting permissions for shared accounts based on the administrator account, and designing corresponding data tables based on the administrator account and shared accounts, where the data tables contain user information, role information, and permission information; An acquisition module, used for acquiring the role information and permission information of the shared account based on the data table when the shared account sends a print request based on the HTTP interface; The permission determination module is used to determine whether the shared account has the printing access qualification based on the shared account role information and the corresponding relationship between the shared account permission information and the preset interface permission information.
9. An electronic device, characterized in that: include: Processor and memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the remote printing permission control method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the remote printing permission control method as described in any one of claims 1-7.
Citation Information
Patent Citations
Terminal device control method and system
CN105635297A
Access processing method and device
CN109147120A
Elevator safety control method and equipment based on Bluetooth
CN113003344A
Access authority control method and device
CN113239344A
Vehicle personalized permission customization method and system based on multiple users and vehicle
CN115361414A