app/controllers/collections_controller.rb
# TODO - review these. There are too many and as a result there's some redundancy in, for example, checking whether the user is logged in on unpublished
# collections
review these. There are too many and as a result there's some redundancy in, for example, checking whether the user is logged in on unpublished
collections
review these . There are too many and as a result there ' s some redundancy in for example checking whether the user is logged in on unpublished collections
def user_able_to_view_collection
    unless @collection && current_user.can_read?(@collection)
      if logged_in?
        raise EOL::Exceptions::SecurityViolation.new("User with ID=#{current_user.id} does not have read access to Collection with ID=#{@collection.id}",
        :admins_and_joined_only_can_read)
      else
        raise EOL::Exceptions::MustBeLoggedIn, "Non-authenticated user does not have read access to Collection with id=#{@collection.id}"
      end
      return true
    end
  end
def user_able_to_view_collection unless @collection && current_user . can_read? ( @collection ) if logged_in? raise EOL :: Exceptions :: SecurityViolation . new ( "User with ID=#{current_user.id} does not have read access to Collection with ID=#{@collection.id}" , :admins_and_joined_only_can_read ) else raise EOL :: Exceptions :: MustBeLoggedIn , "Non-authenticated user does not have read access to Collection with id=#{@collection.id}" end return true end end
TODO - review these.
TODO - review these .