Grant access at different doc modifying channel dinamically

I report here what i have reported in a wrong place:

@ajres suggest to me to look at access() function.

Well i read it but i don’t understand something.

If i have an user X with no channel, he can’t see nothing. OK. :slight_smile: On db there are already 3 docs saved.

A {_id: A, type: a} B {_id: B, rel: A, type: b} C {_id: C, rel: A, type: b}.

CSG is:

if(doc.type == a) {
  access(member,doc._id);
  channel(doc._id)
}

if(doc.type == b){
  channel(doc.rel)
}

When user Y(admin) save the doc A {member:[X], _id: A, type: a}

What X will see on his client?

  1. A
  2. A B C

If the answer is (1) this is the problem and access() func doesn’t help me.

if the answer is (2). Nice, it’s what i need. I will test it.