Changeset 447

Show
Ignore:
Timestamp:
08/24/06 03:09:40 (2 years ago)
Author:
snowblink
Message:

Merged UserEngine? rb_1.0 changes r327:444 into trunk
Corresponds to tagged release UserEngine? 1.0.2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • user_engine/trunk/CHANGELOG

    r293 r447  
    1 *SVN* 
     1= SVN 
     2* Changed default name of role-user join table from users_roles to roles_users (Ticket #51) 
     3* Default table names now respect any set prefix/suffix from ActiveRecord (Ticket #67) 
    24 
    3 - Changed default name of role-user join table from users_roles to roles_users (Ticket #51) 
    4 - Default table names now respect any set prefix/suffix from ActiveRecord (Ticket #67) 
     5= v1.0.2 (2006-08-22) 
     6* Added Changelog (snowblink@gmail.com) 
     7* Ticket #81 (anonymous) link_if_authorized let 'wrap_in' option into link attributes 
     8* Ticket #92 (Jason Sypher, Corey Jewett) To allow to migrate down, drop_table instead of remove_column 
     9* Ticket #102 (ziggy@ignition-project.com, François Beausoleil) Typo in README: 'steath' instead of 'stealth' 
     10* Ticket #109 (morris@wolfman.com, snowblink@gmail.com) User and roles controllers updated to paginate properly, and match headers to columns in views 
     11* Ticket #127 (lazyatom) Add install.rb to allow for "auto install" of engines plugin via script/install 
     12* Ticket #139 (sross@calicowebdev.com) Updated README to show new rake task syntax, and how to override the User model 
     13* Ticket #147 (lazyatom) Engines loading mechanism is side-stepped when running Permission.sync. Now using require_dependency instead of require 
     14* Ticket #151 (Surendra Singhi) Tests updated to work 
     15* Ticket #160 (me@casperfabricius.com) Removed puts warning from check_system_roles, as it can cause problems for Apache/FastCGI 
     16* Ticket #198 (fastjames@gmail.com) Fixed deprecated reference to @session in user engine 
     17* Ticket #202 (snowblink@gmail.com) Tidied up views to generate valid HTML 4.0.1 Transition 
     18* Ticket #204 (snowblink@gmail.com) Test password changed even if email delivery fails 
     19* Ticket #206 (snowblink@gmail.com) Fixed Permission test 
     20 
     21= v1.0.1 (2006-01-12) r223 
  • user_engine/trunk/README

    r326 r447  
    60607. Initialize the database tables. You must ensure that the tables for the LoginEngine are present since this engine builds on top of them. You will probably get a warning if this is your first installation of the User Engine, indicating that you don't have an Admin role - that's fine, we'll be creating it later. You can either use the engine migrations by calling: 
    6161 
    62     rake engine_migrate 
     62    rake db:engines:migrate 
    6363 
    6464  to move all engines to their latest versions, or 
    6565 
    66     rake engine_migrate ENGINE=user 
     66    rake db:engines:migrate ENGINE=user 
    6767 
    6868  to migrate only this engine. Alternatively, if you just want to load the full schema information for the User and LoginEngines, run 
     
    878712. Since the UserEngine overrides some of the default behaviour in the LoginEngine, if you have made your own modifications within your app directory, you'll probably want to examine these changes to make sure that your own customisations will still operate as expected. You'll need to look at the following: 
    8888 
    89 * The UserEngine's models/user.rb model will override the default given in LoginEngine. If you have your own app/models/user.rb file, you'll need to include UserEngine::AuthorizedUser in your file. 
     89* The UserEngine's models/user.rb model will override the default given in LoginEngine. If you have your own app/models/user.rb file, you'll need to: 
     90  include LoginEngine::AuthenticatedUser 
     91  include UserEngine::AuthorizedUser 
    9092* The UserController#edit action has been overriden to know about Roles. See user_engine/app/user_controller.rb for details. 
    9193* Many new methods for administrating users, roles and permissions have been provided - again, see user_engine/app/user_controller.rb. 
  • user_engine/trunk/app/models/permission.rb

    r279 r447  
    4545      # weird hack. otherwise ActiveRecord has no idea about the superclass of any 
    4646      # ActionController stuff... 
    47       require RAILS_ROOT + "/app/controllers/application" 
     47      require_dependency RAILS_ROOT + "/app/controllers/application" 
    4848     
    4949      # Load all the controller files 
     
    5656      # we need to load all the controllers... 
    5757      controller_files.each do |file_name| 
    58         require file_name #if /_controller.rb$/ =~ file_name 
     58        require_dependency file_name #if /_controller.rb$/ =~ file_name 
    5959      end 
    6060 
  • user_engine/trunk/app/views/permission/list.rhtml

    r117 r447  
    1818        <%= link_if_authorized 'Show', {:action => 'show', :id => permission}, :wrap_in => "li" %> 
    1919        <%= link_if_authorized 'Edit', {:action => 'edit', :id => permission}, :wrap_in => "li" %> 
    20         <% if authorized?(:action => 'destroy') %><%= button_to 'Destroy', {:action => 'destroy', :id => permission} %><% end %> 
     20        <% if authorized?(:action => 'destroy') %><li><%= button_to 'Destroy', {:action => 'destroy', :id => permission} %></li><% end %> 
    2121      </ul> 
    2222    </td> 
  • user_engine/trunk/app/views/role/list.rhtml

    r117 r447  
    1919        <%= link_if_authorized 'Edit', {:action => 'edit', :id => role}, :wrap_in => "li" %> 
    2020        <% if authorized?(:action => 'destroy') && (not UserEngine.config([:guest_role_name, :user_role_name, :admin_role_name]).include?(role.name)) %> 
    21         <%= button_to 'Destroy', :action => 'destroy', :id => role  %><% end %> 
     21        <li><%= button_to 'Destroy', :action => 'destroy', :id => role  %></li><% end %> 
    2222      </ul> 
    2323    </td> 
  • user_engine/trunk/app/views/role/show.rhtml

    r297 r447  
    1414        <th><%= controller_name.capitalize %></th> 
    1515  <% end %> 
    16     </tr></head> 
     16    </tr></thead> 
    1717    <tbody><tr> 
    1818  <% @all_actions.sort.each do |controller_name,permissions| %> 
  • user_engine/trunk/app/views/user/_roles.rhtml

    r97 r447  
    1515 
    1616<% if submit %> 
    17   <%= form_input :submit_button, 'Save Roles', :class => 'two_columns' %> 
     17<%= submit_tag "Save Roles", :name => "submit" %> 
    1818<% end %> 
  • user_engine/trunk/app/views/user/edit_user.rhtml

    r147 r447  
    4040    <div id="user_delete"> 
    4141      <%= hidden_field 'user', 'form', :value => 'delete' %> 
    42  
    43       <%= form_input :submit_button, 'Delete Account' %> 
     42      <%= submit_tag "Delete Account", :name => 'submit' %> 
    4443    </div> 
    4544  <%= end_form_tag %> 
  • user_engine/trunk/app/views/user/list.rhtml

    r132 r447  
    1818        <%= link_if_authorized 'Show', {:action => 'show', :id => user}, :wrap_in => "li" %> 
    1919        <%= link_if_authorized 'Edit', {:action => 'edit_user', :id => user}, :wrap_in => "li" %> 
    20         <% if authorized?(:action => 'delete_user') && (user.login != UserEngine.config(:admin_login)) %><%= button_to 'Destroy', :action => 'delete_user', :id => user %><% end %> 
     20        <% if authorized?(:action => 'delete_user') && (user.login != UserEngine.config(:admin_login)) %><li><%= button_to 'Destroy', :action => 'delete_user', :id => user %></li><% end %> 
    2121      </ul> 
    2222    </td>   
  • user_engine/trunk/lib/user_engine.rb

    r323 r447  
    104104    if @warning != nil 
    105105      Engines.logger.warn @warning 
    106       puts @warning 
     106      #puts @warning 
    107107    end 
    108108  end 
  • user_engine/trunk/lib/user_engine/authorized_system.rb

    r326 r447  
    153153        # one or more of their associated roles. Let them pass.. 
    154154 
    155         @session["prev_uri"] = @request.request_uri 
     155        session["prev_uri"] = request.request_uri 
    156156        return true         
    157157      end 
  • user_engine/trunk/test/functional/role_controller_test.rb

    r293 r447  
    3535  #========================================================================== 
    3636 
    37   def assert_new_role 
     37  def test_assert_new_role 
    3838    get :new 
    3939    assert_response :success 
     
    5555    assert_errors 
    5656    assert_invalid_column_on_record 'role', 'name'     
     57  end 
     58 
     59  # PostgreSQL does not assume NULL = 0 
     60  def test_creating_a_new_role_on_postgresql 
     61    post :new, :role => {:name => 'postgres_name', :description => 'description'} 
     62    assert_not_nil Role.find_by_name('postgres_name') 
    5763  end 
    5864   
  • user_engine/trunk/test/functional/user_controller_test.rb

    r293 r447  
    234234    assert_equal 0, ActionMailer::Base.deliveries.size 
    235235    assert_match /Password could not be changed/, flash[:warning] 
    236      
    237     # ensure we can log in with our original password 
    238     post :login, :user => { :login => "normal_user", :password => "atest" } 
     236    #get :logout 
     237     
     238    # ensure we can log in with new password 
     239    post :login, :user => { :login => "normal_user", :password => "changed_password" } 
    239240    assert_session_has :user 
    240241  end   
  • user_engine/trunk/test/test_helper.rb

    r293 r447  
    22 
    33# ensure that the Engines testing enhancements are loaded. 
    4 require File.join(Engines.config(:root), "engines", "lib", "testing_extensions") 
     4require File.join(Engines.config(:root), "engines", "lib", "engines", "testing_extensions") 
    55 
    66 
     
    2929 
    3030# Load the LoginEngine schema & mocks 
    31 load(File.join(Engines.get(:login).root, "db", "schema.rb")) 
     31#load(File.join(Engines.get(:login).root, "db", "schema.rb")) 
    3232require File.join(Engines.get(:login).root, 'test', 'mocks', 'time') 
    3333require File.join(Engines.get(:login).root, 'test', 'mocks', 'mail') 
  • user_engine/trunk/test/unit/permission_test.rb

    r279 r447  
    44   
    55  def test_table_name 
    6     assert_equal ActiveRecord::Base.wrapped_table_name(UserEngine.config(:permission_table_name)), Permission.table_name 
     6    assert_equal ActiveRecord::Base.wrapped_table_name(UserEngine.config(:permission_table)), Permission.table_name 
    77  end 
    88