Browse files

Removed the controller module as it makes assumptions about the contr…

…oller setup that can't be relied upon
  • Loading branch information...
1 parent 5ca537f commit 4c3dfabcca91b2cfa04f5bf1c891e68ccebade0f @james2m committed Dec 31, 2010
Showing with 0 additions and 63 deletions.
  1. +0 −4 lib/authlogic_facebook_koala.rb
  2. +0 −59 lib/authlogic_facebook_koala/controller.rb
View
4 lib/authlogic_facebook_koala.rb
@@ -7,13 +7,9 @@
require 'authlogic_facebook_koala/acts_as_authentic'
require 'authlogic_facebook_koala/session'
require 'authlogic_facebook_koala/helper'
-require 'authlogic_facebook_koala/controller'
-
-
if ActiveRecord::Base.respond_to?(:add_acts_as_authentic_module)
ActiveRecord::Base.send :include, AuthlogicFacebookKoala::ActsAsAuthentic
- ActionController::Base.send :include, AuthlogicFacebookKoala::Controller
Authlogic::Session::Base.send :extend, AuthlogicFacebookKoala::Config
Authlogic::Session::Base.send :include, AuthlogicFacebookKoala::Session
View
59 lib/authlogic_facebook_koala/controller.rb
@@ -1,59 +0,0 @@
-require 'ostruct'
-module AuthlogicFacebookKoala
- module Controller
-
- def self.included(controller)
- controller.send(:helper_method, :facebook_user?, :facebook_user, :facebook_session?, :facebook_session)
- end
-
- # TODO update to use the new facebook_user stuff we are going to create
- # can probably kill this now.
- def set_current_account_session_from_facebook_session
- unless current_account_session
- @current_account_session = AccountSession.new
- @current_account_session.account = Account.find_by_facebook_uid(facebook_session.user.uid)
- end
- end
-
- def facebook_user?
- !!facebook_user
- end
-
- def facebook_user
- if @facebook_user
- return @facebook_user
- elsif facebook_session?
- facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token)
- user = facebook_graph.get_object('me')
- user[:uid] = user.delete('id')
- return @facebook_user = OpenStruct.new( user )
- end
- end
-
- def facebook_session?
- !!facebook_session
- end
-
- protected
-
- def facebook_session
- @facebook_session
- end
-
- def set_facebook_session
- if @facebook_session
- return(@facebook_session)
- elsif cookies.has_key?("fbs_#{facebook_params.app_id}")
- oauth = Koala::Facebook::OAuth.new(facebook_params.app_id, facebook_params.secret_key)
- @facebook_session = OpenStruct.new( oauth.get_user_from_cookie(cookies) )
- end
- end
-
- private
-
- def facebook_params
- AuthlogicFacebookKoala::CONFIG
- end
-
- end
-end

0 comments on commit 4c3dfab

Please sign in to comment.