You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello
Does anyone encountered the following issue while adding a new user to the device ?
Sometimes when I try to add a new user to the device, I got a response OK. But when I check the list of users I don't find the recently added user. And the same issue continue if I retried multiple times. but when I restart the device and resend the same user data, there it's added succefully.
the Code I used for adding a new user.
$userValidity = $this->isUserDataValid($uid,$userid,$name,$role,$password,$cardno);
if($userValidity !== true){
Log::info($userValidity);
$error = [
"error" => $userValidity
];
Log::info($error);
return response()->json($error, 400);
}
$zka = ConnectionUtils::connectDevice($device_ip, $port);
if ($zka === false) {
return response()->json("connection refused", 408);
}
$zka->disableDevice();
$result = $zka->setUser($uid,$userid,$name,$password,$role,$cardno);
Log::info($result);
if ($result === false){
$error = [
"error" => "Error occurred while adding user to the device."
];
return response()->json($error, 502);
}
$result = [
"response" => "User has been successfully added to the device."
];
$zka->enableDevice();
$zka->disconnect();
return response()->json($result, 200);
}
private function isUserDataValid($uid,$userid,$name,$role,$password,$cardno){
if ($uid > 65535){
return "uid too large";
}
if (strlen($userid) > 9 || !preg_match('/^\d+$/', $userid)){
return "User ID should contain a maximum of 9 digits.";
}
if (strlen($name) > 24){
return "user name should have less than 24 characters";
}
if (strlen($password) > 8 || !preg_match('/^\d+$/', $password)){
return "password should contain a maximum of 8 digits.";
}
if ( $role !== 0 && $role !== 14 ){
return "user role should either be 0 (for user role), 14 (for admin role).";
}
if ( strlen($cardno) > 10 ){
return "Cardno should contain a maximum of 10 digits.";
}
return true;
}`
The problem is that, I don't know HOW or WHEN should I add a user.
The device I use F18
hello
Does anyone encountered the following issue while adding a new user to the device ?
Sometimes when I try to add a new user to the device, I got a response OK. But when I check the list of users I don't find the recently added user. And the same issue continue if I retried multiple times. but when I restart the device and resend the same user data, there it's added succefully.
the Code I used for adding a new user.
`public function setUser($device_ip, $port, Request $request)
{
$uid = $request['uid'];
$userid = $request['userid'];
$name = $request['name'];
$role = $request['role'];
$password = $request['password'];
$cardno = $request['cardno'];
The problem is that, I don't know HOW or WHEN should I add a user.
The device I use F18
{
"device_Version": "Ver 6.60 ",
"device_OSVersion": "1",
"device_Platform": "ZMM210_TFT",
"device_fmVersion": "10",
"device_fmEdition": "Ver 6.60 Apr 26 2016",
"device_workCode": "0",
"device_ssr": "1",
"device_pinWidth": "9",
"device_deviceName": "F18/ID",
}
Deos anyone have an explanation for this issue??
The text was updated successfully, but these errors were encountered: