From bd6554f88d48f950de85491f97a9b1b5e42b2f65 Mon Sep 17 00:00:00 2001 From: "Fanani M. Ihsan" Date: Wed, 25 May 2016 12:27:13 +0700 Subject: [PATCH] fixing set_user function --- zk/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zk/base.py b/zk/base.py index 133f9b6..0734f3c 100644 --- a/zk/base.py +++ b/zk/base.py @@ -202,16 +202,15 @@ class ZK(object): else: return cmd_response - def set_user(self, uid, name, password='', privilege=0, grup_id='', user_id=''): + def set_user(self, uid, name, privilege, password='', group_id='', user_id=''): command = const.CMD_USER_WRQ uid = chr(uid % 256) + chr(uid >> 8) - if privilege not in [const.USER_DEFAULT, const.USER_ADMIN]: privilege = const.USER_DEFAULT privilege = chr(privilege) - command_string = pack('2sc6s30sc8s24s', uid, privilege, password, name, chr(0), grup_id, user_id) + command_string = pack('2sc6s30sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id) cmd_response = self.__send_command(command=command, command_string=command_string, response_size=1024) cmd_response['data'] = '' if cmd_response.get('status'):