GitHub user fangq added a comment to the discussion: Understanding Admins 
name/role and Members name/role settings

I have a follow up question regarding my above question 2.

I am using the following `validate_doc_update` handler to explicitly permit 
database-specific admins to update the document 

```
function(newDoc, oldDoc, userCtx, secObj) {
    if('_admin' in userCtx.roles)
        return;
    if(!userCtx.name) {
        throw({'forbidden': 'auth first before update something'});
    }
    if(!secObj.admins.names.includes(userCtx.name)) {
        throw({'forbidden': 'user is not allowed'});
    }
}
```

this works generally well. However, I noticed that if I log in with a 
site-admin account, it rejects the update by throwing the "forbidden': 'user is 
not allowed'" error.

is `_admin` automatically attached to al site-admin accounts? if not, what 
exactly is `_admin`? 

GitHub link: 
https://github.com/apache/couchdb/discussions/5487#discussioncomment-12630601

----
This is an automatically sent email for notifications@couchdb.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@couchdb.apache.org

Reply via email to