fananimi / pyzk

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

user enabled flag #179

Closed hungerburg closed 1 year ago

hungerburg commented 1 year ago

The proprietary software allows me to mark users active/inactive. This gets stored on device. For a pet project of mine, I'd like to tell apart the users that are enabled/active from those inactive/not enabled.

I found that this flag is part of the privilege field in user data structure, c.f. https://github.com/adrobinoga/zk-protocol/blob/master/sections/data-user.md#set-user-info

Adding hex(user.privilege) to the output of get_users.py, I can tell active/inactive users from each other. Respectively they print 0x0 for enabled and 0x1 for disabled, that is normal non-admin users.

Would be nice if pyzk could dissect the privilege field and make this information queryable.

PS: Admin users print 0xe (int 14) - I do not have inactive admin users, according to https://github.com/adrobinoga/zk-protocol/blob/master/sections/data-user.md#read-all-user-ids this might change?

kurenai-ryu commented 1 year ago

Hey, I think these new methods can help you, what do you think?

hungerburg commented 1 year ago

That looks nice; Code that queries user.privileges directly will run unchanged. New code can learn more.