From f62f37cc27379d26d2811590df2211de0d4dde84 Mon Sep 17 00:00:00 2001 From: Bruno Nocera Zanette <bnzanette@inf.ufpr.br> Date: Thu, 13 Aug 2015 14:14:15 -0300 Subject: [PATCH] Add Dspace_Service method --- app/controllers/application_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e1b..691126f7f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,20 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + def dspace_service + @dspace_service ||= DspaceService.new( + DspaceService.create_dspace_client( + 'https://portalmecdev.c3sl.ufpr.br:8443/rest', + get_remote_authenticable_token + ) + ) + end + + private + + def get_remote_authenticable_token + session[:dspace_auth_token] || nil + end + end -- GitLab