Class: IntegrationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/integrations_controller.rb

Instance Method Summary (collapse)

Methods inherited from ApplicationController

#admin_login_required, #all_done_todos_for, #boolean_param, cas_enabled?, #cas_enabled?, #check_for_deprecated_password_hash, #count_deferred_todos, #count_undone_todos, #count_undone_todos_phrase, #done_todos_for, #enable_mobile_content_negotiation, #for_autocomplete, #format_date, #format_dependencies_as_json_for_auto_complete, #handle_unverified_request, #init_data_for_sidebar, #init_not_done_counts, #init_project_hidden_todo_counts, #mobile?, #notify, openid_enabled?, #openid_enabled?, #parse_date_per_user_prefs, prefered_auth?, #prefered_auth?, #redirect_back_or_home, #render_failure, #sanitize, #set_charset, #set_group_view_by, #set_locale, #set_session_expiration, #set_time_zone, #set_zindex_counter, #todo_xml_params

Methods included from LoginSystem

#access_denied, #authorize?, #basic_auth_denied, #current_user, #get_basic_auth_data, #get_current_user, #logged_in?, #login_from_cookie, #login_optional, #login_or_feed_token_required, #login_required, #logout_user, #prefs, #protect?, #redirect_back_or_default, #redirect_to_login, #set_current_user, #store_location

Instance Method Details

- (Object) cloudmailin



35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/integrations_controller.rb', line 35

def cloudmailin
  if !verify_cloudmailin_signature
    render :text => "Message signature verification failed.", :status => 403
    return false
  end
  
  if process_message(params[:message])
    render :text => 'success', :status => 200
  else
    render :text => "No user found or other error", :status => 404
  end
end

- (Object) get_applescript(partial_name) (private)



60
61
62
63
# File 'app/controllers/integrations_controller.rb', line 60

def get_applescript(partial_name)
  context = current_user.contexts.find params[:context_id]
  render :partial => partial_name, :locals => { :context => context }
end

- (Object) get_applescript1



18
19
20
# File 'app/controllers/integrations_controller.rb', line 18

def get_applescript1
  get_applescript('applescript1')
end

- (Object) get_applescript2



22
23
24
# File 'app/controllers/integrations_controller.rb', line 22

def get_applescript2
  get_applescript('applescript2')
end

- (Object) get_quicksilver_applescript



14
15
16
# File 'app/controllers/integrations_controller.rb', line 14

def get_quicksilver_applescript
  get_applescript('quicksilver_applescript')
end

- (Object) google_gadget



31
32
33
# File 'app/controllers/integrations_controller.rb', line 31

def google_gadget
  render :layout => false, :content_type => Mime::XML
end

- (Object) index



6
7
8
# File 'app/controllers/integrations_controller.rb', line 6

def index
  @page_title = 'TRACKS::Integrations'
end

- (Object) process_message(message) (private)



50
51
52
# File 'app/controllers/integrations_controller.rb', line 50

def process_message(message)
  MessageGateway::receive(Mail.new(message))
end

- (Object) rest_api



10
11
12
# File 'app/controllers/integrations_controller.rb', line 10

def rest_api
  @page_title = 'TRACKS::REST API Documentation'
end

- (Object) search_plugin



26
27
28
29
# File 'app/controllers/integrations_controller.rb', line 26

def search_plugin
  @icon_data = [File.open(File.join(Rails.root, 'app', 'assets', 'images', 'done.png')).read].
    pack('m').gsub(/\n/, '')
end

- (Object) verify_cloudmailin_signature (private)



54
55
56
57
58
# File 'app/controllers/integrations_controller.rb', line 54

def verify_cloudmailin_signature
  provided = request.request_parameters.delete(:signature)
  signature = Digest::MD5.hexdigest(request.request_parameters.sort{|a,b| a[0].to_s <=> b[0].to_s}.map{|k,v| v}.join + SITE_CONFIG['cloudmailin'])
  return provided == signature
end