<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test_app/app/models/account.rb</filename>
    </added>
    <added>
      <filename>test_app/db/migrate/20081101190907_create_accounts.rb</filename>
    </added>
    <added>
      <filename>test_app/test/fixtures/accounts.yml</filename>
    </added>
    <added>
      <filename>test_app/test/integration/user_session_config_test.rb</filename>
    </added>
    <added>
      <filename>test_app/test/unit/account_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 0.10.4 released 2008-10-31
+
+* Changed configuration to use inheritable attributes
+* Cleaned up requires to be in their proper files
+
 == 0.10.3 released 2008-10-31
 
 * Instead of raising an error when extra fields are passed in credentials=, just ignore them.</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-require &quot;digest/sha2&quot;
 require File.dirname(__FILE__) + &quot;/authgasm/version&quot;
 
+require File.dirname(__FILE__) + &quot;/authgasm/controller_adapters/abstract_adapter&quot;
 require File.dirname(__FILE__) + &quot;/authgasm/controller_adapters/rails_adapter&quot; if defined?(Rails)
 
 require File.dirname(__FILE__) + &quot;/authgasm/sha512_crypto_provider&quot;</diff>
      <filename>lib/authgasm.rb</filename>
    </modified>
    <modified>
      <diff>@@ -45,6 +45,7 @@ module Authgasm
       # * &lt;tt&gt;crypted_password_field:&lt;/tt&gt; default: depends on which columns are present, checks: crypted_password, encrypted_password, password_hash, pw_hash, if none are present defaults to crypted_password. This is the name of column that your encrypted password is stored.
       # * &lt;tt&gt;password_salt_field:&lt;/tt&gt; default: depends on which columns are present, checks: password_salt, pw_salt, salt, if none are present defaults to password_salt. This is the name of the field your salt is stored, only relevant for a hash crypto provider.
       # * &lt;tt&gt;remember_token_field:&lt;/tt&gt; default: options[:session_class].remember_token_field, the name of the field your remember token is stored. What the cookie stores so the session can be &quot;remembered&quot;
+      # * &lt;tt&gt;scope:&lt;/tt&gt; default: nil, if all of your users belong to an account you might want to scope everything to the account. Just pass :account_id
       # * &lt;tt&gt;logged_in_timeout:&lt;/tt&gt; default: 10.minutes, this allows you to specify a time the determines if a user is logged in or out. Useful if you want to count how many users are currently logged in.
       # * &lt;tt&gt;session_ids:&lt;/tt&gt; default: [nil], the sessions that we want to automatically reset when a user is created or updated so you don't have to worry about this. Set to [] to disable. Should be an array of ids. See Authgasm::Session::Base#initialize for information on ids. The order is important. The first id should be your main session, the session they need to log into first. This is generally nil, meaning so explicitly set id.
       def acts_as_authentic(options = {})
@@ -84,7 +85,7 @@ module Authgasm
           validates_format_of options[:login_field], :with =&gt; /\A\w[\w\.\-_@]+\z/, :message =&gt; &quot;use only letters, numbers, and .-_@ please.&quot;
         end
         
-        validates_uniqueness_of options[:login_field]
+        validates_uniqueness_of options[:login_field], :scope =&gt; options[:scope]
         validates_uniqueness_of options[:remember_token_field]
         validate :validate_password
         validates_numericality_of :login_count, :only_integer =&gt; :true, :greater_than_or_equal_to =&gt; 0, :allow_nil =&gt; true if column_names.include?(&quot;login_count&quot;)</diff>
      <filename>lib/authgasm/acts_as_authentic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@ module Authgasm
       # or you can set your configuration in the session class directly:
       #
       #   class UserSession &lt; Authgasm::Session::Base
-      #     self.authenticate_with = User
+      #     authenticate_with User
       #     # ... more configuration
       #   end
       #
@@ -28,25 +28,17 @@ module Authgasm
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; inferred from the class name. UserSession would automatically try User
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; an ActiveRecord class
-        def authenticate_with=(klass)
+        def authenticate_with(klass)
           @klass_name = klass.name
           @klass = klass
         end
+        alias_method :authenticate_with=, :authenticate_with
         
         # Convenience method that lets you easily set configuration, see examples above
         def configure
           yield self
         end
         
