Changeset 447
- Timestamp:
- 08/24/06 03:09:40 (2 years ago)
- Files:
-
- user_engine/trunk/CHANGELOG (modified) (1 diff)
- user_engine/trunk/README (modified) (2 diffs)
- user_engine/trunk/app/models/permission.rb (modified) (2 diffs)
- user_engine/trunk/app/views/permission/list.rhtml (modified) (1 diff)
- user_engine/trunk/app/views/role/list.rhtml (modified) (1 diff)
- user_engine/trunk/app/views/role/show.rhtml (modified) (1 diff)
- user_engine/trunk/app/views/user/_roles.rhtml (modified) (1 diff)
- user_engine/trunk/app/views/user/edit_user.rhtml (modified) (1 diff)
- user_engine/trunk/app/views/user/list.rhtml (modified) (1 diff)
- user_engine/trunk/install.rb (copied) (copied from user_engine/branches/rb_1.0/install.rb)
- user_engine/trunk/lib/user_engine.rb (modified) (1 diff)
- user_engine/trunk/lib/user_engine/authorized_system.rb (modified) (1 diff)
- user_engine/trunk/test/functional/role_controller_test.rb (modified) (2 diffs)
- user_engine/trunk/test/functional/user_controller_test.rb (modified) (1 diff)
- user_engine/trunk/test/test_helper.rb (modified) (2 diffs)
- user_engine/trunk/test/unit/permission_test.rb (modified) (1 diff)
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) 2 4 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 60 60 7. 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: 61 61 62 rake engine_migrate62 rake db:engines:migrate 63 63 64 64 to move all engines to their latest versions, or 65 65 66 rake engine_migrate ENGINE=user66 rake db:engines:migrate ENGINE=user 67 67 68 68 to migrate only this engine. Alternatively, if you just want to load the full schema information for the User and LoginEngines, run … … 87 87 12. 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: 88 88 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 90 92 * The UserController#edit action has been overriden to know about Roles. See user_engine/app/user_controller.rb for details. 91 93 * 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 45 45 # weird hack. otherwise ActiveRecord has no idea about the superclass of any 46 46 # ActionController stuff... 47 require RAILS_ROOT + "/app/controllers/application"47 require_dependency RAILS_ROOT + "/app/controllers/application" 48 48 49 49 # Load all the controller files … … 56 56 # we need to load all the controllers... 57 57 controller_files.each do |file_name| 58 require file_name #if /_controller.rb$/ =~ file_name58 require_dependency file_name #if /_controller.rb$/ =~ file_name 59 59 end 60 60 user_engine/trunk/app/views/permission/list.rhtml
r117 r447 18 18 <%= link_if_authorized 'Show', {:action => 'show', :id => permission}, :wrap_in => "li" %> 19 19 <%= 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 %> 21 21 </ul> 22 22 </td> user_engine/trunk/app/views/role/list.rhtml
r117 r447 19 19 <%= link_if_authorized 'Edit', {:action => 'edit', :id => role}, :wrap_in => "li" %> 20 20 <% 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 %> 22 22 </ul> 23 23 </td> user_engine/trunk/app/views/role/show.rhtml
r297 r447 14 14 <th><%= controller_name.capitalize %></th> 15 15 <% end %> 16 </tr></ head>16 </tr></thead> 17 17 <tbody><tr> 18 18 <% @all_actions.sort.each do |controller_name,permissions| %> user_engine/trunk/app/views/user/_roles.rhtml
r97 r447 15 15 16 16 <% if submit %> 17 <%= form_input :submit_button, 'Save Roles', :class => 'two_columns'%>17 <%= submit_tag "Save Roles", :name => "submit" %> 18 18 <% end %> user_engine/trunk/app/views/user/edit_user.rhtml
r147 r447 40 40 <div id="user_delete"> 41 41 <%= hidden_field 'user', 'form', :value => 'delete' %> 42 43 <%= form_input :submit_button, 'Delete Account' %> 42 <%= submit_tag "Delete Account", :name => 'submit' %> 44 43 </div> 45 44 <%= end_form_tag %> user_engine/trunk/app/views/user/list.rhtml
r132 r447 18 18 <%= link_if_authorized 'Show', {:action => 'show', :id => user}, :wrap_in => "li" %> 19 19 <%= 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 %> 21 21 </ul> 22 22 </td> user_engine/trunk/lib/user_engine.rb
r323 r447 104 104 if @warning != nil 105 105 Engines.logger.warn @warning 106 puts @warning106 #puts @warning 107 107 end 108 108 end user_engine/trunk/lib/user_engine/authorized_system.rb
r326 r447 153 153 # one or more of their associated roles. Let them pass.. 154 154 155 @session["prev_uri"] = @request.request_uri155 session["prev_uri"] = request.request_uri 156 156 return true 157 157 end user_engine/trunk/test/functional/role_controller_test.rb
r293 r447 35 35 #========================================================================== 36 36 37 def assert_new_role37 def test_assert_new_role 38 38 get :new 39 39 assert_response :success … … 55 55 assert_errors 56 56 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') 57 63 end 58 64 user_engine/trunk/test/functional/user_controller_test.rb
r293 r447 234 234 assert_equal 0, ActionMailer::Base.deliveries.size 235 235 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" } 239 240 assert_session_has :user 240 241 end user_engine/trunk/test/test_helper.rb
r293 r447 2 2 3 3 # ensure that the Engines testing enhancements are loaded. 4 require File.join(Engines.config(:root), "engines", "lib", " testing_extensions")4 require File.join(Engines.config(:root), "engines", "lib", "engines", "testing_extensions") 5 5 6 6 … … 29 29 30 30 # 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")) 32 32 require File.join(Engines.get(:login).root, 'test', 'mocks', 'time') 33 33 require File.join(Engines.get(:login).root, 'test', 'mocks', 'mail') user_engine/trunk/test/unit/permission_test.rb
r279 r447 4 4 5 5 def test_table_name 6 assert_equal ActiveRecord::Base.wrapped_table_name(UserEngine.config(:permission_table _name)), Permission.table_name6 assert_equal ActiveRecord::Base.wrapped_table_name(UserEngine.config(:permission_table)), Permission.table_name 7 7 end 8 8
