2016-05-25 16:28:55 +07:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-04-07 07:01:35 +07:00
|
|
|
from struct import pack #, unpack
|
2016-05-25 16:28:55 +07:00
|
|
|
class User(object):
|
|
|
|
|
2018-01-31 05:17:08 +07:00
|
|
|
def __init__(self, uid, name, privilege, password='', group_id='', user_id='', card=0):
|
2016-05-25 16:28:55 +07:00
|
|
|
self.uid = uid
|
|
|
|
self.name = name
|
|
|
|
self.privilege = privilege
|
|
|
|
self.password = password
|
|
|
|
self.group_id = group_id
|
|
|
|
self.user_id = user_id
|
2018-04-07 07:01:35 +07:00
|
|
|
self.card = card # 64 int to 40 bit int
|
|
|
|
def repack29(self): # with 02 for zk6 (size 29)
|
|
|
|
return pack("<BHB5s8s5sBhI", 2, self.uid, self.privilege, self.password, self.name, pack("Q", self.card), int(self.group_id), 0, int(self.user_id))
|
2016-05-25 16:28:55 +07:00
|
|
|
|
2016-06-24 19:00:55 +07:00
|
|
|
def __str__(self):
|
|
|
|
return '<User>: {}'.format(self.name)
|
2016-06-12 16:35:02 +07:00
|
|
|
|
|
|
|
def __repr__(self):
|
2016-06-24 19:00:55 +07:00
|
|
|
return '<User>: {}'.format(self.name)
|