Add have* functions to sync function scope

Add `haveUser`, `haveRole` and `haveAccess` functions that can be used in the sync function.

Example use case:

```javascript
// only doc.members and admins can modify the document
if (!haveUser(oldDoc.members) && !haveRole('admin')) {
  throw ({forbidden: "no access"});
}
```