<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>generators/roles/templates/hijacker.rb</filename>
    </added>
    <added>
      <filename>generators/roles/templates/role_requirement_system.rb.erb</filename>
    </added>
    <added>
      <filename>generators/roles/templates/role_requirement_test_helper.rb.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,6 @@
+Version 1.4 - March 4, 2008
+  * Integrated role and roles generators to simplify codebase
+
 Version 1.3.2 - November 20, 2007
   * Brought back test cases (now auto-evals the erb template to test to make sure the template for the generator is valid)
   * Increased test coverage</diff>
      <filename>ChangeLog</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Copyright (c) 2007 Timothy Curtis Harper
+Copyright (c) 2008 Timothy Curtis Harper and Jonathan Barket
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the</diff>
      <filename>MIT-LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -6,25 +6,10 @@ Each require_role line serves to add one or more required roles before executing
 require_role &quot;admin&quot;		&quot;Require that the current_user must have role admin before executing any action within this controller.&quot;
 
 
-
 ::&quot;Limiting&quot; Methods::
 =========================
 
-role_requirement accepts several methods as an options hash of key/value pairs. These methods work like clauses that limit the require_role line.
-	:for =&gt;               &quot;Evaluate this role requirement before executing ONLY the following actions in this controller...&quot;
-	:for_all_except =&gt;		&quot;Evaluate this role requirement before executing ALL actions in this controller EXCEPT the following...&quot;
-
-(note:  :only and :except also work, similarly to before_filter)
-
-These methods can be thought of as telling role_requirement when to evaluate current_user's roles.
-
-# Anytime an action is called, require the role admin in order to execute, EXCEPT when index is called.&quot; So, index passes through this require_role line allowing anyone to access it, ALL other actions are evaluated against the specified role(s).
-require_role &quot;admin&quot;, :for_all_except =&gt; :index
-
-# Means, &quot;Evaluate current_user's role(s) ONLY when index is called... and require admin in order to execute index.&quot; So, every action except index passes through this require_role line, ONLY index is evaluated.
-require_role &quot;admin&quot;, :for =&gt; :index
-
-
+As of 1.4, limiting keys have been adjusted to work in the same manner as the built in keys for before_filters
 
 
 ::How require_role Lines Work In Combination::
@@ -38,17 +23,16 @@ require_role &quot;executive&quot;
 
 
 require_role &quot;admin&quot;
-require_role &quot;executive&quot;, :for_all_except =&gt; [:index]
+require_role &quot;executive&quot;, :except =&gt; [:index]
 # This means that admin can access only index and executive can access everything in the controller except index.
 # The controller requires admin for every action AND looks for executive in order to execute every action except index. (Probably not a very useful configuration!)
 
 require_role &quot;admin&quot;
-require_role &quot;executive&quot;, :for =&gt; [:create, :update, :edit, :destroy]
+require_role &quot;executive&quot;, :only =&gt; [:create, :update, :edit, :destroy]
 # This means that admin can access the entire controller and executive is required only for index.
 # The controller always requires admin and requires executive only when index is called. Useful for allowing only executive to call certain, more restricted, actions, for example. 
 
 
-
 ::Passing Arrays::
 ==================
 role_requirement accepts arrays of roles and/or actions. When more than one role name or action name is passed, they work like &quot;OR&quot; in the requirement phrase.
@@ -57,10 +41,10 @@ role_requirement accepts arrays of roles and/or actions. When more than one role
 require_role [&quot;admin&quot;, &quot;executive&quot;]
 
 # The role admin is required to perform all actions in this controller EXCEPT list or show. So, anyone can list and show. admin can do anything.
-require_role &quot;admin&quot;, :for_all_except =&gt; [:list, :show]
+require_role &quot;admin&quot;, :except =&gt; [:list, :show]
 
 # The role admin is required to perform ONLY delete OR edit. Other actions are not evaluated. So, only admin can delete or edit. Others can do anything other than delete or edit.
-require_role &quot;admin&quot;, :for =&gt; [:delete, :edit]
+require_role &quot;admin&quot;, :only =&gt; [:delete, :edit]
 
 ::Admin::
 role_requirement's generator will automatically add a method to your user model, User#has_role?
@@ -68,7 +52,7 @@ This method, by default, always returns true for the role named &quot;admin.&quot; This ma
 
 # Allow finance to access every action but delete.  Admin can access everything, including delete.
 require_role :finance
-require_role :admin, :for =&gt; :delete
+require_role :admin, :only =&gt; :delete
 # Explanation: Finance can access the entire controller (and so can admin because admin always returns true for every role) AND admin is required to execute only the delete action.
 
 If you don't want this behavior, comment out the line that causes admin to always return true:
@@ -80,26 +64,25 @@ If you don't want this behavior, comment out the line that causes admin to alway
 You can also change the name of the &quot;all access&quot; role here. You can use any name that makes sense to you.
 
 
-
 ::Syntax::
 ==========
 If you use strings as keys for the options hash, it will throw an error. ie:
 
 # throws an error
-require_role &quot;admin&quot;, &quot;for&quot; =&gt; &quot;index&quot;
+require_role &quot;admin&quot;, &quot;only&quot; =&gt; &quot;index&quot;
 
 # works just fine
-require_role &quot;admin&quot;, :for =&gt; &quot;index&quot;
+require_role &quot;admin&quot;, :only =&gt; &quot;index&quot;
 
 RoleRequirement does not care if the values are symbols or strings, regarding action names. 
 
