esprfid / esp-rfid

ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS
MIT License
1.35k stars 423 forks source link

Adding user's role access #332

Open clabnet opened 4 years ago

clabnet commented 4 years ago

Seeing the code, the esprfid.js file contains the role management, and now are expected only this access types: Always, Admin, Disabled.

It is possible to add others user's role access ?

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.

omersiar commented 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.

clabnet commented 4 years ago

Sending different roles via MQTT it is possible to perform different actions against the user's role.

omersiar commented 4 years ago

What do you mean by different actions? Currently esp-rfid only give access or deny it.

clabnet commented 4 years ago

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.

omersiar commented 4 years ago

Oh ok now I understood, You were referring actions from the broker side.

evazzoler commented 4 years ago

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.

evazzoler commented 3 years ago

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!