From 94c7db045a54735d236afe4603e23b49726745bf Mon Sep 17 00:00:00 2001
From: Mauricio Giacomini Girardello <mauriciogiacomini4@gmail.com>
Date: Tue, 3 Nov 2015 08:10:02 -0200
Subject: [PATCH] select collections from context

---
 app/repositories/orient_db/collection_repository.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/repositories/orient_db/collection_repository.rb b/app/repositories/orient_db/collection_repository.rb
index c649a4e5..1ca088d6 100644
--- a/app/repositories/orient_db/collection_repository.rb
+++ b/app/repositories/orient_db/collection_repository.rb
@@ -45,8 +45,11 @@ module OrientDb
       destroy_edge "BelongsTo", object.id, object.owner.rid
     end
 
-    def all(user)
-      query = sprintf("select * from (select expand(in('BelongsTo')) from %s) where name<>'Bookmarks'", user.rid)
+    ##
+    # Select all collections in context
+    def all(context = Collections::PublicContext.new)
+      #query = sprintf("select * from (select expand(in('BelongsTo')) from %s) where name<>'Bookmarks' and privacy = '%s'", user.rid)
+      query = sprintf("select * from %s where name<>'Bookmarks' and privacy = '%s'", context.from, context.privacy)
       build_objects connection.query(query)
     end
 
-- 
GitLab