-require_role &quot;admin&quot;, :for =&gt; &quot;index&quot;
-require_role &quot;admin&quot;, :for =&gt; :index
+require_role &quot;admin&quot;, :only =&gt; &quot;index&quot;
+require_role &quot;admin&quot;, :only =&gt; :index
 
 Roles are passed to User#has_role? exactly as specified.  By default, RoleRequirement generates this method to not care.  If you customize User#has_role? in such a way that it does care, then you'll have problems. 
 
 # ultimately calls User#has_role?(&quot;admin&quot;)
-require_role &quot;admin&quot;, :for =&gt; :index
+require_role &quot;admin&quot;, :only =&gt; :index
 
 # ultimately calls User#has_role?(:admin)
-require_role :admin, :for =&gt; :index
+require_role :admin, :only =&gt; :index</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -25,11 +25,11 @@ module RoleGeneratorHelpers
   end
   
   def add_role_requirement_system(m)
-    m.template '../../shared_templates/role_requirement_system.rb.erb',
+    m.template 'role_requirement_system.rb.erb',
           File.join('lib', &quot;role_requirement_system.rb&quot;)
-    m.template '../../shared_templates/role_requirement_test_helper.rb.erb',
+    m.template 'role_requirement_test_helper.rb.erb',
           File.join('lib', &quot;role_requirement_test_helper.rb&quot;)
-    m.template '../../shared_templates/hijacker.rb',
+    m.template 'hijacker.rb',
           File.join('lib', &quot;hijacker.rb&quot;)
   end
   </diff>
      <filename>generators/role_generator_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,11 +5,10 @@ class RolesGenerator &lt; Rails::Generator::NamedBase
   include RoleGeneratorHelpers
   
   attr_accessor :roles_model_name, 
-    :roles_table_name, 
-    :users_table_name, 
-    :users_model_name,
-    :next_user_id
-  
+                :roles_table_name, 
+                :users_table_name, 
+                :users_model_name
+      
   def initialize(runtime_args, runtime_options = {})
     super
     @roles_model_name = (runtime_args[0] || &quot;Role&quot;).classify</diff>
      <filename>generators/roles/roles_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,12 @@
 class &lt;%= migration_name %&gt; &lt; ActiveRecord::Migration
   def self.up
     create_table &quot;&lt;%= roles_table_name %&gt;&quot; do |t|
-      t.column :name, :string
+      t.string :name
     end
     
     # generate the join table
     create_table &quot;&lt;%= habtm_name %&gt;&quot;, :id =&gt; false do |t|
-      t.column &quot;&lt;%= roles_foreign_key %&gt;&quot;, :integer
-      t.column &quot;&lt;%= users_foreign_key %&gt;&quot;, :integer
+      t.integer &quot;&lt;%= roles_foreign_key %&gt;&quot;, &quot;&lt;%= users_foreign_key %&gt;&quot;
     end
     add_index &quot;&lt;%= habtm_name %&gt;&quot;, &quot;&lt;%= roles_foreign_key %&gt;&quot;
     add_index &quot;&lt;%= habtm_name %&gt;&quot;, &quot;&lt;%= users_foreign_key %&gt;&quot;</diff>
      <filename>generators/roles/templates/001_roles_migration.rb.erb</filename>
    </modified>
    <modified>
      <diff>@@ -6,9 +6,6 @@
   # You may wish to modify it to suit your need
   has_and_belongs_to_many :&lt;%=roles_table_name%&gt;
   
-  attr_protected :roles
-
-  
   # has_role? simply needs to return true or false whether a user has a role or not.  
   # It may be a good idea to have &quot;admin&quot; roles return true always
   def has_role?(role_in_question)</diff>
      <filename>generators/roles/templates/_user_functions.erb</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ def include_rendered_template(abs_name, locals = {})
 end
 
 puts include_rendered_template(
-  File.join( File.dirname(__FILE__), &quot;../generators/shared_templates&quot;, &quot;role_requirement_system.rb.erb&quot;), 
+  File.join( File.dirname(__FILE__), &quot;../generators/roles/templates&quot;, &quot;role_requirement_system.rb.erb&quot;), 
   {:users_name =&gt; &quot;user&quot; }
 )
 </diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>generators/role/role_generator.rb</filename>
    </removed>
    <removed>
      <filename>generators/role/templates/001_add_role_to_users_migration.rb.erb</filename>
    </removed>
    <removed>
      <filename>generators/role/templates/_user_functions.erb</filename>
    </removed>
    <removed>
      <filename>generators/shared_templates/hijacker.rb</filename>
    </removed>
    <removed>
      <filename>generators/shared_templates/role_requirement_system.rb.erb</filename>
    </removed>
    <removed>
      <filename>generators/shared_templates/role_requirement_test_helper.rb.erb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>19b3bc82975d7f4354679feb908e57cfd1f3a705</id>
    </parent>
  </parents>
  <author>
    <name>jbarket</name>
    <email>jbarket@0128ec72-9f35-0410-83f6-31648bef6b25</email>
  </author>
  <url>http://github.com/timcharper/role_requirement/commit/9afb84019420f4b057bd8278457bb489e6a1daed</url>
  <id>9afb84019420f4b057bd8278457bb489e6a1daed</id>
  <committed-date>2008-03-04T18:31:23-08:00</committed-date>
  <authored-date>2008-03-04T18:31:23-08:00</authored-date>
  <message>Integrated role and roles to simplify codebase.
Mildly modified migrations to use Rails 2.x beautiful migrations


git-svn-id: http://rolerequirement.googlecode.com/svn/trunk@113 0128ec72-9f35-0410-83f6-31648bef6b25</message>
  <tree>676a4faea93bada26205fae997b250147e92612c</tree>
  <committer>
    <name>jbarket</name>
    <email>jbarket@0128ec72-9f35-0410-83f6-31648bef6b25</email>
  </committer>
</commit>