-        # The authentication credentials are stored in a cookie as: user#{cookie_separator}crypted_password.
-        #
-        # * &lt;tt&gt;Default:&lt;/tt&gt; &quot;:::&quot;
-        # * &lt;tt&gt;Accepts:&lt;/tt&gt; String
-        def cookie_separator
-          @cookie_separator ||= &quot;:::&quot;
-        end
-        attr_writer :cookie_separator
-        
         # The name of the cookie or the key in the cookies hash. Be sure and use a unique name. If you have multiple sessions and they use the same cookie it will cause problems.
         # Also, if a id is set it will be inserted into the beginning of the string. Exmaple:
         #
@@ -55,10 +47,14 @@ module Authgasm
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; &quot;#{klass_name.underscore}_credentials&quot;
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; String
-        def cookie_key
-          @cookie_key ||= &quot;#{klass_name.underscore}_credentials&quot;
+        def cookie_key(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:cookie_key) || cookie_key(&quot;#{klass_name.underscore}_credentials&quot;)
+          else
+            write_inheritable_attribute(:cookie_key, value)
+          end
         end
-        attr_writer :cookie_key
+        alias_method :cookie_key=, :cookie_key
         
         # The name of the method used to find the record by the login. What's nifty about this is that you can do anything in your method, Authgasm will just pass you the login.
         #
@@ -70,19 +66,28 @@ module Authgasm
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; &quot;find_by_#{login_field}&quot;
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def find_by_login_method
-          @find_by_login_method ||= &quot;find_by_#{login_field}&quot;
+        def find_by_login_method(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:find_by_login_method) || find_by_login_method(&quot;find_by_#{login_field}&quot;)
+          else
+            write_inheritable_attribute(:find_by_login_method, value)
+          end
         end
-        attr_writer :find_by_login_method
+        alias_method :find_by_login_method=, :find_by_login_method
         
         # Calling UserSession.find tries to find the user session by session, then cookie, then basic http auth. This option allows you to change the order or remove any of these.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; [:session, :cookie, :http_auth]
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Array, and can only use any of the 3 options above
-        def find_with
-          @find_with ||= [:session, :cookie, :http_auth]
+        def find_with(*values)
+          if values.blank?
+            read_inheritable_attribute(:find_with) || find_with(:session, :cookie, :http_auth)
+          else
+            values.flatten!
+            write_inheritable_array(:find_with, values)
+          end
         end
-        attr_writer :find_with
+        alias_method :find_with=, :find_with
         
         # The name of the method you want Authgasm to create for storing the login / username. Keep in mind this is just for your Authgasm::Session, if you want it can be something completely different
         # than the field in your model. So if you wanted people to login with a field called &quot;login&quot; and then find users by email this is compeltely doable. See the find_by_login_method configuration option for
@@ -90,42 +95,53 @@ module Authgasm
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; Guesses based on the model columns, tries login, username, and email. If none are present it defaults to login
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def login_field
-          @login_field ||= (klass.column_names.include?(&quot;login&quot;) &amp;&amp; :login) || (klass.column_names.include?(&quot;username&quot;) &amp;&amp; :username) || (klass.column_names.include?(&quot;email&quot;) &amp;&amp; :email) || :login
+        def login_field(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:login_field) || login_field((klass.column_names.include?(&quot;login&quot;) &amp;&amp; :login) || (klass.column_names.include?(&quot;username&quot;) &amp;&amp; :username) || (klass.column_names.include?(&quot;email&quot;) &amp;&amp; :email) || :login)
+          else
+            write_inheritable_attribute(:login_field, value)
+          end
         end
-        attr_writer :login_field
+        alias_method :login_field=, :login_field
         
         # Works exactly like login_field, but for the password instead.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; Guesses based on the model columns, tries password and pass. If none are present it defaults to password
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def password_field
-          @password_field ||= (klass.column_names.include?(&quot;password&quot;) &amp;&amp; :password) || (klass.column_names.include?(&quot;pass&quot;) &amp;&amp; :pass) || :password
+        def password_field(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:password_field) || password_field((klass.column_names.include?(&quot;password&quot;) &amp;&amp; :password) || (klass.column_names.include?(&quot;pass&quot;) &amp;&amp; :pass) || :password)
+          else
+            write_inheritable_attribute(:password_field, value)
+          end
         end
-        attr_writer :password_field
+        alias_method :password_field=, :password_field
         
         # If sessions should be remembered by default or not.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; false
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Boolean
-        def remember_me
-          @remember_me
+        def remember_me(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:remember_me)
+          else
+            write_inheritable_attribute(:remember_me, value)
+          end
         end
-        attr_writer :remember_me
+        alias_method :remember_me=, :remember_me
         
         # The length of time until the cookie expires.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; 3.months
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Integer, length of time in seconds, such as 60 or 3.months
-        def remember_me_for
-          return @remember_me_for if @set_remember_me_for
-          @remember_me_for ||= 3.months
-        end
-        
-        def remember_me_for=(value)  # :nodoc:
-          @set_remember_me_for = true
-          @remember_me_for = value
+        def remember_me_for(value = :_read)
+          if value == :_read
+            read_inheritable_attribute(:remember_me_for) || remember_me_for(3.months)
+          else
+            write_inheritable_attribute(:remember_me_for, value)
+          end
         end
+        alias_method :remember_me_for=, :remember_me_for
         
         # The name of the field that the remember token is stored. This is for cookies. Let's say you set up your app and want all users to be remembered for 6 months. Then you realize that might be a little too
         # long. Well they already have a cookie set to expire in 6 months. Without a token you would have to reset their password, which obviously isn't feasible. So instead of messing with their password
@@ -133,33 +149,47 @@ module Authgasm
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; Guesses based on the model columns, tries remember_token, remember_key, cookie_token, and cookie_key. If none are present it defaults to remember_token
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def remember_token_field
-          @remember_token_field ||=
-            (klass.column_names.include?(&quot;remember_token&quot;) &amp;&amp; :remember_token) ||
-            (klass.column_names.include?(&quot;remember_key&quot;) &amp;&amp; :remember_key) ||
-            (klass.column_names.include?(&quot;cookie_token&quot;) &amp;&amp; :cookie_token) ||
-            (klass.column_names.include?(&quot;cookie_key&quot;) &amp;&amp; :cookie_key) ||
-            :remember_token
-        end
-        attr_writer :remember_token_field
+        def remember_token_field(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:remember_token_field) ||
+            remember_token_field(
+              (klass.column_names.include?(&quot;remember_token&quot;) &amp;&amp; :remember_token) ||
+              (klass.column_names.include?(&quot;remember_key&quot;) &amp;&amp; :remember_key) ||
+              (klass.column_names.include?(&quot;cookie_token&quot;) &amp;&amp; :cookie_token) ||
+              (klass.column_names.include?(&quot;cookie_key&quot;) &amp;&amp; :cookie_key) ||
+              :remember_token
+            )
+          else
+            write_inheritable_attribute(:remember_token_field, value)
+          end
+        end
+        alias_method :remember_token_field=, :remember_token_field
         
         # Works exactly like cookie_key, but for sessions. See cookie_key for more info.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; cookie_key
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def session_key
-          @session_key ||= cookie_key
+        def session_key(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:session_key) || session_key(cookie_key)
+          else
+            write_inheritable_attribute(:session_key, value)
+          end
         end
-        attr_writer :session_key
+        alias_method :session_key=, :session_key
         
         # The name of the method in your model used to verify the password. This should be an instance method. It should also be prepared to accept a raw password and a crytped password.
         #
         # * &lt;tt&gt;Default:&lt;/tt&gt; &quot;valid_#{password_field}?&quot;
         # * &lt;tt&gt;Accepts:&lt;/tt&gt; Symbol or String
-        def verify_password_method
-          @verify_password_method ||= &quot;valid_#{password_field}?&quot;
-        end
-        attr_writer :verify_password_method
+        def verify_password_method(value = nil)
+          if value.nil?
+            read_inheritable_attribute(:verify_password_method) || verify_password_method(&quot;valid_#{password_field}?&quot;)
+          else
+            write_inheritable_attribute(:verify_password_method, value)
+          end
+        end
+        alias_method :verify_password_method=, :verify_password_method
       end
       
       module InstanceMethods # :nodoc:</diff>
      <filename>lib/authgasm/session/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require &quot;digest/sha2&quot;
+
 module Authgasm
   # = Sha512 Crypto Provider
   #</diff>
      <filename>lib/authgasm/sha512_crypto_provider.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
 class User &lt; ActiveRecord::Base
   acts_as_authentic
+  belongs_to :account
 end</diff>
      <filename>test_app/app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,3 @@
 class UserSession &lt; Authgasm::Session::Base
-  self.remember_me = true
+  remember_me true
 end
\ No newline at end of file</diff>
      <filename>test_app/app/models/user_session.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@ class CreateUsers &lt; ActiveRecord::Migration
   def self.up
     create_table :users do |t|
       t.timestamps
+      t.integer :account_id, :null =&gt; false
       t.string :login, :null =&gt; false
       t.string :crypted_password
       t.string :password_salt</diff>
      <filename>test_app/db/migrate/20081023040052_create_users.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 ben:
   id: 1
+  account_id: 1
   login: bjohnson
   password_salt: &lt;%= salt = User.unique_token %&gt;
   crypted_password: &lt;%= Authgasm::Sha512CryptoProvider.encrypt(&quot;benrocks&quot; + salt) %&gt;
@@ -9,6 +10,7 @@ ben:
   
 zack:
   id: 2
+  account_id: 2
   login: zham
   password_salt: &lt;%= salt = User.unique_token %&gt;
   crypted_password: &lt;%= Authgasm::Sha512CryptoProvider.encrypt(&quot;zackrocks&quot; + salt) %&gt;</diff>
      <filename>test_app/test/fixtures/users.yml</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ class UserSessionStoriesTest &lt; ActionController::IntegrationTest
     assert_template &quot;users/new&quot;
     
     # Register successfully
-    post account_url, {:user =&gt; {:login =&gt; &quot;binarylogic&quot;, :password =&gt; &quot;pass&quot;, :confirm_password =&gt; &quot;pass&quot;, :first_name =&gt; &quot;Ben&quot;, :last_name =&gt; &quot;Johnson&quot;}}
+    post account_url, {:user =&gt; {:account_id =&gt; 1, :login =&gt; &quot;binarylogic&quot;, :password =&gt; &quot;pass&quot;, :confirm_password =&gt; &quot;pass&quot;, :first_name =&gt; &quot;Ben&quot;, :last_name =&gt; &quot;Johnson&quot;}}
     assert_redirected_to account_url
     assert flash.key?(:notice)
         </diff>
      <filename>test_app/test/integration/user_sesion_stories_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,6 +156,6 @@ class UserSessionTest &lt; ActionController::IntegrationTest
   end
   
   def test_save
-    # tested thoroughly in stories
+    # tested thoroughly in stories and in create above
   end
 end
\ No newline at end of file</diff>
      <filename>test_app/test/integration/user_session_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,40 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + &quot;/../config/environment&quot;)
 require 'test_help'
 
 class Test::Unit::TestCase
-  # Transactional fixtures accelerate your tests by wrapping each test method
-  # in a transaction that's rolled back on completion.  This ensures that the
-  # test database remains unchanged so your fixtures don't have to be reloaded
-  # between every test method.  Fewer database queries means faster tests.
-  #
-  # Read Mike Clark's excellent walkthrough at
-  #   http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
-  #
-  # Every Active Record database supports transactions except MyISAM tables
-  # in MySQL.  Turn off transactional fixtures in this case; however, if you
-  # don't care one way or the other, switching from MyISAM to InnoDB tables
-  # is recommended.
-  #
-  # The only drawback to using transactional fixtures is when you actually 
-  # need to test transactions.  Since your test is bracketed by a transaction,
-  # any transactions started in your code will be automatically rolled back.
   self.use_transactional_fixtures = true
-
-  # Instantiated fixtures are slow, but give you @david where otherwise you
-  # would need people(:david).  If you don't want to migrate your existing
-  # test cases which use the @david style and don't mind the speed hit (each
-  # instantiated fixtures translates to a database query per test method),
-  # then set this back to true.
   self.use_instantiated_fixtures  = false
-
-  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
-  #
-  # Note: You'll currently still have to declare fixtures explicitly in integration tests
-  # -- they do not yet inherit this setting
   fixtures :all
 end
 
 class ActionController::IntegrationTest
   def setup
+    #UserSession.reset_inheritable_attributes
     get new_user_session_url # to active authgasm
   end
   </diff>
      <filename>test_app/test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ec0eb78eeedc927b47fa04c112a4416c2e874a6f</id>
    </parent>
  </parents>
  <author>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </author>
  <url>http://github.com/binarylogic/authlogic/commit/38b6e9b8697fbd052db7be4667cafd093d94aaa4</url>
  <id>38b6e9b8697fbd052db7be4667cafd093d94aaa4</id>
  <committed-date>2008-11-02T10:54:07-08:00</committed-date>
  <authored-date>2008-11-02T10:54:07-08:00</authored-date>
  <message>Require abstract_adapter.rb</message>
  <tree>b119f7e4c4b5aed811fca9d852e2156af9bde2db</tree>
  <committer>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </committer>
</commit>
