Hi,
I need to allow some users to delete other users without being a CouchDB
Administrator. To do that I updated _users/_design/_auth to change the
'_admin' check to:
if ((userCtx.roles.indexOf('_admin') !== -1) ||
(userCtx.roles.indexOf('manager') !== -1 &&
userCtx.roles.indexOf(oldDoc.databases[0]) !== -1) ||
            (userCtx.name == oldDoc.name)) {
            return;
        } else {
            throw ({
                forbidden: 'Only admins may delete other user docs.'
            });
        }
It works but sometimes CouchDB reset this _design/_auth document. I've read
in doc this design doc cannot be modified but I couldn't find another way
to achieve this.
Is there a way to prevent CouchDB to do that ?  Or another way to do what
I'm trying to do ?
I'm using CouchDB 1.4.

Thanks.

Max.

Reply via email to