From ac6b90d96f23fba0cbd84c3aa66c76a94ebbae68 Mon Sep 17 00:00:00 2001
From: Mauricio Giacomini Girardello <mauriciogiacomini4@gmail.com>
Date: Tue, 3 Nov 2015 08:16:36 -0200
Subject: [PATCH] change collections controller authentication

---
 app/controllers/collections_controller.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb
index 912a6a68..71d487f3 100644
--- a/app/controllers/collections_controller.rb
+++ b/app/controllers/collections_controller.rb
@@ -1,11 +1,15 @@
 class CollectionsController < ApplicationController
   before_action :set_collection, only: [:show, :update, :destroy, :like, :add_learning_object]
-  before_action :authenticate_user!, except: [:index, :show]
+  before_action :authenticate_user!, only: [:show, :update, :destroy, :like, :add_learning_object]
 
   # GET /collections
   # GET /collections.json
   def index
-    @collections = collection_repository.all current_user
+    if user_signed_in?
+      @collections = collection_repository.all Collections::UserPublicContext.new(current_user)
+    else
+      @collections = collection_repository.all
+    end
   end
 
   # GET /collections/1
-- 
GitLab