User management method and device, electronic equipment and storage medium
By initializing the user manager object in an embedded terminal device, multiple communication interfaces and offline user management are realized, the problem that the device cannot use the user management function when network abnormalities are solved, ensuring the normal operation of the device.
Patent Information
- Application Number
- CN202411852801.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-16
AI Technical Summary
Embedded terminal devices cannot use user management functions when network conditions are abnormal, affecting the normal operation of the device.
Provided is a user management method, by initializing the user manager object, setting a user information list, a user identification list, a data memory object and at least one communication interface object, to realize multiple communication interface types and offline local user management functions.
In the case of network abnormalities, local user management function is supported to ensure normal operation of embedded devices.
Smart Images

Figure CN119892783A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a user management method, device, electronic device, and storage medium. Background Art
[0002] At present, embedded terminal devices, such as smart home devices, webcams, printers, network speakers, wearable devices, etc., often need to implement user management functions through remote servers such as smartphone applications and cloud servers, such as user login, user registration, user modification, etc., to ensure device security.
[0003] However, when network conditions are abnormal, the embedded terminal device cannot connect to the remote server and needs to communicate through other communication interfaces such as serial ports, Bluetooth, and direct data cable connections. However, since the user management function cannot be used, it is impossible to access files, peripherals, application functions, and other content or use functions that require user permissions, affecting the normal operation of the device. Summary of the invention
[0004] The present invention provides a user management method, device, electronic device and storage medium to solve the problem that when an abnormal network condition occurs, an embedded terminal device cannot use the user management function, cannot access content or use functions such as files, peripherals, and application functions that require user permissions, thereby affecting the normal operation of the device. The present invention realizes a local user management function that can support multiple communication interface types and offline, is adaptable to application scenarios with abnormal network conditions, and ensures the normal operation of embedded devices.
[0005] In a first aspect, an embodiment of the present application provides a user management method, including:
[0006] Initialize a user manager object, wherein the user manager object is provided with a user information list, a user identification list, a data storage object and at least one communication interface object;
[0007] The user manager object traverses and calls each communication interface object to determine whether the user operation data sent by the client is read;
[0008] When the first communication interface object among the communication interface objects is called to read the user operation data, the user operation data is parsed by the user manager object to obtain an operation code and user data;
[0009] In the case where the user operation corresponding to the operation code is a user registration operation, extracting a first user identifier from the user data through the user manager object, and checking whether the first user identifier is in a valid state; if it is determined that the first user identifier is in a valid state, extracting first user information from the user data through the user manager object, calling the data storage object to save the first user information, creating a first user information item according to the first user information, adding the first user information item to the user information list, and generating first operation result data, wherein the first operation result data carries a success flag;
[0010] The first operation result data is sent to the client by calling the first communication interface object through the user manager object, so that the client parses the first operation result data to obtain the first operation result, and outputs the first operation result.
[0011] Optionally, the initializing the user manager object includes:
[0012] Creating a user manager object, adding a pre-created user information list, a user identification list, a data storage object, and at least one communication interface object to the user manager object;
[0013] Detecting whether there is an initial administrator information item in the user information list, and if there is no initial administrator information item in the user information list, generating initial administrator information through the user manager object, wherein the initial administrator information includes an initial administrator name, an initial administrator password, and initial administrator authority data;
[0014] The data storage object is called by the user manager object to save the initial administrator information, and an initial administrator information item is created according to the initial administrator information, and the initial administrator information item is added to the user information list.
[0015] Optionally, before adding the pre-created user information list, user identification list, data storage object and at least one communication interface object to the user manager object, the method further includes:
[0016] Detecting a storage module of the embedded device, determining a currently set target storage module, and creating a data storage object corresponding to the target storage module;
[0017] Detecting the physical communication interface of the embedded device, determining at least one physical communication interface currently set, enabling the communication function corresponding to each of the physical communication interfaces, and creating a communication interface object corresponding to each of the communication functions;
[0018] Create a user information list and a user ID list.
[0019] Optionally, after the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes:
[0020] In the case where the user operation corresponding to the operation code is a login operation, extracting second user information from the user data through the user manager object, matching the second user information with an existing user information item in the user information list, generating a second user identifier when the second user information successfully matches a target user information item in the existing user information item, adding the second user identifier to the user identifier list, generating a login time based on the current system time, adding the second user identifier and the login time to the target user information item, and generating second operation result data, wherein the second operation result data carries a success flag and the second user identifier;
[0021] The user manager object calls the first communication interface object to send the second operation result data to the client, so that the client parses the second operation result data to obtain the second operation result, and outputs the second operation result.
[0022] Optionally, after the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes:
[0023] In the case where the user operation corresponding to the operation code is a logout operation, extracting a third user identifier from the user data through the user manager object, matching the third user identifier with an existing user identifier in the user identifier list, deleting the target user identifier from the user identifier list, and deleting the target user identifier and the corresponding login time from the user information list when the third user identifier successfully matches the target user identifier in the existing user identifier, generating third operation result data, wherein the third operation result data carries a success flag;
[0024] The user manager object calls the first communication interface object to send the third operation result data to the client, so that the client parses the third operation result data to obtain a third operation result, and outputs the third operation result.
[0025] Optionally, after the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes:
[0026] In the case where the user operation corresponding to the operation code is a user destroy operation, extracting a fourth user identifier from the user data through the user manager object, and checking whether the fourth user identifier is in a valid state; in the case where it is determined that the fourth user identifier is in a valid state, extracting a user name to be deregistered from the user data through the user manager object, deleting a corresponding target user data item from the user information list based on the user name to be deregistered, generating a destruction time based on the current system time, calling the data storage object to associate the destruction time with the user information corresponding to the user name to be deregistered, and generating fourth operation result data, wherein the fourth operation result data carries a success flag;
[0027] The user manager object calls the first communication interface object to send the fourth operation result data to the client, so that the client parses the fourth operation result data to obtain a fourth operation result, and outputs the fourth operation result.
[0028] Optionally, after the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes:
[0029] In the case where the user operation corresponding to the operation code is a user query operation, extracting a fifth user identifier from the user data through the user manager object, and checking whether the fifth user identifier is in a valid state; in the case where it is determined that the fifth user identifier is in a valid state and the user name to be queried is extracted from the user data through the user manager object, calling the data storage object to query the target user information corresponding to the user name to be queried, and generating fifth operation result data based on the target user information, the fifth operation result data carrying a success flag;
[0030] The user manager object calls the first communication interface object to send the fifth operation result data to the client, so that the client parses the fifth operation result data to obtain a fifth operation result, and outputs the fifth operation result.
[0031] Optionally, after the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes:
[0032] In the case where the user operation corresponding to the operation code is a modify user operation, extracting a sixth user identifier from the user data through the user manager object, and checking whether the sixth user identifier is in a valid state, and in the case where it is determined that the sixth user identifier is in a valid state, extracting a current login password, a target login password and target authority data from the user data, and comparing the current login password with the password of the second user information item corresponding to the sixth user identifier in the user information list, and in the case where the passwords are consistent, generating a modification time based on the current system time, and updating the second user information item based on the target login password, the target authority data and the modification time, and calling the data storage object to update the corresponding user information, and generating sixth operation result data;
[0033] The user manager object calls the first communication interface object to send the sixth operation result data to the client, so that the client parses the sixth operation result data to obtain a sixth operation result, and outputs the sixth operation result.
[0034] In a second aspect, an embodiment of the present application further provides a user management device, including:
[0035] an initialization unit configured to initialize a user manager object, wherein the user manager object is provided with a user information list, a user identification list, a data storage object, and at least one communication interface object;
[0036] A data reading unit, configured to traverse and call each communication interface object through the user manager object to determine whether the user operation data sent by the client is read;
[0037] a data parsing unit configured to parse the user operation data through the user manager object to obtain an operation code and user data when the first communication interface object among the communication interface objects is called to read the user operation data;
[0038] a registered user operation processing unit, configured to, when the user operation corresponding to the operation code is a registered user operation, extract a first user identifier from the user data through the user manager object, and check whether the first user identifier is in a valid state; when it is determined that the first user identifier is in a valid state, extract first user information from the user data through the user manager object, call the data storage object to save the first user information, create a first user information item according to the first user information, add the first user information item to the user information list, and generate first operation result data, wherein the first operation result data carries a success flag;
[0039] The operation result sending unit is configured to call the first communication interface object through the user manager object to send the first operation result data to the client, so that the client parses the first operation result data to obtain the first operation result and outputs the first operation result.
[0040] Optional, initialize the unit, the specific configuration is:
[0041] Creating a user manager object, adding a pre-created user information list, a user identification list, a data storage object, and at least one communication interface object to the user manager object;
[0042] Detecting whether there is an initial administrator information item in the user information list, and if there is no initial administrator information item in the user information list, generating initial administrator information through a user manager object, the initial administrator information including an initial administrator name, an initial administrator password, and initial administrator authority data;
[0043] The data storage object is called through the user manager object to save the initial administrator information, and the initial administrator information item is created according to the initial administrator information, and the initial administrator information item is added to the user information list.
[0044] Optionally, the user management device further includes an object creation unit configured to:
[0045] Detect the storage module of the embedded device, determine the currently set target storage module, and create a data storage object corresponding to the target storage module;
[0046] Detecting the physical communication interface of the embedded device, determining at least one physical communication interface currently set, enabling the communication function corresponding to each physical communication interface, and creating a communication interface object corresponding to each communication function;
[0047] Create a user information list and a user ID list.
[0048] Optionally, the user management device further includes a login operation processing unit configured to:
[0049] In the case where the user operation corresponding to the operation code is a login operation, extracting second user information from the user data through the user manager object, matching the second user information with an existing user information item in the user information list, generating a second user identifier in the case where the second user information successfully matches a target user information item in the existing user information item, adding the second user identifier to the user identifier list, generating a login time based on the current system time, adding the second user identifier and the login time to the target user information item, generating second operation result data, and the second operation result data carrying a success flag and the second user identifier;
[0050] The user manager object calls the first communication interface object to send the second operation result data to the client, so that the client parses the second operation result data to obtain the second operation result and outputs the second operation result.
[0051] Optionally, the user management device further includes a logout operation processing unit configured to:
[0052] In the case where the user operation corresponding to the operation code is a logout operation, extracting a third user identifier from the user data through the user manager object, matching the third user identifier with an existing user identifier in the user identifier list, deleting the target user identifier from the user identifier list, and deleting the target user identifier and the corresponding login time from the user information list when the third user identifier successfully matches the target user identifier in the existing user identifier, generating third operation result data, and the third operation result data carrying a success flag;
[0053] The user manager object calls the first communication interface object to send the third operation result data to the client, so that the client parses the third operation result data to obtain the third operation result, and outputs the third operation result.
[0054] Optionally, the user management device further includes a destruction user operation processing unit configured to:
[0055] In the case where the user operation corresponding to the operation code is a destroy user operation, extracting a fourth user identifier from user data through a user manager object, and checking whether the fourth user identifier is in a valid state; in the case where it is determined that the fourth user identifier is in a valid state, extracting a user name to be deregistered from user data through the user manager object, deleting a corresponding target user data item from a user information list based on the user name to be deregistered, generating a destruction time based on the current system time, calling a data storage object to associate the destruction time with the user information corresponding to the user name to be deregistered, and generating fourth operation result data, the fourth operation result data carrying a success flag;
[0056] The user manager object calls the first communication interface object to send the fourth operation result data to the client, so that the client parses the fourth operation result data to obtain the fourth operation result, and outputs the fourth operation result.
[0057] Optionally, the user management device further includes a query user operation processing unit configured to:
[0058] In the case where the user operation corresponding to the operation code is a user query operation, extracting a fifth user identifier from the user data through the user manager object, and checking whether the fifth user identifier is in a valid state; when it is determined that the fifth user identifier is in a valid state and the user name to be queried is extracted from the user data through the user manager object, calling the data storage object to query the target user information corresponding to the user name to be queried, and generating fifth operation result data based on the target user information, the fifth operation result data carrying a success flag;
[0059] The user manager object calls the first communication interface object to send the fifth operation result data to the client, so that the client parses the fifth operation result data to obtain the fifth operation result, and outputs the fifth operation result.
[0060] Optionally, the user management device further includes a user operation modification processing unit configured to:
[0061] In the case where the user operation corresponding to the operation code is a modify user operation, extract the sixth user identification from the user data through the user manager object, and check whether the sixth user identification is in a valid state. When it is determined that the sixth user identification is in a valid state, extract the current login password, the target login password and the target authority data from the user data, compare the current login password with the password of the second user information item corresponding to the sixth user identification in the user information list, and when the passwords are consistent, generate the modification time based on the current system time, update the second user information item based on the target login password, the target authority data and the modification time, call the data storage object to update the corresponding user information, and generate the sixth operation result data;
[0062] The user manager object calls the first communication interface object to send the sixth operation result data to the client, so that the client parses the sixth operation result data to obtain the sixth operation result, and outputs the sixth operation result.
[0063] In a third aspect, an embodiment of the present application further provides an electronic device, including:
[0064] one or more processors;
[0065] a memory for storing one or more computer programs;
[0066] When one or more computer programs are executed by one or more processors, the electronic device implements any method of the first aspect.
[0067] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any method of the first aspect.
[0068] In the above, by initializing the user manager object, the user manager object is provided with a user information list, a user identification list, a data storage object and at least one communication interface object; the user manager object is used to traverse and call each communication interface object to determine whether the user operation data sent by the client is read; in the case where the first communication interface object among the communication interface objects is called to read the user operation data, the user operation data is parsed by the user manager object to obtain an operation code and user data; in the case where the user operation corresponding to the operation code is a registered user operation, the first user identification is extracted from the user data by the user manager object, and it is checked whether the first user identification is in a valid state. In the case where it is determined that the first user identification is in a valid state, the first user information is extracted from the user data by the user manager object, the data storage object is called to save the first user information, a first user information item is created according to the first user information, the first user information item is added to the user information list, and first operation result data is generated, and the first operation result data carries a success flag; the first communication interface object is called by the user manager object to send the first operation result data to the client, so that the client parses the first operation result data to obtain the first operation result, and outputs the first operation result. In the above scheme, by initializing the user manager object, the user operation data of different communication interfaces can be read, and the user operation data can be processed according to the user operation type, the relevant processing flow of user management can be executed, and the operation results can be fed back to the client. It can support multiple communication interface types and offline local user management functions, adapt to application scenarios with network abnormalities, and ensure the normal operation of embedded devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 A flowchart of a user management method provided in an embodiment of the present application.
[0070] Figure 2 A flowchart of a specific implementation process of initializing a user manager object provided in an embodiment of the present application.
[0071] Figure 3 A flowchart of a specific implementation process of creating a data storage object, a communication interface object, a user information list and a user identification list provided in an embodiment of the present application.
[0072] Figure 4 A flowchart of a specific implementation process for processing a user login operation and returning relevant result data provided in an embodiment of the present application.
[0073] Figure 5 A flowchart of a specific implementation process for processing a logout operation and returning relevant result data provided in an embodiment of the present application.
[0074] Figure 6 A flowchart of a specific implementation process for processing and destroying user operations and returning related result data provided in an embodiment of the present application.
[0075] Figure 7 A flowchart of a specific implementation process for processing query user operations and returning relevant result data provided in an embodiment of the present application.
[0076] Figure 8 A flowchart of a specific implementation process for processing and modifying user operations and returning related result data provided in an embodiment of the present application.
[0077] Fig. 9 A schematic diagram of the structure of a user management device provided in an embodiment of the present application.
[0078] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0080] It should be noted that due to space limitations, this application description does not list all optional implementation methods. After reading this application description, those skilled in the art should be able to understand that as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0081] Figure 1 A flowchart of a user management method provided in an embodiment of the present application, the user management method is applied to an embedded device, such as Figure 1 As shown, the following steps are included:
[0082] Step S101: Initialize a user manager object, which is provided with a user information list, a user identification list, a data storage object and at least one communication interface object.
[0083] Among them, the user manager object can be a software object that implements the user management function. The user manager object can be used to perform the following functions: 1. Call the communication interface object to receive and parse the user operation data corresponding to the user operation, such as login operation, registration operation, etc., and reply the operation result data. 2. Manage the user ID, assign a unique user ID when the user logs in, and the user ID will be added to the user ID list and bound to the user information. 3. Manage the user login status, such as login timeout, etc. 4. Call the data storage object to read and write the user information. 5. Manage the user information, create a user information item according to the user information, and add the user information item to the user information list. If the user information is modified, the data storage object can be called to update the user information. 6. If there is a networkable communication interface, the user information can be synchronized to the remote server. The user information list can be used to store user information items. Each registered user can generate a corresponding user information item. The user information item can include persistent information and temporary information. The persistent information needs to call the data storage object to store it on the hard disk. The temporary information is only used in the memory and will be lost after the device is powered off. The persistent information includes user name, user password, user authority data, user creation time, user modification time, user destruction time, etc., wherein the user name is the user account used when the user logs in, and the user is not allowed to modify the user name after registration; the user password is the login password, which can be modified by the user; the user authority data describes all the user's operable permissions, and the user needs to use the user authority data to determine the operation permission before performing an operation. If there is no permission, the operation cannot be performed, and the user right data is allowed to be modified. Temporary information includes user identification and login time, wherein the user identification is the identification assigned when the user logs in successfully, and the login time is the timestamp saved when the user logs in successfully, which is used to determine whether the user login has expired. The data storage object is an abstract object, which can provide a unified persistent data reading, writing and deleting interface for reading and persistently saving user data. The communication interface object is an abstract object, which can provide a unified binary data sending and receiving interface for data interaction between the client and the embedded device, and also provides a unified judgment interface for whether it can be connected to the network for accessing the remote server.
[0084] In an optional embodiment, a specific implementation process of initializing a user manager object is described, please refer to Figure 2 , which is a flowchart of a specific implementation process of initializing a user manager object provided by an embodiment of the present application, such as Figure 2 As shown, the specific implementation steps for initializing the user manager object are as follows:
[0085] Step S201: Create a user manager object, and add a pre-created user information list, a user identification list, a data storage object, and at least one communication interface object to the user manager object.
[0086] In a specific implementation, please refer to Figure 3 , which is a flowchart of a specific implementation process of creating a data storage object, a communication interface object, a user information list and a user identification list provided by an embodiment of the present application. Before adding the pre-created user information list, user identification list, data storage object and at least one communication interface object to the user manager object, such as Figure 3 As shown, the following steps are also included:
[0087] Step S301: Detect the storage module of the embedded device, determine the currently set target storage module, and create a data storage object corresponding to the target storage module.
[0088] Among them, since the embedded device may use different storage modules, for example, it may be a file module, a FLASH module, an EEPROM module, etc., it is necessary to detect the currently set target storage module and create a data storage object corresponding to the target storage module to facilitate the operation of the corresponding storage module.
[0089] Step S302: Detect the physical communication interface of the embedded device, determine at least one physical communication interface currently set, enable the communication function corresponding to each physical communication interface, and create a communication interface object corresponding to each communication function.
[0090] It should be noted that the detection of the physical communication interface of the embedded device can determine the communication interface of the embedded device. In a specific implementation, if it is detected that the embedded device has a serial port, the specific process of enabling the communication function corresponding to the serial port can be: open the serial port, and set the baud rate and other parameters of the serial port to enable the serial port communication function normally. Then, create a communication interface object corresponding to the serial port communication function, and use the read and write functions of the serial port to send and receive data normally. In a specific implementation, if it is detected that the embedded device has a network port, the specific process of enabling the communication function corresponding to the network port can be: create a TCP socket object, set it as a TCP server function and listen to a specified port number. Whenever the TCP server listens to a TCP client connection, it can generate a corresponding socket object to enable the network port communication function normally. Then, create a communication interface object corresponding to the network port communication function, and use the read and write functions of the network port to send and receive data normally. In a specific implementation, if it is detected that the embedded device has a Bluetooth module, the specific process of enabling the corresponding communication function of Bluetooth can be: enabling the broadcast function of the Bluetooth module, and setting the connection pairing mode of Bluetooth to Just Works, that is, the IO capability is no input and no output, and then waiting for the target device to initiate scanning and connection, so as to enable the Bluetooth communication function normally after successfully establishing the connection. Then, create a communication interface object corresponding to the Bluetooth communication function, and use the Bluetooth read and write functions normally to send and receive data.
[0091] Step S303: Create a user information list and a user identification list.
[0092] As described above, by creating a data storage object, a communication interface object, a user information list and a user identification list, an operation object for executing the user management function can be provided for the user manager object, thereby ensuring that the embedded device executes the user management function normally.
[0093] Step S202: Detect whether there is an initial administrator information item in the user information list. If there is no initial administrator information item in the user information list, generate initial administrator information through the user manager object. The initial administrator information includes the initial administrator name, initial administrator password and initial administrator authority data.
[0094] Among them, since the initial administrator account may not exist when the user manager object is run before leaving the factory, after adding the user information list, it is necessary to determine whether there is an initial administrator information item in the user information list. If the initial administrator information item does not exist, it is necessary to generate the initial administrator information to provide the user with an administrator account with user management permissions such as registering users, destroying users, and modifying users.
[0095] Step S203: calling the data storage object through the user manager object to save the initial administrator information, creating an initial administrator information item according to the initial administrator information, and adding the initial administrator information item to the user information list.
[0096] Among them, the initial administrator information can be read by the supplier from the embedded device when the device leaves the factory and recorded in a document or physical label. After the target user obtains the initial administrator information through the document or physical label, he can perform user operations such as ordinary administrator account creation, ordinary account registration, and destruction based on the initial administrator information.
[0097] As described above, by creating a user manager object and correspondingly adding a user information list, a user identification list, a data storage object and at least one communication interface object, the construction of the user management function can be realized. By generating the initial administrator information, it can be convenient for the user to subsequently log in to the initial administrator account based on the initial administrator information and perform related user management operations.
[0098] Step S102: traverse and call each communication interface object through the user manager object to determine whether the user operation data sent by the client is read.
[0099] It should be noted that after the user manager object is initialized, each communication interface object can be traversed and called through the user manager object. The order of traversal can be achieved by presetting the traversal priority of different communication interface objects. By calling the communication interface object, it can be determined whether the physical communication interface has received the user operation data sent by the client. The physical communication interface corresponding to the communication interface object can be based on a serial port, Bluetooth, network port, WIFI, etc. Due to a weak network or no network, the client may use a non-networked physical communication interface to transmit user operation data. Therefore, it is necessary to confirm whether the user operation data has been received by calling the communication interface objects one by one.
[0100] Step S103: When the first communication interface object among the communication interface objects is called to read the user operation data, the user operation data is parsed by the user manager object to obtain an operation code and user data.
[0101] Among them, if the first communication interface object among the communication interface objects is called to read the user operation data during the traversal process, the read user operation data can be processed and the data processing result can be returned in the original path. It should be noted that the user operation data and operation result data interacting between the client and the embedded device can adopt a unified data format. For example, the data format may include a frame header, an operation code, a data length, user data and a check bit. The frame header may be a fixed value used to indicate the beginning of the data; the operation code is used to indicate a specific user management operation, such as registering a user, destroying a user, modifying a user, logging in, logging out, querying user information, etc.; the data length is used to identify the length of the user data; the user data may be related information corresponding to different user management operations. For example, if it is a registered user operation, the user data needs to include user identification, user name, user password and user permission number. The data needs to include the operation rights of the registered user; if it is a user destruction operation, the user data needs to include the user ID, the current login password and the username to be deregistered, and the user rights data needs to include the operation rights of the destroyed user; if it is a user modification operation, the user data needs to include the user ID, the current login password, the target login password and the target authority data; if it is a user login operation, the user data needs to include the user ID and the user password; if it is a logout operation, the user data needs to include the user ID; if it is a query user operation, the user data needs to include the user ID; the check bit is used to perform a check from the "operation code" to the "user data" field to verify that there is no transmission error in the data. Therefore, the user operation data can be parsed based on the aforementioned data format to obtain the operation code and user data. Of course, developers can also customize other data formats according to the needs of actual application scenarios, which are not limited in this application.
[0102] Step S104: When the user operation corresponding to the operation code is a user registration operation, the first user identifier is extracted from the user data through the user manager object, and it is checked whether the first user identifier is in a valid state. When it is determined that the first user identifier is in a valid state, the first user information is extracted from the user data through the user manager object, the data storage object is called to save the first user information, a first user information item is created according to the first user information, the first user information item is added to the user information list, and first operation result data is generated, and the first operation result data carries a success flag.
[0103] It should be noted that the registered user operation requires the user to log in using an administrator account and have the corresponding operation authority, so it is necessary to first extract the first user identifier from the user data, check whether the first user identifier is in a valid state, that is, confirm whether the user has logged in and the login time has not expired, and whether it has the operation authority of the registered user. If the first user identifier is in a valid state, it can be regarded as the user logging in normally and having the operation authority of the registered user. Therefore, the first user information can be further extracted from the user data, and the first user information can include relevant information of the registered user, such as user name, user password, user authority data, etc. The first user information can be saved by calling the data storage object through the user manager object, and the corresponding first user information item created can be added to the user information list. Thus, when the first user identifier is verified to be valid and the user is successfully created, the first operation result data replied can carry a success flag. Optionally, when the first user identifier is verified to be invalid, the user cannot be created, and the corresponding first operation result data can carry a failure flag and a description of the failure reason, such as the first user identifier is invalid, the first user identifier has no registered user authority, etc.
[0104] In an optional embodiment, a specific implementation process of processing a user login operation and returning relevant result data is described, please refer to Figure 4 , which is a flowchart of a specific implementation process of processing a user login operation and returning relevant result data provided by an embodiment of the present application. After the user operation data is parsed by the user manager object to obtain the operation code and user data, as shown in FIG. Figure 4 As shown, the following steps are included:
[0105] Step S401: when the user operation corresponding to the operation code is a login operation, extract the second user information from the user data through the user manager object, match the second user information with the existing user information items in the user information list, and when the second user information successfully matches the target user information items in the existing user information items, generate a second user identifier, add the second user identifier to the user identifier list, generate a login time based on the current system time, add the second user identifier and the login time to the target user information item, and generate second operation result data, which carries a success flag and the second user identifier.
[0106] It should be noted that the user login operation needs to confirm whether the relevant information of the user has been stored. Therefore, it is necessary to extract the second user information from the user data. The second user information may include a user name and a user password, and the second user information is compared and matched with the existing user information items in the user information list. If the target user information item is matched, a second user identifier can be assigned accordingly. The second user identifier can be used to indicate the user identity after the user logs in, for example, a common user, an administrator, etc., and then the second user identifier and the login time are added to the target user information item to facilitate subsequent identity matching. Therefore, in the case where the second user information is matched successfully, the second operation result data replied can carry a success flag and a second user identifier, so that the client can subsequently perform other user management operations after successful login based on the second user identifier. Optionally, in the case where the second user information cannot be matched successfully, the login cannot be completed, and the corresponding second operation result data can carry a failure flag and a description of the failure reason, for example, the user is not registered or the user password is wrong.
[0107] Step S402: calling the first communication interface object through the user manager object to send the second operation result data to the client, so that the client parses the second operation result data to obtain the second operation result, and outputs the second operation result.
[0108] As described above, by calling the first communication interface object through the user manager object to return the second operation result data to the client, the client can parse the second operation result data to confirm whether its user login operation is successful and display the second operation result to the user.
[0109] In an optional embodiment, a specific implementation process for processing a logout operation and returning relevant result data is described. Please refer to Figure 5 , which is a flowchart of a specific implementation process of processing a logout operation and returning relevant result data provided by an embodiment of the present application. After the user operation data is parsed by the user manager object to obtain the operation code and user data, as shown in FIG. Figure 5 As shown, the following steps are included:
[0110] Step S501: When the user operation corresponding to the operation code is a logout operation, a third user identifier is extracted from the user data through the user manager object, and the third user identifier is matched with an existing user identifier in the user identifier list. When the third user identifier successfully matches the target user identifier in the existing user identifier, the target user identifier is deleted from the user identifier list, and the target user identifier and the corresponding login time are deleted from the user information list, and third operation result data is generated, and the third operation result data carries a success flag.
[0111] It should be noted that, since a user ID will be assigned when processing a user login operation, when processing a logout operation, it is necessary to determine whether the user ID exists in the user ID list to determine whether the user has logged in. Therefore, the third user ID is extracted from the user data through the user manager object, and matched with the existing user IDs in the user ID list. If the target user ID is successfully matched, it can be regarded as the user is currently logged in, and it can be deleted from the user ID list, and the target user ID and the corresponding login time that are also associated and stored in the user information list are correspondingly deleted to achieve the purpose of clearing the user login record. Therefore, in the case where the third user ID is matched successfully, after the third user ID and the corresponding login time are successfully cleared, the replied third operation result data can carry a success flag. Optionally, in the case where the third user ID cannot be matched successfully, the corresponding second operation result data can carry a failure flag and a description of the failure reason, for example, the third user ID is invalid.
[0112] Step S502: calling the first communication interface object through the user manager object to send the third operation result data to the client, so that the client parses the third operation result data to obtain the third operation result, and outputs the third operation result.
[0113] As described above, by calling the first communication interface object through the user manager object to return the third operation result data to the client, the client can parse the third operation result data to confirm whether its logout operation is successful and display the third operation result to the user.
[0114] In an optional embodiment, a specific implementation process of processing a destroy user operation and returning relevant result data is described, please refer to Figure 6 , which is a flowchart of a specific implementation process of processing and returning relevant result data for destroying user operations provided by an embodiment of the present application. After the user operation data is parsed by the user manager object to obtain the operation code and user data, as shown in FIG. Figure 6 As shown, the following steps are included:
[0115] Step S601: When the user operation corresponding to the operation code is a user destruction operation, a fourth user identifier is extracted from user data through the user manager object, and it is checked whether the fourth user identifier is in a valid state. When it is determined that the fourth user identifier is in a valid state, the user name to be deregistered is extracted from user data through the user manager object, and the corresponding target user data item is deleted from the user information list based on the user name to be deregistered, and a destruction time is generated based on the current system time. The data storage object is called to associate the destruction time with the user information corresponding to the user name to be deregistered, and fourth operation result data is generated, and the fourth operation result data carries a success flag.
[0116] It should be noted that the operation of destroying a user requires the user to log in with an administrator account and have the corresponding operation authority. Therefore, it is necessary to first extract the fourth user identifier from the user data and check whether the fourth user identifier is in a valid state, that is, to confirm whether the user has logged in and the login time has not expired, and whether it has the operation authority to destroy the user. If the fourth user identifier is in a valid state, it can be regarded as the user logging in normally and having the operation authority to destroy the user. Therefore, the user name to be deregistered can continue to be extracted from the user data. Optionally, in order to ensure information security, the current login password can also be extracted from the user data, and the user manager object calls the data storage object to query and determine the corresponding user password based on the fourth user identifier, and compares whether the two are consistent. If the comparison is consistent, the operation of destroying the user can continue to be executed. In addition, after extracting the user name to be deregistered, the target user data item corresponding to the user information list can be deleted based on the user name to be deregistered, and a destruction time can be generated based on the current system time. The data storage object is called to associate and store the destruction time with the user information corresponding to the user name to be deregistered. It is worth noting that the user destruction operation only deletes the data in the user information list, but still stores the complete user information for synchronizing the data to the remote server when the network is subsequently restored, so that the remote server can confirm that there is no need to synchronize the user information with the destruction time. Therefore, when the fourth user identifier is verified to be valid, after the target user data item is deleted, the replied first operation result data can carry a success flag. Optionally, when the fourth user identifier is verified to be invalid, the user cannot be destroyed, and the corresponding first operation result data can carry a failure flag and a description of the reason for the failure, for example, the fourth user identifier is invalid, the user name to be deregistered does not exist, etc.
[0117] Step S602: calling the first communication interface object through the user manager object to send the fourth operation result data to the client, so that the client parses the fourth operation result data to obtain the fourth operation result, and outputs the fourth operation result.
[0118] As described above, by calling the first communication interface object through the user manager object to return the fourth operation result data to the client, the client can parse the fourth operation result data to confirm whether its destroy user operation is successful and display the fourth operation result to the user.
[0119] In an optional embodiment, a specific implementation process of processing a query user operation and returning relevant result data is described, please refer to Figure 7 , which is a flowchart of a specific implementation process of processing query user operations and returning relevant result data provided by an embodiment of the present application. After the user operation data is parsed by the user manager object to obtain the operation code and user data, as shown in FIG. Figure 7 As shown, the following steps are included:
[0120] Step S701: When the user operation corresponding to the operation code is a user query operation, the fifth user identifier is extracted from the user data through the user manager object, and it is checked whether the fifth user identifier is in a valid state. When it is determined that the fifth user identifier is in a valid state and the user name to be queried is extracted from the user data through the user manager object, the data storage object is called to query the target user information corresponding to the user name to be queried, and fifth operation result data is generated based on the target user information. The fifth operation result data carries a success flag.
[0121] It should be noted that the query user operation requires the user to log in using an administrator account and have the corresponding operation authority, so it is necessary to first extract the fifth user identifier from the user data, check whether the fifth user identifier is in a valid state, that is, confirm whether the user has logged in and the login time has not expired, and whether it has the operation authority to query the user. If the fifth user identifier is in a valid state, it can be regarded as the user logging in normally and having the operation authority to query the user. Therefore, the user name to be queried can continue to be extracted from the user data. If the user name to be queried can be extracted from the user data through the user manager object, the data storage object can be called to query the target user information corresponding to the user name to be queried, and the fifth operation result data can be generated based on the target user information. Optionally, in order to ensure information security, it can be determined whether the user name to be queried is the user name associated with the fifth user identifier. If so, the corresponding fifth operation result data is generated and fed back to the client. If not, it is checked whether the fifth user identifier has the authority to query other people's information. If so, the corresponding fifth operation result data is generated and fed back to the client. Optionally, if the user name to be queried cannot be extracted from the user data through the user manager object, it is possible to continue to check whether the fifth user identifier has the authority to query all users. If so, all user information is queried by calling the data storage object, and the corresponding fifth operation result data is generated and fed back to the client. Thus, when the fifth user identifier is verified to be valid, after the relevant user information is queried, the replied fifth operation result data may include the relevant user information and a success flag. Optionally, when the fifth user identifier is verified to be invalid, the user cannot be queried, and the corresponding fifth operation result data may carry a failure flag and a description of the failure reason, for example, the fifth user identifier is invalid, etc.
[0122] Step S702: calling the first communication interface object through the user manager object to send the fifth operation result data to the client, so that the client parses the fifth operation result data to obtain the fifth operation result, and outputs the fifth operation result.
[0123] As mentioned above, by calling the first communication interface object through the user manager object to return the fifth operation result data to the client, the client can parse the fifth operation result data to confirm whether its query user operation is successful, and display the fifth operation result to the user, including the user information expected to be queried.
[0124] In an optional embodiment, a specific implementation process of processing and modifying user operations and returning relevant result data is described, please refer to Figure 8 , which is a flowchart of a specific implementation process of processing and modifying user operations and returning related result data provided by an embodiment of the present application. After the user operation data is parsed by the user manager object to obtain the operation code and user data, as shown in FIG. Figure 8 As shown, the following steps are included:
[0125] Step S801: When the user operation corresponding to the operation code is a modify user operation, the sixth user identifier is extracted from the user data through the user manager object, and it is checked whether the sixth user identifier is in a valid state. When it is determined that the sixth user identifier is in a valid state, the current login password, the target login password and the target authority data are extracted from the user data, and the current login password is compared with the password of the second user information item corresponding to the sixth user identifier in the user information list. When the passwords are consistent, the modification time is generated based on the current system time, and the second user information item is updated based on the target login password, the target authority data and the modification time, and the data storage object is called to update the corresponding user information to generate the sixth operation result data.
[0126] It should be noted that the modification of the user operation requires the user to log in with an administrator account and have the corresponding operation authority, so it is necessary to first extract the sixth user identifier from the user data, check whether the sixth user identifier is in a valid state, that is, confirm whether the user has logged in and the login time has not expired, and whether it has the operation authority to modify the user. If the sixth user identifier is in a valid state, it can be regarded as the user logging in normally and having the operation authority to modify the user. Therefore, the current login password, the target login password and the target authority data can be further extracted from the user data, and it can be determined whether the current login password is consistent with the password of the original second user information item. If the password comparison is consistent, it can be regarded as passing the password verification. Then, the second user information item and the stored user information in the user information list can be updated respectively based on the modification time, the target login password and the target authority data, so as to achieve the purpose of modifying the user information. Therefore, when the sixth user identifier is verified to be valid, after modifying the relevant user information, the sixth operation result data replied can carry a success mark. Optionally, when the sixth user identifier is verified to be invalid, the user cannot be modified, and the corresponding sixth operation result data can carry a failure mark and a description of the failure reason, for example, the sixth user identifier is invalid.
[0127] Step S802: calling the first communication interface object through the user manager object to send the sixth operation result data to the client, so that the client parses the sixth operation result data to obtain the sixth operation result, and outputs the sixth operation result.
[0128] As mentioned above, by calling the first communication interface object through the user manager object to return the sixth operation result data to the client, the client can parse the sixth operation result data to confirm whether its query user operation is successful, and display the sixth operation result to the user, including the user information expected to be queried.
[0129] Step S105: calling the first communication interface object through the user manager object to send the first operation result data to the client, so that the client parses the first operation result data to obtain the first operation result, and outputs the first operation result.
[0130] Among them, by calling the first communication interface object through the user manager object to return the first operation result data to the client, the client can parse the first operation result data to confirm whether its user registration operation is successful and display the first operation result to the user.
[0131] In the above, by initializing the user manager object, the user manager object is provided with a user information list, a user identification list, a data storage object and at least one communication interface object; the user manager object is used to traverse and call each communication interface object to determine whether the user operation data sent by the client is read; in the case where the first communication interface object among the communication interface objects is called to read the user operation data, the user operation data is parsed by the user manager object to obtain an operation code and user data; in the case where the user operation corresponding to the operation code is a registered user operation, the first user identification is extracted from the user data by the user manager object, and it is checked whether the first user identification is in a valid state. In the case where it is determined that the first user identification is in a valid state, the first user information is extracted from the user data by the user manager object, the data storage object is called to save the first user information, a first user information item is created according to the first user information, the first user information item is added to the user information list, and first operation result data is generated, and the first operation result data carries a success flag; the first communication interface object is called by the user manager object to send the first operation result data to the client, so that the client parses the first operation result data to obtain the first operation result, and outputs the first operation result. In the above scheme, by initializing the user manager object, the user operation data of different communication interfaces can be read, and the user operation data can be processed according to the user operation type, the relevant processing flow of user management can be executed, and the operation results can be fed back to the client. It can support multiple communication interface types and offline local user management functions, adapt to application scenarios with network abnormalities, and ensure the normal operation of embedded devices.
[0132] In addition, it is worth noting that the client can interact with the user by providing an input and output interface, package the user operation data, and send it to the embedded device using a communication interface. The client sends the user operation data to the embedded device by using the communication interface, and then uses the communication interface to receive the operation result data. When the user wants to perform a login operation, the client can provide an input box for the user to enter the account password, and the client generates the user operation data according to the preset data format, and can send the user operation data to the embedded device for processing using the communication interface, and then use the communication interface to receive the operation result data, and judge whether the operation result is successful or failed. If successful, the user identification can be obtained, and the operation result and the user identification are displayed to the user. Of course, other operations can be performed by other users, and this application will not be repeated here. For the user, when using it for the first time, the initial administrator account is used for the login operation. After the login is successful, the initial administrator password must be modified. Then register a new user account. When registering a new user account, it is necessary to carry the user name, password, and permission data. When the new user account logs in successfully, the result data will carry the user identification, and the client will record the user identification for subsequent application operations of the embedded device, for example, enabling the application function of the embedded device, and performing data reading and writing operations on the embedded device.
[0133] Fig. 9 A schematic diagram of the structure of a user management device provided in an embodiment of the present application. Fig. 9 As shown, the user management device includes an initialization unit 110 , a data reading unit 120 , a data parsing unit 130 , a registered user operation processing unit 140 and an operation result sending unit 150 .
[0134] The initialization unit 110 is configured to initialize a user manager object, wherein the user manager object is provided with a user information list, a user identification list, a data storage object and at least one communication interface object;
[0135] The data reading unit 120 is configured to traverse and call each communication interface object through the user manager object to determine whether the user operation data sent by the client is read;
[0136] The data parsing unit 130 is configured to parse the user operation data through the user manager object to obtain an operation code and user data when the first communication interface object among the communication interface objects is called to read the user operation data;
[0137] The registered user operation processing unit 140 is configured to, when the user operation corresponding to the operation code is a registered user operation, extract the first user identifier from the user data through the user manager object, and check whether the first user identifier is in a valid state; when it is determined that the first user identifier is in a valid state, extract the first user information from the user data through the user manager object, call the data storage object to save the first user information, create a first user information item according to the first user information, add the first user information item to the user information list, and generate first operation result data, the first operation result data carrying a success flag;
[0138] The operation result sending unit 150 is configured to send the first operation result data to the client by calling the first communication interface object through the user manager object, so that the client parses the first operation result data to obtain the first operation result and outputs the first operation result.
[0139] In the above scheme, by initializing the user manager object, the user operation data of different communication interfaces can be read, and the user operation data can be processed according to the user operation type, the relevant processing flow of user management can be executed, and the operation results can be fed back to the client. It can support multiple communication interface types and offline local user management functions, adapt to application scenarios with network abnormalities, and ensure the normal operation of embedded devices.
[0140] Based on the above embodiment, the initialization unit 110 is specifically configured as follows:
[0141] Creating a user manager object, adding a pre-created user information list, a user identification list, a data storage object, and at least one communication interface object to the user manager object;
[0142] Detect whether there is an initial administrator information item in the user information list. If there is no initial administrator information item in the user information list, generate initial administrator information through the user manager object. The initial administrator information includes the initial administrator name, initial administrator password and initial administrator authority data.
[0143] The data storage object is called through the user manager object to save the initial administrator information, and the initial administrator information item is created according to the initial administrator information, and the initial administrator information item is added to the user information list.
[0144] Based on the above embodiment, it further includes an object creation unit configured as follows:
[0145] Detect the storage module of the embedded device, determine the currently set target storage module, and create a data storage object corresponding to the target storage module;
[0146] Detecting the physical communication interface of the embedded device, determining at least one physical communication interface currently set, enabling the communication function corresponding to each physical communication interface, and creating a communication interface object corresponding to each communication function;
[0147] Create a user information list and a user ID list.
[0148] Based on the above embodiment, it further includes a login operation processing unit configured as follows:
[0149] In the case where the user operation corresponding to the operation code is a login operation, extracting second user information from the user data through the user manager object, matching the second user information with an existing user information item in the user information list, generating a second user identifier in the case where the second user information successfully matches a target user information item in the existing user information item, adding the second user identifier to the user identifier list, generating a login time based on the current system time, adding the second user identifier and the login time to the target user information item, generating second operation result data, and the second operation result data carrying a success flag and the second user identifier;
[0150] The user manager object calls the first communication interface object to send the second operation result data to the client, so that the client parses the second operation result data to obtain the second operation result and outputs the second operation result.
[0151] Based on the above embodiment, it further includes a logout operation processing unit configured as follows:
[0152] In the case where the user operation corresponding to the operation code is a logout operation, extracting a third user identifier from the user data through the user manager object, matching the third user identifier with an existing user identifier in the user identifier list, deleting the target user identifier from the user identifier list, and deleting the target user identifier and the corresponding login time from the user information list when the third user identifier successfully matches the target user identifier in the existing user identifier, generating third operation result data, and the third operation result data carrying a success flag;
[0153] The user manager object calls the first communication interface object to send the third operation result data to the client, so that the client parses the third operation result data to obtain the third operation result, and outputs the third operation result.
[0154] On the basis of the above embodiment, it further includes destroying the user operation processing unit, which is configured as follows:
[0155] In the case where the user operation corresponding to the operation code is a destroy user operation, extracting a fourth user identifier from user data through a user manager object, and checking whether the fourth user identifier is in a valid state; in the case where it is determined that the fourth user identifier is in a valid state, extracting a user name to be deregistered from user data through the user manager object, deleting a corresponding target user data item from a user information list based on the user name to be deregistered, generating a destruction time based on the current system time, calling a data storage object to associate the destruction time with the user information corresponding to the user name to be deregistered, and generating fourth operation result data, the fourth operation result data carrying a success flag;
[0156] The user manager object calls the first communication interface object to send the fourth operation result data to the client, so that the client parses the fourth operation result data to obtain the fourth operation result, and outputs the fourth operation result.
[0157] Based on the above embodiment, it further includes a query user operation processing unit configured as follows:
[0158] In the case where the user operation corresponding to the operation code is a user query operation, extracting a fifth user identifier from the user data through the user manager object, and checking whether the fifth user identifier is in a valid state; when it is determined that the fifth user identifier is in a valid state and the user name to be queried is extracted from the user data through the user manager object, calling the data storage object to query the target user information corresponding to the user name to be queried, and generating fifth operation result data based on the target user information, the fifth operation result data carrying a success flag;
[0159] The user manager object calls the first communication interface object to send the fifth operation result data to the client, so that the client parses the fifth operation result data to obtain the fifth operation result, and outputs the fifth operation result.
[0160] On the basis of the above embodiment, the user operation processing unit is further modified and configured as follows:
[0161] In the case where the user operation corresponding to the operation code is a modify user operation, extract the sixth user identification from the user data through the user manager object, and check whether the sixth user identification is in a valid state. When it is determined that the sixth user identification is in a valid state, extract the current login password, the target login password and the target authority data from the user data, compare the current login password with the password of the second user information item corresponding to the sixth user identification in the user information list, and when the passwords are consistent, generate the modification time based on the current system time, update the second user information item based on the target login password, the target authority data and the modification time, call the data storage object to update the corresponding user information, and generate the sixth operation result data;
[0162] The user manager object calls the first communication interface object to send the sixth operation result data to the client, so that the client parses the sixth operation result data to obtain the sixth operation result, and outputs the sixth operation result.
[0163] The user management device provided in the embodiment of the present application is included in an electronic device and can be used to execute the corresponding user management method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0164] It is worth noting that in the embodiment of the above-mentioned user management device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0165] Fig.10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.10 As shown, the electronic device includes a processor 210 and a memory 220, and may also include an input device 230, an output device 240, and a communication device 250; the number of the processor 210 in the electronic device may be one or more, Fig.10 A processor 210 is taken as an example; the processor 210, the memory 220, the input device 230, the output device 240 and the communication device 250 in the electronic device can be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.
[0166] The memory 220, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the user management method in the embodiment of the present application. The processor 210 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 220, that is, implements the above-mentioned user management method.
[0167] The memory 220 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 220 may further include a memory remotely arranged relative to the processor 210, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0168] The input device 230 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 240 may include electronic devices such as a display screen.
[0169] The above-mentioned electronic device includes a user management device, which can be used to execute any user management method and has corresponding functions and beneficial effects.
[0170] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to perform relevant operations in the method provided in any embodiment of the present application and has corresponding functions and beneficial effects.
[0171] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.
[0172] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0173] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0174] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0175] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A user management method, applied to an embedded device, characterized in that: include: Initialize a user manager object, wherein the user manager object is provided with a user information list, a user identification list, a data storage object and at least one communication interface object; The user manager object traverses and calls each communication interface object to determine whether the user operation data sent by the client is read; When the first communication interface object among the communication interface objects is called to read the user operation data, the user operation data is parsed by the user manager object to obtain an operation code and user data; In the case where the user operation corresponding to the operation code is a user registration operation, extracting a first user identifier from the user data through the user manager object, and checking whether the first user identifier is in a valid state; if it is determined that the first user identifier is in a valid state, extracting first user information from the user data through the user manager object, calling the data storage object to save the first user information, creating a first user information item according to the first user information, adding the first user information item to the user information list, and generating first operation result data, wherein the first operation result data carries a success flag; The first operation result data is sent to the client by calling the first communication interface object through the user manager object, so that the client parses the first operation result data to obtain the first operation result, and outputs the first operation result.
2. The user management method according to claim 1, characterized in that: The initialization of the user manager object includes: Creating a user manager object, adding a pre-created user information list, a user identification list, a data storage object, and at least one communication interface object to the user manager object; Detecting whether there is an initial administrator information item in the user information list, and if there is no initial administrator information item in the user information list, generating initial administrator information through the user manager object, wherein the initial administrator information includes an initial administrator name, an initial administrator password, and initial administrator authority data; The data storage object is called by the user manager object to save the initial administrator information, and an initial administrator information item is created according to the initial administrator information, and the initial administrator information item is added to the user information list.
3. The user management method according to claim 2, characterized in that: Before adding the pre-created user information list, user identification list, data storage object and at least one communication interface object to the user manager object, the method further includes: Detecting a storage module of the embedded device, determining a currently set target storage module, and creating a data storage object corresponding to the target storage module; Detecting the physical communication interface of the embedded device, determining at least one physical communication interface currently set, enabling the communication function corresponding to each of the physical communication interfaces, and creating a communication interface object corresponding to each of the communication functions; Create a user information list and a user ID list.
4. The user management method according to claim 1, characterized in that: After the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes: In the case where the user operation corresponding to the operation code is a login operation, extracting second user information from the user data through the user manager object, matching the second user information with an existing user information item in the user information list, generating a second user identifier when the second user information successfully matches a target user information item in the existing user information item, adding the second user identifier to the user identifier list, generating a login time based on the current system time, adding the second user identifier and the login time to the target user information item, and generating second operation result data, wherein the second operation result data carries a success flag and the second user identifier; The user manager object calls the first communication interface object to send the second operation result data to the client, so that the client parses the second operation result data to obtain the second operation result, and outputs the second operation result.
5. The user management method according to claim 1, characterized in that: After the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes: In the case where the user operation corresponding to the operation code is a logout operation, extracting a third user identifier from the user data through the user manager object, matching the third user identifier with an existing user identifier in the user identifier list, deleting the target user identifier from the user identifier list, and deleting the target user identifier and the corresponding login time from the user information list when the third user identifier successfully matches the target user identifier in the existing user identifier, generating third operation result data, wherein the third operation result data carries a success flag; The user manager object calls the first communication interface object to send the third operation result data to the client, so that the client parses the third operation result data to obtain a third operation result, and outputs the third operation result.
6. The user management method according to claim 1, characterized in that: After the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes: In the case where the user operation corresponding to the operation code is a user destroy operation, extracting a fourth user identifier from the user data through the user manager object, and checking whether the fourth user identifier is in a valid state; in the case where it is determined that the fourth user identifier is in a valid state, extracting a user name to be deregistered from the user data through the user manager object, deleting a corresponding target user data item from the user information list based on the user name to be deregistered, generating a destruction time based on the current system time, calling the data storage object to associate the destruction time with the user information corresponding to the user name to be deregistered, and generating fourth operation result data, wherein the fourth operation result data carries a success flag; The user manager object calls the first communication interface object to send the fourth operation result data to the client, so that the client parses the fourth operation result data to obtain a fourth operation result, and outputs the fourth operation result.
7. The user management method according to claim 1, characterized in that: After the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes: In the case where the user operation corresponding to the operation code is a user query operation, extracting a fifth user identifier from the user data through the user manager object, and checking whether the fifth user identifier is in a valid state; in the case where it is determined that the fifth user identifier is in a valid state and the user name to be queried is extracted from the user data through the user manager object, calling the data storage object to query the target user information corresponding to the user name to be queried, and generating fifth operation result data based on the target user information, the fifth operation result data carrying a success flag; The user manager object calls the first communication interface object to send the fifth operation result data to the client, so that the client parses the fifth operation result data to obtain a fifth operation result, and outputs the fifth operation result.
8. The user management method according to claim 1, characterized in that: After the user operation data is parsed by the user manager object to obtain the operation code and the user data, the method further includes: In the case where the user operation corresponding to the operation code is a modify user operation, extracting a sixth user identifier from the user data through the user manager object, and checking whether the sixth user identifier is in a valid state, and in the case where it is determined that the sixth user identifier is in a valid state, extracting a current login password, a target login password and target authority data from the user data, and comparing the current login password with the password of the second user information item corresponding to the sixth user identifier in the user information list, and in the case where the passwords are consistent, generating a modification time based on the current system time, and updating the second user information item based on the target login password, the target authority data and the modification time, and calling the data storage object to update the corresponding user information, and generating sixth operation result data; The user manager object calls the first communication interface object to send the sixth operation result data to the client, so that the client parses the sixth operation result data to obtain a sixth operation result, and outputs the sixth operation result.
9. A user management device, characterized in that: include: an initialization unit configured to initialize a user manager object, wherein the user manager object is provided with a user information list, a user identification list, a data storage object, and at least one communication interface object; A data reading unit, configured to traverse and call each communication interface object through the user manager object to determine whether the user operation data sent by the client is read; a data parsing unit configured to parse the user operation data through the user manager object to obtain an operation code and user data when the first communication interface object among the communication interface objects is called to read the user operation data; a registered user operation processing unit, configured to, when the user operation corresponding to the operation code is a registered user operation, extract a first user identifier from the user data through the user manager object, and check whether the first user identifier is in a valid state; when it is determined that the first user identifier is in a valid state, extract first user information from the user data through the user manager object, call the data storage object to save the first user information, create a first user information item according to the first user information, add the first user information item to the user information list, and generate first operation result data, wherein the first operation result data carries a success flag; The operation result sending unit is configured to call the first communication interface object through the user manager object to send the first operation result data to the client, so that the client parses the first operation result data to obtain the first operation result and outputs the first operation result.
10. An electronic device, characterized in that include: one or more processors; a memory for storing one or more computer programs; When the one or more computer programs are executed by the one or more processors, the electronic device implements the user management method as described in any one of claims 1-8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the user management method as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method and system of user-based DNS server access control
CN102075589A
Atypical identity identification processing method, server, terminal and system
CN117728982A
Method and apparatus for managing user registration on ce device over network
US20090198735A1