fananimi / pyzk

Unofficial library of zkteco fingerprint attendance machine
GNU General Public License v2.0
489 stars 319 forks source link

How to fix the ID of a registered user? #210

Open musahcoding opened 4 months ago

musahcoding commented 4 months ago

We have assigned ID of the users in an scattered manner where we assigned more than 65535 to about 5K of users. Now we cannot create any more users as the limit has reached.

We are thinking about a solution to keep the fingerprint of existing users and somehow change their IDs to start from 1 and assigned continuous IDs.

To do that, would you please let us know if any of the followings are possible?

  1. Update the ID of a user
  2. Copy the user with the fingerprint data to a new user with the desired ID and then delete the old one. Deleting and creating a new user without the fingerprint is possible already.

Thanks in advance.

core-burner commented 2 weeks ago

You can def save_user_template(self, user, fingers=[]): """ save user and template

    :param user: user
    :param fingers: list of finger. (The maximum index 0-9)
    """

temp_id is template id

def enroll_user(self, uid=0, temp_id=0, user_id=''): """ start enroll user

    :param uid: uid
    :param temp_id: template id

For cleaning old user records you can use delete_user after #218 Enroll should work up to I(which is approximately 4 million) command_string = pack('<Ib', int(user_id), temp_id) If you are talking about template_id, that's another story, template_id supports up to a byte only, so keep it clean. Given these solutions, if there are no further questions or issues, I suggest closing this issue as the provided approach seems sufficient to handle the user ID management and fingerprint data. Closes #210