       generatedObjects.push generatedObject
     callback generatedObjects
 
-  removePrivateContent:(groupId, contents, callback)->
-    query = """
-      start  kd=node:koding("id:#{groupId}")
-      MATCH  kd-[:member]->users-[r:owner]-groups
-      WHERE groups.name = "JGroup"
-       AND ( groups.privacy = "private"
-        OR  groups.visibility=  "hidden" )
-      RETURN groups
-      ORDER BY r.createdAtEpoch DESC
-    """
-
-    @db.query query, {}, (err, results)=>
+  getSecretGroups:(client, callback)->
+    JGroup = require '../group'
+    JGroup.some
+      privacy: "private"
+      visibility: "hidden"
+      slug:
+        $nin: ["koding"] # we need koding even if its private
+    , {}, (err, groups)=>
       if err then return callback err
-      secretGroups = (result.groups.data.slug for result in results)
-      filteredContent = []
-      for content in contents
-        filteredContent.push content if content.group not in secretGroups
-      callback null, filteredContent
+      else
+        secretGroups = []
+        checkUserCanReadActivity = race (i, {client, group}, fin)=>
+          group.canReadActivity client, (err, res)=>
+            secretGroups.push group.slug unless err
+            fin()
+        , =>
+          callback null, secretGroups
+        for group in groups
+          checkUserCanReadActivity {client: client, group: group}
+
+  removePrivateContent:(client, groupId, contents, callback)->
+      @getSecretGroups client, (err, secretGroups)=>
+        if err then return callback err
+        else
+          filteredContent = []
+          for content in contents
+            filteredContent.push content if content.group not in secretGroups
+          callback null, filteredContent
 
   neo4jFacets = [
     "JLink"

      facetQueryList = []
      for facet in facets
        if facet not in neo4jFacets
          console.log "Unknown facet: " + facets.join() 
          continue

        facetQueryList.push("content.name=\"#{facet}\"")

    "JCodeShare"
  ]

  fetchAll:(requestOptions, callback)->
    {group:{groupName, groupId}, startDate, client} = requestOptions

    console.time 'fetchAll'

