Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LoggedExceptionsController.class_eval do
- # set the same session key as the app
- session :session_key => "profile_video_session"
- # include any custom auth modules you need
- include AuthenticationSystem
- before_filter :login_required
- # optional, sets the application name for the rss feeds
- self.application_name = "Profile Video"
- protected
- # only allow admins
- # this obviously depends on how your auth system works
- def authorized?
- current_user.is_a?(Admin)
- end
- # assume app's login required doesn't use http basic
- def login_required_with_basic
- respond_to do |accepts|
- # alias_method_chain will alias the app's login_required to login_required_without_basic
- accepts.html { login_required_without_basic }
- # access_denied_with_basic_auth is defined in LoggedExceptionsController
- # get_auth_data returns back the user/password pair
- accepts.rss do
- access_denied_with_basic_auth unless self.current_user = User.authenticate(*get_auth_data)
- end
- end
- end
- alias_method_chain :login_required, :basic
- end
Add Comment
Please, Sign In to add comment