问题
I need a way to temporarily disable particular user read/write access to my couchdb, i.e. ban him there for certain period of time, but letting him know that he was banned. What could be the best approach to do it?
The very first thing came to my mind was just changing his password (require_valid_user is set), but this way there definitely will be no feedback to him as his access is completely lost.
My DBs have role-based access set up, all regular users are assigned to role "registered", so my second thought was to change his role to something like "banned" => he loses access to all regular DBs. But how to provie feedback in such case?
_users DB as well has "registered" role for access (is that necessary, BTW?) will it prevent user with role "banned" to read his own doc from there?
回答1:
In case somebody stepped down here for similar task. =>solution: Finally I ended up with server logic that changes user role to "banned" and adding this role to access roles of _users DB. This way banned user completely loses his access to other DBs (which request "registered" role) and has to wait until server changes his role back to valid one.
来源:https://stackoverflow.com/questions/56919356/how-to-temporarily-disable-particular-user-in-couchdb