|
@@ -1,4 +1,4 @@
|
|
|
-class MemoController < ApplicationController
|
|
|
+class PeopleController < ApplicationController
|
|
|
protect_from_forgery
|
|
|
|
|
|
before_filter :common
|
|
@@ -14,20 +14,28 @@ class MemoController < ApplicationController
|
|
|
session[:cas] = session[:cas].with_indifferent_access
|
|
|
end
|
|
|
if session[:cas].nil? || session[:cas][:user].nil? #|| (session[:cas][:last_validated_at].blank? || session[:cas][:last_validated_at] < 15.minutes.ago)
|
|
|
- if not params[:anonymous].nil? and params[:anonymous] == "true"
|
|
|
- return
|
|
|
- end
|
|
|
-
|
|
|
- redirect_to "https://login.mephi.ru/login?allow_anonymous=true&service=#{url_for(:only_path => false)}"
|
|
|
+ redirect_to "https://login.mephi.ru/login?service=#{url_for(:only_path => false)}"
|
|
|
end
|
|
|
@user = session[:cas]
|
|
|
|
|
|
end
|
|
|
|
|
|
def index
|
|
|
- @requestTypes = RequestType.all
|
|
|
+ @people = Person.search(params[:search])
|
|
|
end
|
|
|
|
|
|
def show
|
|
|
end
|
|
|
+
|
|
|
+ def download
|
|
|
+ require 'net/http'
|
|
|
+
|
|
|
+ url = URI.parse("https://cps.mephi.ru/?cmd=fixok_people&apiKey=#{Rails.application.config.cps_api_key}")
|
|
|
+ http = Net::HTTP.new(url.host, url.port)
|
|
|
+ http.use_ssl = true
|
|
|
+ reply = http.get(url.request_uri)
|
|
|
+
|
|
|
+ json = ActiveSupport::JSON.decode(reply.body)
|
|
|
+ puts "#{json.to_yaml}"
|
|
|
+ end
|
|
|
end
|