<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/exception_loggable_controller_mixin.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -23,46 +23,35 @@ Now add a new route to your routes.rb:
 
 After that, visit /logged_exceptions in your application to manage the exceptions.
 
-It's understandable that you may want to require authentication.  Add this to your config/environments/production.rb:
-
-  # config/environments/production.rb
-  config.after_initialize do
-    require 'application' unless Object.const_defined?(:ApplicationController)
-    LoggedExceptionsController.class_eval do
-      # set the same session key as the app
-      session :session_key =&gt; '_beast_session_id'
-      
-      # include any custom auth modules you need
-      include AuthenticationSystem
-      
-      before_filter :login_required
+It's understandable that you may want to require authentication. You can do this by creating your own controller extending your ApplicationController (thereby leveraging all the existing authorization rules you may have) and include the ExceptionLoggableControllerMixin module. For example:
+
+  class LoggedExceptionsController &lt; ApplicationController
+    include ExceptionLoggableControllerMixin
+    self.application_name = &quot;My Application Name&quot;  # this will show up in the title of the Rss feed
+
+    # add your regular permission checking here, e.g.:
+    protected
+      # only allow admins
+      # this obviously depends on how your auth system works
+      def authorized?
+        current_user.is_a?(Admin)
+      end
       
-      # optional, sets the application name for the rss feeds
-      self.application_name = &quot;Beast&quot;
-      
-      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
+      # 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 ExceptionLoggableControllerMixin
+          # 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
-        
-        alias_method_chain :login_required, :basic
-    end
+      end
+      
+      alias_method_chain :login_required, :basic
   end
 
 The exact code of course depends on the specific needs of your application.
@@ -71,4 +60,4 @@ CREDITS
 
 Jamis Buck  - original exception_notification plugin
 Rick Olson  - model/controller code
-Josh Goebel - design
+Josh Goebel - design
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,3 @@
 require 'will_paginate' unless Kernel.const_defined? 'WillPaginate'
 WillPaginate.enable
-LoggedExceptionsController.view_paths = [File.join(directory, 'views')]
+ExceptionLoggableControllerMixin.custom_view_paths = [File.join(directory, 'views')]</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,71 +1,3 @@
 class LoggedExceptionsController &lt; ActionController::Base
-  cattr_accessor :application_name
-  layout nil
-
-  def index
-    @exception_names    = LoggedException.find_exception_class_names
-    @controller_actions = LoggedException.find_exception_controllers_and_actions
-    query
-  end
-
-  def query
-    conditions = []
-    parameters = []
-    unless params[:id].blank?
-      conditions &lt;&lt; 'id = ?'
-      parameters &lt;&lt; params[:id]
-    end
-    unless params[:query].blank?
-      conditions &lt;&lt; 'message LIKE ?'
-      parameters &lt;&lt; &quot;%#{params[:query]}%&quot;
-    end
-    unless params[:date_ranges_filter].blank?
-      conditions &lt;&lt; 'created_at &gt;= ?'
-      parameters &lt;&lt; params[:date_ranges_filter].to_f.days.ago.utc
-    end
-    unless params[:exception_names_filter].blank?
-      conditions &lt;&lt; 'exception_class = ?'
-      parameters &lt;&lt; params[:exception_names_filter]
-    end
-    unless params[:controller_actions_filter].blank?
-      conditions &lt;&lt; 'controller_name = ? AND action_name = ?'
-      parameters += params[:controller_actions_filter].split('/').collect(&amp;:downcase)
-    end
-    @exceptions = LoggedException.paginate :order =&gt; 'created_at desc', :per_page =&gt; 30, 
-      :conditions =&gt; conditions.empty? ? nil : parameters.unshift(conditions * ' and '), :page =&gt; params[:page]
-    
-    respond_to do |format|
-      format.html { redirect_to :action =&gt; 'index' unless action_name == 'index' }
-      format.js   { render :action =&gt; 'query.rjs'  }
-      format.rss  { render :action =&gt; 'query.rxml' }
-    end
-  end
-  
-  def show
-    @exc = LoggedException.find params[:id]
-  end
-  
-  def destroy
-    LoggedException.destroy params[:id]
-  end
-  
-  def destroy_all
-    LoggedException.delete_all ['id in (?)', params[:ids]] unless params[:ids].blank?
-    query
-  end
-
-  private
-    def access_denied_with_basic_auth
-      headers[&quot;Status&quot;]           = &quot;Unauthorized&quot;
-      headers[&quot;WWW-Authenticate&quot;] = %(Basic realm=&quot;Web Password&quot;)
-      render :text =&gt; &quot;Could't authenticate you&quot;, :status =&gt; '401 Unauthorized'
-    end
-
-    @@http_auth_headers = %w(X-HTTP_AUTHORIZATION HTTP_AUTHORIZATION Authorization)
-    # gets BASIC auth info
-    def get_auth_data
-      auth_key  = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
-      auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
-      return auth_data &amp;&amp; auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] 
-    end
-end
+  include ExceptionLoggableControllerMixin
+end
\ No newline at end of file</diff>
      <filename>lib/logged_exceptions_controller.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c25f64a95fb20c705bf9a0ddfb6a1f22016bafce</id>
    </parent>
  </parents>
  <author>
    <name>Lawrence Pit</name>
    <email>lawrence.pit@gmail.com</email>
  </author>
  <url>http://github.com/lawrencepit/exception_logger/commit/4828f97a6385637675381a324c07f221074c81ce</url>
  <id>4828f97a6385637675381a324c07f221074c81ce</id>
  <committed-date>2008-05-06T02:08:31-07:00</committed-date>
  <authored-date>2008-05-06T02:08:31-07:00</authored-date>
  <message>Ability to create your own LoggedExceptionsController, thereby allowing easier deployment in dev environments and better leverage of existing (authentication) code in ApplicationController, i.e. no need to replicate in config.after_initialize</message>
  <tree>6a8347f76b90508fab8ea206f4abe484fb3fa4bf</tree>
  <committer>
    <name>Lawrence Pit</name>
    <email>lawrence.pit@gmail.com</email>
  </committer>
</commit>
