Open clabnet opened 4 years ago
This can only be achieved via code refactoring. Good idea but what exactly roles are good for? other than the currently available ones.
Sending different roles via MQTT it is possible to perform different actions against the user's role.
What do you mean by different actions? Currently esp-rfid only give access or deny it.
In a large plus view, If you assign a role to user A, different from user B, and you include this information into MQTT message (as is), when this message will be received from MQTT broker, you will perform different operations to user A and user B. For example, the user A (member of group A-users) will be open the door 1 and 2, and user B (member of group B-users) will be open only the door 1.
Oh ok now I understood, You were referring actions from the broker side.
Would be wonderful if a user (tag) would have a OTP role. It works one time, open, then becomes disabled. Please, consider this if you do changes.
Finally I implemented otp serverside, with a good plus. The "life" concept is not "one time" but a number indicating how many times a code can be used. Will set 1 for otp, will become 0 when disabled or leave empty for no limit. But you can set it to 2 or 5 or 157... Please, consider this for version 2.0. Thanks!
Seeing the code, the esprfid.js file contains the role management, and now are expected only this access types: Always, Admin, Disabled.
For maintain generic I could use, in addition to three roles, also Role1, Role2, Role3, .... Role 10, submitting this code to MQTT broker, as is now.
But the problem is not update the .js file, it is hard to minifize the src file and reflash on the board. Can you suggest how to this change, without touching the backend code ?
Thanks.