lundi 26 avril 2021

best way to lock fields and methods in web app?

I've decided to build in my web and "read-only" mode which means that the user wont be able to changes certain data in certain field. I want to know what is the best way to prevent him from changing field and calling certain method that might change the current state (will break the read-only mode).

  1. I would've freeze everything but the problem is that some fields are not object so I cant freeze them

  2. I can use a lock for every methods I'm calling which will return if the read-only == true but that seems stupid to add it for each method

  3. I can try to do something with the event-listner but sit might be a problematic.

p.s I don't mind doing working hard, just want to make sure what the best practice for that scenario.

thanks again :)




Aucun commentaire:

Enregistrer un commentaire