hi
is there any way to get role’s channels in CBL ?
channel info only exists in the sync gateway side. you can not get channel info in CBL.
just want all users access to a document
is it possible ?
In your sync_function if you assign a document to the pre-defined “!” (all users) channel, your document will be visible to all users.
sorry my bad english
want all users that access to a document
is it possible ?
As Andy indicated, you can use the “public” “!” channel for this. You can learn more about this in channels documentation.
function (doc, oldDoc) {
// Assign public docs to this channel
channel('!');
}
I want all users who have access to a document
I think I finally understood the question. Sorry about that.
This is an admin level privilege .
You can use the admin SG API interface GET /_raw/{{docid}}
to query for all users who have access to a document. This will return access
that lists users that have access to the document
Example:{{adminurl}}/todo/_raw/user1.0.2F469DBB-1753-4AFA-9FC6-2154DC0E723D
The JSON response will include an access
element similar to this which lists users who have access to the document
"access": {
"role:moderator": {
"task-list.user1.0.2F469DBB-1753-4AFA-9FC6-2154DC0E723D": 38
},
"user1": {
"task-list.user1.0.2F469DBB-1753-4AFA-9FC6-2154DC0E723D": 38,
"task-list.user1.0.2F469DBB-1753-4AFA-9FC6-2154DC0E723D.users": 38
}
}