From 8a51b458a9a2b11c7451b0d3dd5061d066f5da82 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 5 Mar 2014 03:35:27 -0800 Subject: [PATCH 01/18] use .ruby-version and .ruby-gemset --- .ruby-gemset | 1 + .ruby-version | 1 + .rvmrc | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version delete mode 100644 .rvmrc diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..58f250b1 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +freehub diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..39f0a337 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +1.8.7-p375 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 4357d1f1..00000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm --create ruby-1.8.7@freehub From 1df27b0046062c49626208a27be270796ec71ee6 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Wed, 5 Mar 2014 03:37:22 -0800 Subject: [PATCH 02/18] wip - bump ruby version to 1.9.3-p545 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 39f0a337..671d1fe4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.8.7-p375 +1.9.3-p545 From 2d73bd72d66a6757af07bc6ab7fe1ce046009ad2 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Fri, 7 Mar 2014 17:16:54 +0000 Subject: [PATCH 03/18] add draft todo list --- todo | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 todo diff --git a/todo b/todo new file mode 100644 index 00000000..3de4fda6 --- /dev/null +++ b/todo @@ -0,0 +1,18 @@ +Move to new ruby / rails version +================================ + +The vendor plugins are very old and the format of keeping +them in a vendor dir is depricated. +rails-authorization-plugin +is a pain because it hasn't been worked on in years, +can we switch to using devise? Not sure if that would make +existing users lose their passwords. + +In the newer versions of rails the initialization / boot process +has changed. We need to migrate the config files to the new format. + + +Time zone issues +================ +The build only works on when using Pacific Ocean time zone. Some where +in the tests (maybe the fixtures..?) there is a implicit assumption. From 3c06ecc2c471703ca30f6d048db5641f121619c6 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Sat, 8 Mar 2014 22:11:19 +0000 Subject: [PATCH 04/18] add config/app --- config/application.rb | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 config/application.rb diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 00000000..b811bf4f --- /dev/null +++ b/config/application.rb @@ -0,0 +1,62 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module Del + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end From beec634b77d84c097182ab279a720cdf7b6f5d05 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Tue, 11 Mar 2014 09:55:31 +0000 Subject: [PATCH 05/18] use https://rubygems.org in Gemfile --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 7cf560b9..a8c4b6fd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source :gemcutter, :rubygems +source 'https://rubygems.org' gem "rails", "2.3.17" gem "mysql" diff --git a/Gemfile.lock b/Gemfile.lock index 8b68d32d..a36fd172 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: actionmailer (2.3.17) actionpack (= 2.3.17) From e4c674f6ed9607dd18b31ead0a9cd7dbe257638a Mon Sep 17 00:00:00 2001 From: alex-frost Date: Fri, 14 Mar 2014 12:49:29 +0000 Subject: [PATCH 06/18] rm old authorization, use one from github instead --- Gemfile | 3 +- Gemfile.lock | 30 +- vendor/plugins/authorization/CHANGELOG.txt | 154 ---------- vendor/plugins/authorization/MIT-LICENSE | 20 -- vendor/plugins/authorization/README.txt | 267 ------------------ vendor/plugins/authorization/Rakefile | 22 -- vendor/plugins/authorization/about.yml | 8 - .../doc/authorization_example.gif | Bin 22718 -> 0 bytes .../doc/authorization_example.rb | 38 --- .../authorization/generators/role_model/USAGE | 20 -- .../role_model/role_model_generator.rb | 35 --- .../role_model/templates/fixtures.yml | 5 - .../role_model/templates/migration.rb | 21 -- .../generators/role_model/templates/model.rb | 8 - .../role_model/templates/unit_test.rb | 10 - vendor/plugins/authorization/init.rb | 29 -- vendor/plugins/authorization/install.rb | 2 - .../authorization/lib/authorization.rb | 143 ---------- .../lib/publishare/exceptions.rb | 41 --- .../lib/publishare/hardwired_roles.rb | 82 ------ .../authorization/lib/publishare/identity.rb | 119 -------- .../lib/publishare/object_roles_table.rb | 116 -------- .../authorization/lib/publishare/parser.rb | 210 -------------- .../tasks/authorization_tasks.rake | 4 - vendor/plugins/authorization/test/README.txt | 3 - 25 files changed, 25 insertions(+), 1365 deletions(-) delete mode 100644 vendor/plugins/authorization/CHANGELOG.txt delete mode 100644 vendor/plugins/authorization/MIT-LICENSE delete mode 100644 vendor/plugins/authorization/README.txt delete mode 100644 vendor/plugins/authorization/Rakefile delete mode 100644 vendor/plugins/authorization/about.yml delete mode 100644 vendor/plugins/authorization/doc/authorization_example.gif delete mode 100644 vendor/plugins/authorization/doc/authorization_example.rb delete mode 100644 vendor/plugins/authorization/generators/role_model/USAGE delete mode 100644 vendor/plugins/authorization/generators/role_model/role_model_generator.rb delete mode 100644 vendor/plugins/authorization/generators/role_model/templates/fixtures.yml delete mode 100644 vendor/plugins/authorization/generators/role_model/templates/migration.rb delete mode 100644 vendor/plugins/authorization/generators/role_model/templates/model.rb delete mode 100644 vendor/plugins/authorization/generators/role_model/templates/unit_test.rb delete mode 100644 vendor/plugins/authorization/init.rb delete mode 100644 vendor/plugins/authorization/install.rb delete mode 100644 vendor/plugins/authorization/lib/authorization.rb delete mode 100644 vendor/plugins/authorization/lib/publishare/exceptions.rb delete mode 100644 vendor/plugins/authorization/lib/publishare/hardwired_roles.rb delete mode 100644 vendor/plugins/authorization/lib/publishare/identity.rb delete mode 100644 vendor/plugins/authorization/lib/publishare/object_roles_table.rb delete mode 100644 vendor/plugins/authorization/lib/publishare/parser.rb delete mode 100644 vendor/plugins/authorization/tasks/authorization_tasks.rake delete mode 100644 vendor/plugins/authorization/test/README.txt diff --git a/Gemfile b/Gemfile index a8c4b6fd..91195703 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gem "rails", "2.3.17" gem "mysql" - +gem "authorization", github: "alex-frost/rails-authorization-plugin" gem 'json', '1.7.7' # (CVE-2013-026) Can remove once rails depends on > 1.7.6 gem 'haml', "3.0.25" gem 'googlecharts', "1.6.0" @@ -12,6 +12,7 @@ gem "newrelic_rpm" gem 'hoptoad_notifier' group :development, :test do + gem 'debugger' gem 'rdoc' gem 'annotate' gem 'thoughtbot-shoulda' diff --git a/Gemfile.lock b/Gemfile.lock index a36fd172..befcb2d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,9 @@ +GIT + remote: git://github.com/alex-frost/rails-authorization-plugin.git + revision: 83c1a1269b862a6978954ae9778399804f67bcd1 + specs: + authorization (1.0.12) + GEM remote: https://rubygems.org/ specs: @@ -12,18 +18,26 @@ GEM activesupport (= 2.3.17) activesupport (2.3.17) acts-as-taggable-on (2.0.6) - annotate (2.5.0) - rake - builder (3.1.4) + annotate (2.6.2) + activerecord (>= 2.3.0) + rake (>= 0.8.7) + builder (3.2.2) calendar_date_select (1.16.1) + columnize (0.3.6) + debugger (1.6.6) + columnize (>= 0.3.1) + debugger-linecache (~> 1.2.0) + debugger-ruby_core_source (~> 1.3.2) + debugger-linecache (1.2.0) + debugger-ruby_core_source (1.3.2) googlecharts (1.6.0) haml (3.0.25) hoptoad_notifier (2.4.11) activesupport builder json (1.7.7) - mysql (2.9.0) - newrelic_rpm (3.5.5.38) + mysql (2.9.1) + newrelic_rpm (3.7.3.204) rack (1.1.6) rails (2.3.17) actionmailer (= 2.3.17) @@ -32,8 +46,8 @@ GEM activeresource (= 2.3.17) activesupport (= 2.3.17) rake (>= 0.8.3) - rake (10.0.3) - rdoc (3.12) + rake (10.1.1) + rdoc (4.1.1) json (~> 1.4) thoughtbot-shoulda (2.11.1) @@ -43,7 +57,9 @@ PLATFORMS DEPENDENCIES acts-as-taggable-on (= 2.0.6) annotate + authorization! calendar_date_select (= 1.16.1) + debugger googlecharts (= 1.6.0) haml (= 3.0.25) hoptoad_notifier diff --git a/vendor/plugins/authorization/CHANGELOG.txt b/vendor/plugins/authorization/CHANGELOG.txt deleted file mode 100644 index e420f71d..00000000 --- a/vendor/plugins/authorization/CHANGELOG.txt +++ /dev/null @@ -1,154 +0,0 @@ -TO DO -+ Add Right model generator and DB-backed way of handling rights in addition to inlined "permit" checks -+ Added namespacing to @options instance variable to prevent possible name clashes -+ Add test generator instead of handling tests in test apps -+ Add support for groups -+ Extend grammar to allow "(admin or moderator or some_role) of some_model" (?) [Chris Hapgood] -+ Extend coverage to models. Look at Bruce Perens's ModelSecurity and access with_scope. (9/3006 - Recently investigated extension to model and the most programmer-friendly DSLs may require too much hacking on ActiveRecord.) - - -CHANGES (from most recent to oldest) - -=== 1.0.9 release (February 26, 2008) - -* Patch #8571 : Add type argument to is_role_of_what submitted by Aslak Hellesøy (aslak_hellesoy) - - In my RESTful index views for an AR type I often want to list all of the records *for a given type* for which the current - user has the role "show". (As opposed to getting *any* record for which the user has the role) - - In order to achieve this, I have patched identity.rb so tht I can do this: - - def index - if current_user.permit? 'admin' - # show all projects - @projects = Project.find(:all) - else - @projects = current_user.is_show_for_what(Project) - end - end - -=== 1.0.8 release (February 26, 2008) - -* Patch #11352 : Fixes a bug with role_regex and simple quoted roles submitted by 'a French RoR developer' - - Documentation says: - - ::= /\w+/ | /'.*'/ - - But the next permission string isn't well parsed: " 'abcd:efgh' or 'abcd:ijkl' " - You get an error because the role_regex defined in parser.rb eats every simple quote between the first and the last - simple quote in the string. - - So i patched the two instances of role_regex in parser.rb, from this: - role_regex = '\s*(\'\s*(.+)\s*\'|([A-Za-z]\w*))\s*' - - to this (the question mark ends the first pattern as soon as possible, avoiding the inner simple quotes to be eaten): - role_regex = '\s*(\'\s*(.+?)\s*\'|([A-Za-z]\w*))\s*' - -=== 1.0.7 release (February 25, 2008) - -* Patch #9431 : Fixes a bug in identity.rb submitted by Michel Martens (blaumag) - - If some authorizable instance accepts a role, then it responds true when queried for has_[role_name]? - - Example: - country.has_kings? #=> false - - user.has_role "king", country - country.has_kings? #=> true - - user.has_no_role "king", country - country.has_kings? #=> true - - The last time, country.has_kings? should be false. - -=== 1.0.6 release (February 25, 2008) - -* Patch #12170 : Additional HABTM options for acts_as_authorized_user - A very simple patch that allows options to be passed to the has_and_belogs_to_many relationship. This seems necessary - if the "User" object has a different name from the table name. has_and_belong_to_many does not automatically - use the table set by the "User" object so it must be specified (along with the foreign key if applicable). - - Patch submitted by Eric Anderson (eric1234) - -=== 1.0.5 release (February 25, 2008) - -* Feature : Add additional test for current_user being set to the symbol ':false'. - This is for compatibility with the restful_authentication plugin which will - set current_user to :false on a bad login. Previously we were only testing - for current_user.nil? which was incomplete. - -=== 1.0.4 release (February 25, 2008) - -* Bugfix : RubyForge bug #9368. Problems with about.yml - Fixes a minor bug in the about.yml plugin metadata file - so that it will parse cleanly. [GR] - -=== 1.0.3 release (February 17, 2008) - -* Minor changes to USAGE text for ./script/generate role_model - -=== 1.0.2 release (February 17, 2008) - -* From this release forward the plugin requires use of Ruby on Rails version 2.x. Version 1.0.1 is the final release fully compatible with Rails 1.2.x. -* Upgraded the database migration generator to create the new Rails 2.0.x style 'sexy migrations'. - -=== 1.0.1 release (February 17, 2008) - -* Moved source code to public Git repository at GitHub.com (http://github.com/DocSavage/rails-authorization-plugin/tree/master) -* Removed attr_protected declaration from acts_as_authorized_user, acts_as_authorizable methods. These conflicted with usage of the Authorization plugin with models generated by the restful_authentication generator or any model that specified the safer attr_accessible whitelist. RA encourages the safer attr_accessible whitelisting of attributes that are accessible from its models. You cannot apply both attr_accessible and attr_protected in the same model. Users are encouraged to specify a whitelist of attr_accessible model attributes for their applications security. [grempe] - -=== SVN - -* Performance improvement for has_role? [Sean Geoghegan] - -* Allow customization of message on redirection after failed authorization (:redirect_message option) [Joey Geiger] - -* Patch to allow authorizable objects that use single table inheritance (STI) [Sean Geoghegan] - -=== 1.0 release (Sept 13, 2006) - -* Added attr_protected for habtm and has_many role ids to block security concern if developers use update_attributes(params[:auth_obj]) on an authorizable object [Michael Schuerig] - -* Use before_filter rather than prepend_before_filter so necessary instance variables (and methods) can be established before trying authorization checks. This fix came about for Mephisto blog where a class-level permit "admin of site" was used. The site attribute was set in a before_filter. If you prepend your authorization filter, it will execute before any other before_filter, which is probably not a good idea. - -* Add "about" yaml for future Rails plugin directory. - -* Cleaned up exception handling a little [due to suggestion by Michael Schuerig] - -* Add generator for role model and migration, e.g., "script/generate role_model Role". - Role model must be called "Role" at this time. More general naming as a TO DO. - -* Removed simple_roles_table to simplify plugin. - -* Moved all files in Authorization namespace into /publishare subdirectory - to reduce danger of clashes in load path [nod to Michael Schuerig]. - -* Small code refinement patch [Michael Schuerig] - -* The colon preceding a model name in the authorization expression is now optional. The parser uses accepted prepositions to disambiguate models from roles. - -* Change default parser from Recursive Descent parser to Eval parser. -Currently implemented recursive descent parser doesn't handle left-sided -boolean expressions well. Eval parser relies on Ruby (good thing), but -wherever there's an eval, we have to be more careful. - -* Will start linking to and monitoring forum area at RubyForge -http://rubyforge.org/forum/?group_id=1797 - -* Added changelog :) - -* Added return false to handle_redirection to short-circuit filters if -redirect occurs. This is second fix to prevent double renders. - -* Changed the requires to pull files from the plugin directory. (Necessary for name conflicts between plugin and apps) - -* Minor fixes to update documentation - -=== 1.0 rc3 (July 19, 2006) - -* Fix to prevent double redirect - -* Fix to migration examples - -... see svn log diff --git a/vendor/plugins/authorization/MIT-LICENSE b/vendor/plugins/authorization/MIT-LICENSE deleted file mode 100644 index 8c6bf6c8..00000000 --- a/vendor/plugins/authorization/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2006 William T Katz - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/plugins/authorization/README.txt b/vendor/plugins/authorization/README.txt deleted file mode 100644 index 0f092796..00000000 --- a/vendor/plugins/authorization/README.txt +++ /dev/null @@ -1,267 +0,0 @@ -= Authorization plugin - -http://www.writertopia.com/developers/authorization - -This plugin provides a flexible way to add authorization to Rails. - -The authorization process decides whether a user is allowed access to some feature. -It is distinct from the authentication process, which tries to confirm a user is -authentic, not an imposter. There are many authentication systems available for Rails, -e.g., acts_as_authenticated and LoginEngine. This authorization system -will play nicely with them as long as some simple requirements are met: - -1. User objects are available that implement a has_role?(role, authorizable_object = nil) method. This requirement can be easily handled by using acts_as_authorized_user in the User-like class. - -2. If you want to use "role of model" authorization expressions, like "owner of resource" or "eligible for :award", then your models with roles must implement an accepts_role?(role, user) method. This requirement can be handled by using acts_as_authorizable in the model class. - -The authorization plugin provides the following: -* A simple way of checking authorization at either the class or instance method level using #permit and #permit? -* Authorization using roles for the entire application, a model class, or an instance of a model (i.e., a particular object). -* Some english-like dynamic methods that draw on the defined roles. You will be able to use methods like "user.is_fan_of angelina" or "angelina.has_fans?", where a 'fan' is only defined in the roles table. -* Pick-and-choose a mixin for your desired level of database complexity. For all the features, you will want to use "object roles table" (see below) - - -== Installation - -There are currently two recommended ways of installing the plugin into your Rails application, via Git (Recommended) and a manual install from a .zip file. - -Install using Git: -The source code for this plugin is maintained in a Git SCM repository. This will always have the latest version of the code and is the recommended source for installation. You can install the plugin using Git sub-modules (which are akin to using SVN externals). Installing this way allows you to update the plugin code later if needed (but note that it will not update any generated code created earlier by this plugin, you would need to do that manually). - -From your RAILS_ROOT directory run: -git-submodule add git://github.com/DocSavage/rails-authorization-plugin.git vendor/plugins/authorization - -You should be able to update this plugin in the future with a simple 'git submodule update' from your rails root. - -Manual Install: -- Download the latest .zip file of the plugin from RubyForge ( http://rubyforge.org/frs/?group_id=1797 ) and save it to your RAILS_ROOT/vendor/plugins folder. -- Unpack the zip file which should create the directory vendor/plugins/authorization -- Remove the original .zip file. - - -== Steps in using the plugin - -1. At the top of your config/environment.rb create an AUTHORIZATION_MIXIN constant and set it to "object roles" or "hardwired". (See init.rb in this plugin for how the role support is mixed in.) -2. Make sure your application provides a current_user method or something that returns the current user object. Add the constants in environment.rb to set your authentication systemís login page (DEFAULT_REDIRECTION_HASH) and method for storing the current URL for return after authentication (STORE_LOCATION_METHOD). (See authorization.rb in the plugin's /lib directory for the default values of DEFAULT_REDIRECTION_HASH and STORE_LOCATION_METHOD.) -3. If you use the "hardwired" mixin, no database use is required. Otherwise, you'll have to generate a role.rb model (and its associated join table with User) by running "script/generate role_model Role" and doing "rake migrate". -4. Add acts_as_authorized_user to your user class. -5. Add acts_as_authorizable to the models you want to query for roles. - -== Jumpstarting with a mixin - -The Authorization plugin comes with two modules that provide different levels of database support. -Each of the mixins provide the acts_as_authorized_user and acts_as_authorizable -class methods for your models. If you use one of those declarations, you get methods that handle -authorization with different database schemes. A full test web application is provided for each -of the modules so you can see how they work. The "Object Roles Table" version is recommended for -normal use and is the default. - -=== 1) Hardwired Roles - -This is the simplest and requires no database. Roles are assumed to be coded into the Model classes -using the has_role?(role, obj = nil) method. - -=== 2) Object Roles Table - -The Object Roles Table mixin provides full support for authorization expressions within a database by -add a polymorphic field to the Role table. Because roles have polymorphic associations to an -authorizable object, we can assign a user to a role for any model instance. So you could declare user X -to be a moderator for workshop Y, or you could make user A be the owner of resource B. - -The identity module adds a number of dynamic methods that use defined roles. The user-like model -gets methods like user.is_moderator_of group (sets user to "moderator" of group), -user.is_moderator? (returns true/false if user has some role "moderator"), and -group.has_moderators (returns an array of users that have role "moderator" for the group). -If you prefer not to have these dynamic methods available, you can simply comment out the inclusion -of the identity module within object_roles_table.rb. - -=== Migrations and Testing - -Each mixin's test web application comes with migrations to set up the database for the associated mixin. -After reading the Rails Recipe on domain specific languages (DSLs) for testing, I added integration tests -for each mixin test app that use a simple vocabulary for testing authorization. The object_roles_test -application has the most tests. Please contribute tests to improve coverage. - - -== The Specifics - -=== permit and permit? - -permit and permit? take an authorization expression and a hash of options -that typically includes any objects that need to be queried: - - permit [, options hash ] - permit? [, options hash ] - -The difference between permit and permit? is redirection. permit is a declarative -statement and redirects by default. It can also be used as a class or an -instance method, gating the access to an entire controller in a before_filter fashion. - -permit? is only an instance method, can be used within expressions, does not redirect by default. - -The authorization expression is a boolean expression made up of permitted roles, prepositions, -and authorizable models. Examples include "admin" (User model assumed), "moderator of :workshop" -(looks at options hash and then @workshop), "'top salesman' at :company" (multiword roles delimited -by single quotes), or "scheduled for Exam" (queries class method of Exam). - -Note that we can use several permitted prepositions ('of', 'for', 'in', 'on', 'to', 'at', 'by'). In the discussion below, -we assume you use the "of" preposition. You can modify the permitted prepositions by changing the constant -in Authorization::Base::Parser. - -* If a specified role has no "of " designation, we assume it is a user role (i.e., the model is the user-like object). -* If an "of model" designation is given but no "model" key/value is supplied in the hash, we check if an instance variable @model if it's available. -* If the model is capitalized, we assume it's a class and query Model#self.accepts_role? (the class method) for the permission. (Currently only available in ObjectRolesTable mixin.) - -For each role, a query is sent to the appropriate model object. - -The grammar for the authorization expression is: - - ::= () | not | or | and | - ::= | - ::= of | for | in | on | to | at | by - ::= /:*\w+/ - ::= /\w+/ | /'.*'/ - -Parentheses should be used to clarify permissions. Note that you may prefix the model with an optional ":" -- the first versions of Authorization plugin made this mandatory but it's now optional since the mandatory preposition makes models unambiguous. - -==== Options - -:allow_guests => false. We can allow permission processing without a current user object. The default is false. - -:user => A user object. - -:get_user_method => method that will return a user object. Default is #current_user, which is the how acts_as_authenticated works. - -:only => [ :method1, :method2 ]. Array of methods to apply permit (not valid when used in instance methods) - -:except => [ :method1, :method2 ]. Array of methods that won't have permission checking (not valid when used in instance methods) - -:redirect => bool. default is true. If false, permit will not redirect to denied page. - -:redirect_controller => controller that handles authorization failure (default is 'account') - -:redirect_action => action that handles authorization failure (default is 'login') - -:redirect_message => 'my message'. (default is 'Login is required') - -=== Setting and getting the roles - -Roles are set by #has_role and #accepts_role methods that are mixed into the User-like object -and the authorizable models. User objects can set roles and optionally an object scope for -that role: - - user.has_role 'site_admin' - user.has_role 'moderator', group - user.has_no_role 'site_admin' - user.has_no_role 'moderator', group - user.has_role 'member', Group - -Note that the last method sets role "member" on a class "Group". Roles can be set with three -scopes: entire application (no class or object specified), a model class, or an instance of a -model (i.e., a model object). - -Models set roles for specific users: - - a_model.accepts_role 'moderator', user - a_model.accepts_no_role 'moderator', user - Model.accepts_role 'class moderator', user - -The method language has been chosen to aid memory of the argument order. A user has a role "foo", -so the role string immediately follows has_role. Similarly, a model accepts a role "foo", so -the role string immediately follows accepts_role. Then we append the scope. - -Sometimes the user-like object might be an authorizable object as well, for example, when you -allow 'friend' roles for users. In this case, the user-like object can be declared to be -acts_as_authorizable as well as acts_as_authorized_user. - -Role queries follow the same pattern as the setting of roles: - - user.has_role? 'moderator' - user.has_role? 'moderator', group - user.has_role? 'member', Group - - a_model.accepts_role? 'moderator', user - Model.accepts_role? 'moderator', user - -When a user is queried without specifying either a model class or object, it returns true if the -user has *any* matching role. For example, user.has_role? 'moderator' returns true if -the user is 'moderator' of a class, a model object, or just a generic 'moderator'. -Note that if you say user.has_role 'moderator', the user does not become 'moderator' -for all classes and model objects; the user simply has a generic role 'moderator'. - -==== Dynamic methods through the Identity mixin - -The Object Roles Table version includes some dynamic methods that use the roles table. -For example, if you have roles like "eligible", "moderator", and "owner", you'll be able to -use the following: - - user.is_eligible_for_what --> returns array of authorizable objects for which user has role "eligible" - user.is_moderator_of? group --> returns true/false - user.is_moderator_of group --> sets user to have role "moderator" for object group. - user.is_administrator --> sets user to have role "administrator" not really tied to any object. - -Models get has_* methods: - - group.has_moderators --> returns array of users with role "moderator" on that group - group.has_moderators? --> returns true/false - -Allowed prepositions are optional in the above dynamic methods. They are simply syntactic sugar. -For example, the following are equivalent: - - user.is_member_of group - user.is_member_for group - user.is_member group - -Allowed prepositions are required in the authorization expressions because they are used to distinguish -"role" and "role of :model" and "role of Model". - -If you prefer not to pollute your namespace with these dynamic methods, do not include the -Identity module in object_roles_table.rb. - -=== Pattern of use - -We expect the application to provide the following methods: - -==== #current_user -Returns some user object, like an instance of my favorite class, UserFromMars. -A user object, from the Authorization viewpoint, is simply an object that -provides a has_role? method. - -Note that duck typing means we don't care what else the UserFromMars might be doing. -We only care that we can get an id from whatever it is, and we can check if a given -role string is associated with it. By using acts_as_authorized_user, we inject what -we need into the user object. - -If you use an authorization expression "admin of :foo", we check permission by -asking foo if it accepts_role?('admin', user). So for each model that is used in an -expression, we assume that it provides the accepts_role?(role, user) method. - -Note that user can be nil if :allow_guests => true. - -==== #store_return_location (optional) - -This method will be called if authorization fails and the user is about to be redirected to -the login action. This allows the application to return to the desired page after login. -If the application doesn't provide this method, the method will not be called. - -The name of the method for storing a location can be modified by changing the constant -STORE_LOCATION_METHOD in environment.rb. Also, the default login page is defined by the -constant DEFAULT_REDIRECTION_HASH in authorization.rb and can be overriden in your environment.rb. - -=== Conventions - -Roles specified without the "of model" designation: - -1. We see if there is a current_user method available that will return a user object. This method can be overridden with the :user hash. -2. Once a user object is determined, we pass the role to user.has_role? and expect a true return value if the user has the given role. - -Roles specified with "of model" designation: - -1. We attempt to query an object in the options hash that has a matching key. Example: permit "knight for justice", :justice => @abstract_idea -2. If there is no object with a matching key, we see if there's a matching instance variable. Example: @meeting defined before we use permit "moderator of meeting" -3. Once the model object is determined, we pass the role and user (determined in the manner above) to model.accepts_role? - -=== More information - -Information on this plugin and other development can be found at http://www.writertopia.com/developers - diff --git a/vendor/plugins/authorization/Rakefile b/vendor/plugins/authorization/Rakefile deleted file mode 100644 index 54cb3439..00000000 --- a/vendor/plugins/authorization/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the authorization plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the authorization plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Authorization' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README.txt') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/authorization/about.yml b/vendor/plugins/authorization/about.yml deleted file mode 100644 index 9ccee755..00000000 --- a/vendor/plugins/authorization/about.yml +++ /dev/null @@ -1,8 +0,0 @@ -author: Bill Katz -summary: Adds a flexible mechanism for authorization. -description: "Adds a flexible mechanism for authorization. Differs from other authorization systems in the following ways: (1) You can specify roles programmatically with model code or use a mixin to keep roles in a database. (2) The plugin uses a clean language for specifying authorization expressions. (3) Ability to handle roles on instances of a model. (4) Rights are explicitly declared in controller and view code. (5) Different levels of authorization complexity are provided through mixins available with the plugin. If you don't want to use the database for authorization, you mixin a HardwiredRoles module. If you want full database support for roles on model instances, you mixin the ObjectRolesTable module." -homepage: http://www.writertopia.com/developers/authorization -plugin: http://svn.writertopia.com/svn/plugins/authorization/ -license: MIT -version: 1.0.9 -rails_version: 2.0+ diff --git a/vendor/plugins/authorization/doc/authorization_example.gif b/vendor/plugins/authorization/doc/authorization_example.gif deleted file mode 100644 index f253c87b7d32c5919e449c066a860ef9cc83a0e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22718 zcmeEs^;;aj7w+Qjixzinf#QW0XK|;vySucwyTc+2Ebfc6xVyWzw73_FQz+fNe7=9e z{q^4SJUNp|GVh!7OwLSl5(Pzh5m5^OvMurh;6DldUkd%-CG_PkG_?OkHv20kFJEc^ z01yD+4FH4y0AK(B1^^%cAP@iq0f2@9AOyg>58%BH@J0YaLI5FPKnM%~9tObHU!Hks z1Oj-203jd%0t5nsKoAfJ0rK_+g@k~>U=U;r1UUmi5TM~R4>#)<0&f7w8{q8?2=N9W zyg`tchTi{4pLa-zHw5AhgL(I@d-rX5_aVH8hrQR=z1I;hlpz3c2mtni7y=p&@rH$X zufKEx3;=@xFz|mgFM1g44FkWFL(U)|z)L3}Aa4jL1Ofs>KnRF80OE~+fI}c)@Cyk9 zf`IfvAbkkP`Y>dx53;om+1i3^As}b#kTXPGRW9s*7Qz597zhjl4a2-cVBTQZOXncN zu)cLzAEFTu+6VwQ0vZ}Y!;RkSy@1eO0Js;>&Vt*!^}Sg3LfhAe*y=+d`k}o2P}6>BRDV;&fA3;&WEd1O3<3{>V8amDaNqFo*81=k zVhYMP1vQ<5Mol%DP7Ov)E$&SNLZ<=XX+XoYH+UK{Jl%&_h4QUJO;@2&tAkOiixsOo zd#gK$b?=aMZ}55_VjZ!*jzDaHLN`F*4N$`dq+w$Vu>}EbLBLxO#MUtQKkHvg&R*F1 zwh(7q2*h?1-*!{f_F~lb)yVc0;?O(v5V3xUK%7CqXM=oagHdN!6=w*51e z_y&QvTQt2xAQ1mq3q$lZAYLq7hrQ6e5FlO)stvAJv_gI&AE zc%r#{3e0OY2~qq~F_SOib-Fq6rE;!_cYpy!;cL}GDJX-}Wb$kEQl&_1;OUJbbtvH7l)m=H$ho2@jZvnr;ND@4>490YP{@PU1+j~tc z_DA69_ZJ9jNv`*!EQEc*!zD~_wTSri#7>b#xs%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Ni5pt=GDx!TP5STAt~da4c>p#`&$;nk@Pmr40d~4MCuFfuQ|buX*~& z78>+8I;9&RqTSlCL%ORlI-~b(u>;$n9~-g}8nN%sg@oD=R9dGsJF@v&DP$TcYTB|b zd$dJ5t}{BQfexgJ8n5x0waMA3ZJVXhI=9yvw|Tpwcl)=)+P8)KpozPNVa-0V7|^ZL56J1hDcr#rgs0R~#%3Oc;S8@jb3 zu^alcA^Iw$yS=YjRVF*5H~Om%PR$nzEnV z!UNjC*?Y>Rxyd`*q_G^dwLHkV+)Ihvv>Cj@@58*;T*}Lw$q{10VY|(TS}2P8&2t>j Wr+UTp+%);T&z17e0X-=L0suR*o4geO diff --git a/vendor/plugins/authorization/doc/authorization_example.rb b/vendor/plugins/authorization/doc/authorization_example.rb deleted file mode 100644 index 07fca592..00000000 --- a/vendor/plugins/authorization/doc/authorization_example.rb +++ /dev/null @@ -1,38 +0,0 @@ -class MeetingController < ApplicationController - - permit "rubyists and wanna_be_rubyists", :except => :public_page - - def public_page - render :text => "We're all in Chicago" - end - - def secret_info - permit "(matz or dhh) and interested in Answers" do - render :text => "The Answer = 42" - end - end - - def find_apprentice - @founder = User.find_by_name('matz') - permit "'inner circle' of :founder" do - if request.post? - apprentice = User.find_by_skillset(params[:uber_hacker]) - ruby_community = Group.find_by_name('Ruby') - ruby_community.accepts_role 'yarv_builder', apprentice - end - end - end - - def rails_conf - @meeting = Meeting.find_by_name('RailsConf') - permit "attendees of :meeting or swedish_mensa_supermodels" do - venue = Hotel.find_by_name("Wyndham O'Hare") - current_user.is_traveller_to venue - if permit? "traveller to :venue and not speaker" - Partay.all_night_long - @misdeeds = current_user.is_participant_in_what - end - end - end - -end diff --git a/vendor/plugins/authorization/generators/role_model/USAGE b/vendor/plugins/authorization/generators/role_model/USAGE deleted file mode 100644 index 03858fe6..00000000 --- a/vendor/plugins/authorization/generators/role_model/USAGE +++ /dev/null @@ -1,20 +0,0 @@ -Description: - The role_model generator creates a Role model for use with the Authorization plugin. - - The generator takes a model name as its argument, which at this time must be 'Role'. - - The generator creates a Role model class in app/models, a test suite in - test/unit, test fixtures in test/fixtures/roles.yml, and a migration - in the db/migrate directory. - -Example: - ./script/generate role_model Role - - This will create a Role model: - Model: app/models/role.rb - Test: test/unit/role_test.rb - Fixtures: test/fixtures/roles.yml - Migration: db/migrate/XXX_add_role.rb - - You should then run 'rake db:migrate'. - diff --git a/vendor/plugins/authorization/generators/role_model/role_model_generator.rb b/vendor/plugins/authorization/generators/role_model/role_model_generator.rb deleted file mode 100644 index a3e9a082..00000000 --- a/vendor/plugins/authorization/generators/role_model/role_model_generator.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Shamelessly derived from Rick Olsen's acts_as_attachment -class RoleModelGenerator < Rails::Generator::NamedBase - default_options :skip_migration => false - - def manifest - record do |m| - # Check for class naming collisions. - m.class_collisions class_path, class_name, "#{class_name}Test" - - # Model, test, and fixture directories. - m.directory File.join('app/models', class_path) - m.directory File.join('test/unit', class_path) - m.directory File.join('test/fixtures', class_path) - - # Model class, unit test, and fixtures. - m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") - m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb") - m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{table_name}.yml") - - unless options[:skip_migration] - m.migration_template 'migration.rb', 'db/migrate', :assigns => { - :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}" - }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}" - end - end - end - - protected - def add_options!(opt) - opt.separator '' - opt.separator 'Options:' - opt.on("--skip-migration", - "Don't generate a migration file for this model") { |v| options[:skip_migration] = v } - end -end diff --git a/vendor/plugins/authorization/generators/role_model/templates/fixtures.yml b/vendor/plugins/authorization/generators/role_model/templates/fixtures.yml deleted file mode 100644 index 8794d28a..00000000 --- a/vendor/plugins/authorization/generators/role_model/templates/fixtures.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -first: - id: 1 -another: - id: 2 diff --git a/vendor/plugins/authorization/generators/role_model/templates/migration.rb b/vendor/plugins/authorization/generators/role_model/templates/migration.rb deleted file mode 100644 index dc053c04..00000000 --- a/vendor/plugins/authorization/generators/role_model/templates/migration.rb +++ /dev/null @@ -1,21 +0,0 @@ -class <%= migration_name %> < ActiveRecord::Migration - - def self.up - create_table :<%= (table_name < 'users') ? "#{table_name}_users" : "users_#{table_name}" %>, :id => false, :force => true do |t| - t.integer :user_id, :<%= singular_name %>_id - t.timestamps - end - - create_table :<%= table_name %>, :force => true do |t| - t.string :name, :authorizable_type, :limit => 40 - t.integer :authorizable_id - t.timestamps - end - end - - def self.down - drop_table :<%= table_name %> - drop_table :<%= (table_name < 'users') ? "#{table_name}_users" : "users_#{table_name}" %> - end - -end diff --git a/vendor/plugins/authorization/generators/role_model/templates/model.rb b/vendor/plugins/authorization/generators/role_model/templates/model.rb deleted file mode 100644 index 8b7f80a7..00000000 --- a/vendor/plugins/authorization/generators/role_model/templates/model.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Defines named roles for users that may be applied to -# objects in a polymorphic fashion. For example, you could create a role -# "moderator" for an instance of a model (i.e., an object), a model class, -# or without any specification at all. -class <%= class_name %> < ActiveRecord::Base - has_and_belongs_to_many :users - belongs_to :authorizable, :polymorphic => true -end diff --git a/vendor/plugins/authorization/generators/role_model/templates/unit_test.rb b/vendor/plugins/authorization/generators/role_model/templates/unit_test.rb deleted file mode 100644 index b464de47..00000000 --- a/vendor/plugins/authorization/generators/role_model/templates/unit_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper' - -class <%= class_name %>Test < Test::Unit::TestCase - fixtures :<%= table_name %> - - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/vendor/plugins/authorization/init.rb b/vendor/plugins/authorization/init.rb deleted file mode 100644 index 2b8bb244..00000000 --- a/vendor/plugins/authorization/init.rb +++ /dev/null @@ -1,29 +0,0 @@ -require File.dirname(__FILE__) + '/lib/authorization' - -ActionController::Base.send( :include, Authorization::Base ) -ActionView::Base.send( :include, Authorization::Base::ControllerInstanceMethods ) - -# You can perform authorization at varying degrees of complexity. -# Choose a style of authorization below (see README.txt) and the appropriate -# mixin will be used for your app. - -# When used with the auth_test app, we define this in config/environment.rb -# AUTHORIZATION_MIXIN = "hardwired" -if not Object.constants.include? "AUTHORIZATION_MIXIN" - AUTHORIZATION_MIXIN = "object roles" -end - -case AUTHORIZATION_MIXIN - when "hardwired" - require File.dirname(__FILE__) + '/lib/publishare/hardwired_roles' - ActiveRecord::Base.send( :include, - Authorization::HardwiredRoles::UserExtensions, - Authorization::HardwiredRoles::ModelExtensions - ) - when "object roles" - require File.dirname(__FILE__) + '/lib/publishare/object_roles_table' - ActiveRecord::Base.send( :include, - Authorization::ObjectRolesTable::UserExtensions, - Authorization::ObjectRolesTable::ModelExtensions - ) -end diff --git a/vendor/plugins/authorization/install.rb b/vendor/plugins/authorization/install.rb deleted file mode 100644 index d310d987..00000000 --- a/vendor/plugins/authorization/install.rb +++ /dev/null @@ -1,2 +0,0 @@ -puts IO.read(File.join(File.dirname(__FILE__), 'README.txt')) - diff --git a/vendor/plugins/authorization/lib/authorization.rb b/vendor/plugins/authorization/lib/authorization.rb deleted file mode 100644 index 21d3814c..00000000 --- a/vendor/plugins/authorization/lib/authorization.rb +++ /dev/null @@ -1,143 +0,0 @@ -require File.dirname(__FILE__) + '/publishare/exceptions' -require File.dirname(__FILE__) + '/publishare/parser' - -module Authorization - module Base - - # Modify these constants in your environment.rb to tailor the plugin to your authentication system - if not Object.constants.include? "DEFAULT_REDIRECTION_HASH" - DEFAULT_REDIRECTION_HASH = { :controller => 'account', :action => 'login' } - end - if not Object.constants.include? "STORE_LOCATION_METHOD" - STORE_LOCATION_METHOD = :store_return_location - end - - def self.included( recipient ) - recipient.extend( ControllerClassMethods ) - recipient.class_eval do - include ControllerInstanceMethods - end - end - - module ControllerClassMethods - - # Allow class-level authorization check. - # permit is used in a before_filter fashion and passes arguments to the before_filter. - def permit( authorization_expression, *args ) - filter_keys = [ :only, :except ] - filter_args, eval_args = {}, {} - if args.last.is_a? Hash - filter_args.merge!( args.last.reject {|k,v| not filter_keys.include? k } ) - eval_args.merge!( args.last.reject {|k,v| filter_keys.include? k } ) - end - before_filter( filter_args ) do |controller| - controller.permit( authorization_expression, eval_args ) - end - end - end - - module ControllerInstanceMethods - include Authorization::Base::EvalParser # RecursiveDescentParser is another option - - # Permit? turns off redirection by default and takes no blocks - def permit?( authorization_expression, *args ) - @options = { :allow_guests => false, :redirect => false } - @options.merge!( args.last.is_a?( Hash ) ? args.last : {} ) - - has_permission?( authorization_expression ) - end - - # Allow method-level authorization checks. - # permit (without a question mark ending) calls redirect on denial by default. - # Specify :redirect => false to turn off redirection. - def permit( authorization_expression, *args ) - @options = { :allow_guests => false, :redirect => true } - @options.merge!( args.last.is_a?( Hash ) ? args.last : {} ) - - if has_permission?( authorization_expression ) - yield if block_given? - elsif @options[:redirect] - handle_redirection - end - end - - private - - def has_permission?( authorization_expression ) - @current_user = get_user - if not @options[:allow_guests] - # We aren't logged in, or an exception has already been raised. - # Test for both nil and :false symbol as restful_authentication plugin - # will set current user to ':false' on a failed login (patch by Ho-Sheng Hsiao). - if @current_user.nil? || @current_user == :false - return false - elsif not @current_user.respond_to? :id - raise( UserDoesntImplementID, "User doesn't implement #id") - elsif not @current_user.respond_to? :has_role? - raise( UserDoesntImplementRoles, "User doesn't implement #has_role?" ) - end - end - parse_authorization_expression( authorization_expression ) - end - - # Handle redirection within permit if authorization is denied. - def handle_redirection - return if not self.respond_to?( :redirect_to ) - redirection = DEFAULT_REDIRECTION_HASH - redirection[:controller] = @options[:redirect_controller] if @options[:redirect_controller] - redirection[:action] = @options[:redirect_action] if @options[:redirect_action] - - # Store url in session for return if this is available from authentication - send( STORE_LOCATION_METHOD ) if respond_to? STORE_LOCATION_METHOD - if @current_user - flash[:notice] = "Permission denied. Your account cannot access the requested page." - else - flash[:notice] = @options[:redirect_message] ? @options[:redirect_message] : "Login is required" - end - redirect_to redirection - false # Want to short-circuit the filters - end - - # Try to find current user by checking options hash and instance method in that order. - def get_user - if @options[:user] - @options[:user] - elsif @options[:get_user_method] - send( @options[:get_user_method] ) - elsif self.respond_to? :current_user - current_user - elsif not @options[:allow_guests] - raise( CannotObtainUserObject, "Couldn't find #current_user or @user, and nothing appropriate found in hash" ) - end - end - - # Try to find a model to query for permissions - def get_model( str ) - if str =~ /\s*([A-Z]+\w*)\s*/ - # Handle model class - begin - Module.const_get( str ) - rescue - raise CannotObtainModelClass, "Couldn't find model class: #{str}" - end - elsif str =~ /\s*:*(\w+)\s*/ - # Handle model instances - model_name = $1 - model_symbol = model_name.to_sym - if @options[model_symbol] - @options[model_symbol] - elsif instance_variables.include?( '@'+model_name ) - instance_variable_get( '@'+model_name ) - # Note -- while the following code makes autodiscovery more convenient, it's a little too much side effect & security question - # elsif self.params[:id] - # eval_str = model_name.camelize + ".find(#{self.params[:id]})" - # eval eval_str - else - raise CannotObtainModelObject, "Couldn't find model (#{str}) in hash or as an instance variable" - end - end - end - end - - end -end diff --git a/vendor/plugins/authorization/lib/publishare/exceptions.rb b/vendor/plugins/authorization/lib/publishare/exceptions.rb deleted file mode 100644 index 7a50188c..00000000 --- a/vendor/plugins/authorization/lib/publishare/exceptions.rb +++ /dev/null @@ -1,41 +0,0 @@ -module Authorization #:nodoc: - - # Base error class for Authorization module - class AuthorizationError < StandardError - end - - # Raised when the authorization expression is invalid (cannot be parsed) - class AuthorizationExpressionInvalid < AuthorizationError - end - - # Raised when we can't find the current user - class CannotObtainUserObject < AuthorizationError - end - - # Raised when an authorization expression contains a model class that doesn't exist - class CannotObtainModelClass < AuthorizationError - end - - # Raised when an authorization expression contains a model reference that doesn't exist - class CannotObtainModelObject < AuthorizationError - end - - # Raised when the obtained user object doesn't implement #id - class UserDoesntImplementID < AuthorizationError - end - - # Raised when the obtained user object doesn't implement #has_role? - class UserDoesntImplementRoles < AuthorizationError - end - - # Raised when the obtained model doesn't implement #accepts_role? - class ModelDoesntImplementRoles < AuthorizationError - end - - class CannotSetRoleWhenHardwired < AuthorizationError - end - - class CannotSetObjectRoleWhenSimpleRoleTable < AuthorizationError - end - -end \ No newline at end of file diff --git a/vendor/plugins/authorization/lib/publishare/hardwired_roles.rb b/vendor/plugins/authorization/lib/publishare/hardwired_roles.rb deleted file mode 100644 index 421ecc3d..00000000 --- a/vendor/plugins/authorization/lib/publishare/hardwired_roles.rb +++ /dev/null @@ -1,82 +0,0 @@ -require File.dirname(__FILE__) + '/exceptions' - -# In order to use this mixin, you'll need to define roles by overriding the -# following functions: -# -# User#has_role?(role) -# Return true or false depending on the roles (strings) passed in. -# -# Model#accepts_role?(role, user) -# Return true or false depending on the roles (strings) this particular user has for -# this particular model object. -# -# See http://www.writertopia.com/developers/authorization - -module Authorization - module HardwiredRoles - - module UserExtensions - def self.included( recipient ) - recipient.extend( ClassMethods ) - end - - module ClassMethods - def acts_as_authorized_user - include Authorization::HardwiredRoles::UserExtensions::InstanceMethods - end - end - - module InstanceMethods - # If roles aren't explicitly defined in user class then return false - def has_role?( role, authorizable_object = nil ) - false - end - - def has_role( role, authorizable_object = nil ) - raise( CannotSetRoleWhenHardwired, - "Hardwired mixin: Cannot set user to role #{role}. Don't use #has_role, use code in models." - ) - end - - def has_no_role( role, authorizable_object = nil ) - raise( CannotSetRoleWhenHardwired, - "Hardwired mixin: Cannot remove user role #{role}. Don't use #has_no_role, use code in models." - ) - end - end - end - - module ModelExtensions - def self.included( recipient ) - recipient.extend( ClassMethods ) - end - - module ClassMethods - def acts_as_authorizable - include Authorization::HardwiredRoles::ModelExtensions::InstanceMethods - end - end - - module InstanceMethods - def accepts_role?( role, user ) - return false - end - - def accepts_role( role, user ) - raise( CannotSetRoleWhenHardwired, - "Hardwired mixin: Cannot set user to role #{role}. Don't use #accepts_role, use code in models." - ) - end - - def accepts_no_role( role, user ) - raise( CannotSetRoleWhenHardwired, - "Hardwired mixin: Cannot set user to role #{role}. Don't use #accepts_no_role, use code in models." - ) - end - end - end - - end - -end - diff --git a/vendor/plugins/authorization/lib/publishare/identity.rb b/vendor/plugins/authorization/lib/publishare/identity.rb deleted file mode 100644 index 240ca4e5..00000000 --- a/vendor/plugins/authorization/lib/publishare/identity.rb +++ /dev/null @@ -1,119 +0,0 @@ -require File.dirname(__FILE__) + '/exceptions' - -# Provides the appearance of dynamically generated methods on the roles database. -# -# Examples: -# user.is_member? --> Returns true if user has any role of "member" -# user.is_member_of? this_workshop --> Returns true/false. Must have authorizable object after query. -# user.is_eligible_for [this_award] --> Gives user the role "eligible" for "this_award" -# user.is_moderator --> Gives user the general role "moderator" (not tied to any class or object) -# user.is_candidate_of_what --> Returns array of objects for which this user is a "candidate" (any type) -# user.is_candidate_of_what(Party) --> Returns array of objects for which this user is a "candidate" (only 'Party' type) -# -# model.has_members --> Returns array of users which have role "member" on that model -# model.has_members? --> Returns true/false -# -module Authorization - module Identity - - module UserExtensions - module InstanceMethods - - def method_missing( method_sym, *args ) - method_name = method_sym.to_s - authorizable_object = args.empty? ? nil : args[0] - - base_regex = "is_(\\w+)" - fancy_regex = base_regex + "_(#{Authorization::Base::VALID_PREPOSITIONS_PATTERN})" - is_either_regex = '^((' + fancy_regex + ')|(' + base_regex + '))' - base_not_regex = "is_no[t]?_(\\w+)" - fancy_not_regex = base_not_regex + "_(#{Authorization::Base::VALID_PREPOSITIONS_PATTERN})" - is_not_either_regex = '^((' + fancy_not_regex + ')|(' + base_not_regex + '))' - - if method_name =~ Regexp.new(is_either_regex + '_what$') - role_name = $3 || $6 - has_role_for_objects(role_name, authorizable_object) - elsif method_name =~ Regexp.new(is_not_either_regex + '\?$') - role_name = $3 || $6 - not is_role?( role_name, authorizable_object ) - elsif method_name =~ Regexp.new(is_either_regex + '\?$') - role_name = $3 || $6 - is_role?( role_name, authorizable_object ) - elsif method_name =~ Regexp.new(is_not_either_regex + '$') - role_name = $3 || $6 - is_no_role( role_name, authorizable_object ) - elsif method_name =~ Regexp.new(is_either_regex + '$') - role_name = $3 || $6 - is_role( role_name, authorizable_object ) - else - super - end - end - - private - - def is_role?( role_name, authorizable_object ) - if authorizable_object.nil? - return self.has_role?(role_name) - elsif authorizable_object.respond_to?(:accepts_role?) - return self.has_role?(role_name, authorizable_object) - end - false - end - - def is_no_role( role_name, authorizable_object = nil ) - if authorizable_object.nil? - self.has_no_role role_name - else - self.has_no_role role_name, authorizable_object - end - end - - def is_role( role_name, authorizable_object = nil ) - if authorizable_object.nil? - self.has_role role_name - else - self.has_role role_name, authorizable_object - end - end - - def has_role_for_objects(role_name, type) - if type.nil? - roles = self.roles.find_all_by_name( role_name ) - else - roles = self.roles.find_all_by_authorizable_type_and_name( type.name, role_name ) - end - roles.collect do |role| - if role.authorizable_id.nil? - role.authorizable_type.nil? ? - nil : Module.const_get( role.authorizable_type ) # Returns class - else - role.authorizable - end - end - end - end - end - - module ModelExtensions - module InstanceMethods - - def method_missing( method_sym, *args ) - method_name = method_sym.to_s - if method_name =~ /^has_(\w+)\?$/ - role_name = $1.singularize - self.accepted_roles.find_all_by_name(role_name).any? { |role| role.users.any? } - elsif method_name =~ /^has_(\w+)$/ - role_name = $1.singularize - users = self.accepted_roles.find_all_by_name(role_name).collect { |role| role.users } - users.flatten.uniq if users - else - super - end - end - - end - end - - end -end diff --git a/vendor/plugins/authorization/lib/publishare/object_roles_table.rb b/vendor/plugins/authorization/lib/publishare/object_roles_table.rb deleted file mode 100644 index 7be54678..00000000 --- a/vendor/plugins/authorization/lib/publishare/object_roles_table.rb +++ /dev/null @@ -1,116 +0,0 @@ -require File.dirname(__FILE__) + '/exceptions' -require File.dirname(__FILE__) + '/identity' - -module Authorization - module ObjectRolesTable - - module UserExtensions - def self.included( recipient ) - recipient.extend( ClassMethods ) - end - - module ClassMethods - def acts_as_authorized_user(roles_relationship_opts = {}) - has_and_belongs_to_many :roles, roles_relationship_opts - include Authorization::ObjectRolesTable::UserExtensions::InstanceMethods - include Authorization::Identity::UserExtensions::InstanceMethods # Provides all kinds of dynamic sugar via method_missing - end - end - - module InstanceMethods - # If roles aren't explicitly defined in user class then check roles table - def has_role?( role_name, authorizable_obj = nil ) - if authorizable_obj.nil? - self.roles.find_by_name( role_name ) ? true : false # If we ask a general role question, return true if any role is defined. - else - role = get_role( role_name, authorizable_obj ) - role ? self.roles.exists?( role.id ) : false - end - end - - def has_role( role_name, authorizable_obj = nil ) - role = get_role( role_name, authorizable_obj ) - if role.nil? - if authorizable_obj.is_a? Class - role = Role.create( :name => role_name, :authorizable_type => authorizable_obj.to_s ) - elsif authorizable_obj - role = Role.create( :name => role_name, :authorizable => authorizable_obj ) - else - role = Role.create( :name => role_name ) - end - end - self.roles << role if role and not self.roles.exists?( role.id ) - end - - def has_no_role( role_name, authorizable_obj = nil ) - role = get_role( role_name, authorizable_obj ) - if role - self.roles.delete( role ) - role.destroy if role.users.empty? - end - end - - private - - def get_role( role_name, authorizable_obj ) - if authorizable_obj.is_a? Class - Role.find( :first, - :conditions => [ 'name = ? and authorizable_type = ? and authorizable_id IS NULL', role_name, authorizable_obj.to_s ] ) - elsif authorizable_obj - Role.find( :first, - :conditions => [ 'name = ? and authorizable_type = ? and authorizable_id = ?', - role_name, authorizable_obj.class.base_class.to_s, authorizable_obj.id ] ) - else - Role.find( :first, - :conditions => [ 'name = ? and authorizable_type IS NULL and authorizable_id IS NULL', role_name ] ) - end - end - - end - end - - module ModelExtensions - def self.included( recipient ) - recipient.extend( ClassMethods ) - end - - module ClassMethods - def acts_as_authorizable - has_many :accepted_roles, :as => :authorizable, :class_name => 'Role' - - def accepts_role?( role_name, user ) - user.has_role? role_name, self - end - - def accepts_role( role_name, user ) - user.has_role role_name, self - end - - def accepts_no_role( role_name, user ) - user.has_no_role role_name, self - end - - include Authorization::ObjectRolesTable::ModelExtensions::InstanceMethods - include Authorization::Identity::ModelExtensions::InstanceMethods # Provides all kinds of dynamic sugar via method_missing - end - end - - module InstanceMethods - # If roles aren't overriden in model then check roles table - def accepts_role?( role_name, user ) - user.has_role? role_name, self - end - - def accepts_role( role_name, user ) - user.has_role role_name, self - end - - def accepts_no_role( role_name, user ) - user.has_no_role role_name, self - end - end - end - - end -end - diff --git a/vendor/plugins/authorization/lib/publishare/parser.rb b/vendor/plugins/authorization/lib/publishare/parser.rb deleted file mode 100644 index e2083cbc..00000000 --- a/vendor/plugins/authorization/lib/publishare/parser.rb +++ /dev/null @@ -1,210 +0,0 @@ -module Authorization - module Base - - VALID_PREPOSITIONS = ['of', 'for', 'in', 'on', 'to', 'at', 'by'] - BOOLEAN_OPS = ['not', 'or', 'and'] - VALID_PREPOSITIONS_PATTERN = VALID_PREPOSITIONS.join('|') - - module EvalParser - # Parses and evaluates an authorization expression and returns true or false. - # - # The authorization expression is defined by the following grammar: - # ::= () | not | or | and | - # ::= | - # ::= of | for | in | on | to | at | by - # ::= /:*\w+/ - # ::= /\w+/ | /'.*'/ - # - # Instead of doing recursive descent parsing (not so fun when we support nested parentheses, etc), - # we let Ruby do the work for us by inserting the appropriate permission calls and using eval. - # This would not be a good idea if you were getting authorization expressions from the outside, - # so in that case (e.g. somehow letting users literally type in permission expressions) you'd - # be better off using the recursive descent parser in Module RecursiveDescentParser. - # - # We search for parts of our authorization evaluation that match or - # and we ignore anything terminal in our grammar. - # - # 1) Replace all matches. - # 2) Replace all matches that aren't one of our other terminals ('not', 'or', 'and', or preposition) - # 3) Eval - - def parse_authorization_expression( str ) - if str =~ /[^A-Za-z0-9_:'\(\)\s]/ - raise AuthorizationExpressionInvalid, "Invalid authorization expression (#{str})" - return false - end - @replacements = [] - expr = replace_temporarily_role_of_model( str ) - expr = replace_role( expr ) - expr = replace_role_of_model( expr ) - begin - instance_eval( expr ) - rescue - raise AuthorizationExpressionInvalid, "Cannot parse authorization (#{str})" - end - end - - def replace_temporarily_role_of_model( str ) - role_regex = '\s*(\'\s*(.+?)\s*\'|(\w+))\s+' - model_regex = '\s+(:*\w+)' - parse_regex = Regexp.new(role_regex + '(' + VALID_PREPOSITIONS.join('|') + ')' + model_regex) - str.gsub(parse_regex) do |match| - @replacements.push " process_role_of_model('#{$2 || $3}', '#{$5}') " - " <#{@replacements.length-1}> " - end - end - - def replace_role( str ) - role_regex = '\s*(\'\s*(.+?)\s*\'|([A-Za-z]\w*))\s*' - parse_regex = Regexp.new(role_regex) - str.gsub(parse_regex) do |match| - if BOOLEAN_OPS.include?($3) - " #{match} " - else - " process_role('#{$2 || $3}') " - end - end - end - - def replace_role_of_model( str ) - str.gsub(/<(\d+)>/) do |match| - @replacements[$1.to_i] - end - end - - def process_role_of_model( role_name, model_name ) - model = get_model( model_name ) - raise( ModelDoesntImplementRoles, "Model (#{model_name}) doesn't implement #accepts_role?" ) if not model.respond_to? :accepts_role? - model.send( :accepts_role?, role_name, @current_user ) - end - - def process_role( role_name ) - return false if @current_user.nil? || @current_user == :false - raise( UserDoesntImplementRoles, "User doesn't implement #has_role?" ) if not @current_user.respond_to? :has_role? - @current_user.has_role?( role_name ) - end - - end - - # Parses and evaluates an authorization expression and returns true or false. - # This recursive descent parses uses two instance variables: - # @stack --> a stack with the top holding the boolean expression resulting from the parsing - # - # The authorization expression is defined by the following grammar: - # ::= () | not | or | and | - # ::= | - # ::= of | for | in | on | to | at | by - # ::= /:*\w+/ - # ::= /\w+/ | /'.*'/ - # - # There are really two values we must track: - # (1) whether the expression is valid according to the grammar - # (2) the evaluated results --> true/false on the permission queries - # The first is embedded in the control logic because we want short-circuiting. If an expression - # has been parsed and the permission is false, we don't want to try different ways of parsing. - # Note that this implementation of a recursive descent parser is meant to be simple - # and doesn't allow arbitrary nesting of parentheses. It supports up to 5 levels of nesting. - # It also won't handle some types of expressions (A or B) and C, which has to be rewritten as - # C and (A or B) so the parenthetical expressions are in the tail. - module RecursiveDescentParser - - OPT_PARENTHESES_PATTERN = '(([^()]|\(([^()]|\(([^()]|\(([^()]|\(([^()]|\(([^()])*\))*\))*\))*\))*\))*)' - PARENTHESES_PATTERN = '\(' + OPT_PARENTHESES_PATTERN + '\)' - NOT_PATTERN = '^\s*not\s+' + OPT_PARENTHESES_PATTERN + '$' - AND_PATTERN = '^\s*' + OPT_PARENTHESES_PATTERN + '\s+and\s+' + OPT_PARENTHESES_PATTERN + '\s*$' - OR_PATTERN = '^\s*' + OPT_PARENTHESES_PATTERN + '\s+or\s+' + OPT_PARENTHESES_PATTERN + '\s*$' - ROLE_PATTERN = '(\'\s*(.+)\s*\'|(\w+))' - MODEL_PATTERN = '(:*\w+)' - - PARENTHESES_REGEX = Regexp.new('^\s*' + PARENTHESES_PATTERN + '\s*$') - NOT_REGEX = Regexp.new(NOT_PATTERN) - AND_REGEX = Regexp.new(AND_PATTERN) - OR_REGEX = Regexp.new(OR_PATTERN) - ROLE_REGEX = Regexp.new('^\s*' + ROLE_PATTERN + '\s*$') - ROLE_OF_MODEL_REGEX = Regexp.new('^\s*' + ROLE_PATTERN + '\s+(' + VALID_PREPOSITIONS_PATTERN + ')\s+' + MODEL_PATTERN + '\s*$') - - def parse_authorization_expression( str ) - @stack = [] - raise AuthorizationExpressionInvalid, "Cannot parse authorization (#{str})" if not parse_expr( str ) - return @stack.pop - end - - def parse_expr( str ) - parse_parenthesis( str ) or - parse_not( str ) or - parse_or( str ) or - parse_and( str ) or - parse_term( str ) - end - - def parse_not( str ) - if str =~ NOT_REGEX - can_parse = parse_expr( $1 ) - @stack.push( !@stack.pop ) if can_parse - end - false - end - - def parse_or( str ) - if str =~ OR_REGEX - can_parse = parse_expr( $1 ) and parse_expr( $8 ) - @stack.push( @stack.pop | @stack.pop ) if can_parse - return can_parse - end - false - end - - def parse_and( str ) - if str =~ AND_REGEX - can_parse = parse_expr( $1 ) and parse_expr( $8 ) - @stack.push(@stack.pop & @stack.pop) if can_parse - return can_parse - end - false - end - - # Descend down parenthesis (allow up to 5 levels of nesting) - def parse_parenthesis( str ) - str =~ PARENTHESES_REGEX ? parse_expr( $1 ) : false - end - - def parse_term( str ) - parse_role_of_model( str ) or - parse_role( str ) - end - - # Parse of - def parse_role_of_model( str ) - if str =~ ROLE_OF_MODEL_REGEX - role_name = $2 || $3 - model_name = $5 - model_obj = get_model( model_name ) - raise( ModelDoesntImplementRoles, "Model (#{model_name}) doesn't implement #accepts_role?" ) if not model_obj.respond_to? :accepts_role? - - has_permission = model_obj.send( :accepts_role?, role_name, @current_user ) - @stack.push( has_permission ) - true - else - false - end - end - - # Parse of the User-like object - def parse_role( str ) - if str =~ ROLE_REGEX - role_name = $1 - if @current_user.nil? || @current_user == :false - @stack.push(false) - else - raise( UserDoesntImplementRoles, "User doesn't implement #has_role?" ) if not @current_user.respond_to? :has_role? - @stack.push( @current_user.has_role?(role_name) ) - end - true - else - false - end - end - - end - end -end diff --git a/vendor/plugins/authorization/tasks/authorization_tasks.rake b/vendor/plugins/authorization/tasks/authorization_tasks.rake deleted file mode 100644 index 5f096298..00000000 --- a/vendor/plugins/authorization/tasks/authorization_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :authorization do -# # Task goes here -# end \ No newline at end of file diff --git a/vendor/plugins/authorization/test/README.txt b/vendor/plugins/authorization/test/README.txt deleted file mode 100644 index 9ed8e36a..00000000 --- a/vendor/plugins/authorization/test/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -Tests for Authorization plugin are handled by tests within -the test apps for each type of mixin. -See http://www.writertopia.com/developers/authorization From cd9f8ba38b66b5412d14e84382a0b0f82b39b1ea Mon Sep 17 00:00:00 2001 From: alex-frost Date: Fri, 14 Mar 2014 10:51:10 -0700 Subject: [PATCH 07/18] fix CSV lib adds '\n' --- app/controllers/reports_controller.rb | 2 +- test/functional/reports_controller_test.rb | 2 +- test/unit/person_test.rb | 2 +- test/unit/service_test.rb | 2 +- test/unit/visit_test.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 20c6a39f..a5b6229e 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -26,7 +26,7 @@ def visits stream_csv("#{@organization.key}_visits_#{@report[:after]}_#{@report[:before]}.csv") do |output| output.write Visit.csv_header @visits.each do |visit| - output.write "\n#{visit.to_csv}" + output.write "#{visit.to_csv}" end end end diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb index 32b5d37b..35d860c8 100644 --- a/test/functional/reports_controller_test.rb +++ b/test/functional/reports_controller_test.rb @@ -44,7 +44,7 @@ def test_visits_report_csv assert_nothing_raised { @response.body.call(@response, output) } lines = output.string.split("\n") assert_equal assigns(:visits).size + 1, lines.size - assert_equal Visit.csv_header, lines[0] + assert_equal Visit.csv_header, lines[0]+"\n" assert_equal "attachment; filename=\"sfbk_visits_2006-01-01_2008-01-01.csv\"", @response.headers['Content-Disposition'] end diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index ece28adb..26511551 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -89,7 +89,7 @@ def test_membership_on end def test_csv_header - assert_equal 'id,first_name,last_name,staff,email,email_opt_out,phone,postal_code,street1,street2,city,state,postal_code,country,yob,created_at,membership_expires_on', Person.csv_header + assert_equal "id,first_name,last_name,staff,email,email_opt_out,phone,postal_code,street1,street2,city,state,postal_code,country,yob,created_at,membership_expires_on\n", Person.csv_header end def test_to_csv diff --git a/test/unit/service_test.rb b/test/unit/service_test.rb index 254926b2..bc10edb3 100644 --- a/test/unit/service_test.rb +++ b/test/unit/service_test.rb @@ -30,7 +30,7 @@ def test_current end def test_csv_header - assert_equal 'first_name,last_name,email,email_opt_out,phone,postal_code,service_type_id,start_date,end_date,volunteered,paid,note', Service.csv_header + assert_equal "first_name,last_name,email,email_opt_out,phone,postal_code,service_type_id,start_date,end_date,volunteered,paid,note\n", Service.csv_header end def test_to_csv diff --git a/test/unit/visit_test.rb b/test/unit/visit_test.rb index 1a82f983..526312e7 100644 --- a/test/unit/visit_test.rb +++ b/test/unit/visit_test.rb @@ -38,7 +38,7 @@ def test_to_csv end def test_csv_header - assert_equal 'first_name,last_name,email,email_opt_out,phone,postal_code,arrived_at,staff,member,volunteer,note', Visit.csv_header + assert_equal "first_name,last_name,email,email_opt_out,phone,postal_code,arrived_at,staff,member,volunteer,note\n", Visit.csv_header end def test_create_defaults From 74548deb407223e4fc25fa44b27ab3c45316f9c7 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Fri, 14 Mar 2014 10:56:28 -0700 Subject: [PATCH 08/18] rm validates_email_veracity_of and add validates_email_format_of --- Gemfile | 1 + Gemfile.lock | 2 + app/models/person.rb | 10 +- app/models/user.rb | 2 +- .../validates_email_veracity_of/MIT-LICENSE | 20 -- .../validates_email_veracity_of/README | 57 ----- .../validates_email_veracity_of/Rakefile | 22 -- .../validates_email_veracity_of/init.rb | 1 - .../lib/validates_email_veracity_of.rb | 178 --------------- .../lib/validation_extensions.rb | 72 ------ .../test/fixtures/email.yml | 4 - .../test/rails_root/README | 211 ------------------ .../test/rails_root/Rakefile | 10 - .../rails_root/app/controllers/application.rb | 7 - .../app/helpers/application_helper.rb | 3 - .../test/rails_root/app/models/email.rb | 5 - .../app/models/email_fail_on_timeout.rb | 6 - .../app/models/email_invalid_domains.rb | 6 - .../rails_root/app/models/email_mx_only.rb | 6 - .../app/models/email_skip_remote.rb | 6 - .../rails_root/app/models/email_timeout.rb | 6 - .../test/rails_root/config/boot.rb | 39 ---- .../test/rails_root/config/database.yml | 18 -- .../test/rails_root/config/environment.rb | 11 - .../config/environments/development.rb | 21 -- .../rails_root/config/environments/mysql.rb | 0 .../config/environments/postgresql.rb | 0 .../config/environments/production.rb | 18 -- .../rails_root/config/environments/sqlite.rb | 0 .../rails_root/config/environments/sqlite3.rb | 0 .../rails_root/config/environments/test.rb | 19 -- .../test/rails_root/config/routes.rb | 23 -- .../db/migrate/001_create_emails.rb | 11 - .../test/rails_root/script/console | 3 - .../test/rails_root/script/runner | 3 - .../test/rails_root/test/test_helper.rb | 28 --- ...alidates_email_veracity_of_test.sqlite3.db | Bin 3072 -> 0 bytes .../vendor/plugins/phone_validation/init.rb | 2 - .../test/test_helper.rb | 80 ------- .../test/unit/library_test.rb | 86 ------- .../test/unit/plugin_test.rb | 59 ----- 41 files changed, 9 insertions(+), 1047 deletions(-) delete mode 100644 vendor/plugins/validates_email_veracity_of/MIT-LICENSE delete mode 100644 vendor/plugins/validates_email_veracity_of/README delete mode 100644 vendor/plugins/validates_email_veracity_of/Rakefile delete mode 100644 vendor/plugins/validates_email_veracity_of/init.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/lib/validation_extensions.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/fixtures/email.yml delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/README delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/Rakefile delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/controllers/application.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/helpers/application_helper.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_fail_on_timeout.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_invalid_domains.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_mx_only.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_skip_remote.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_timeout.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/boot.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/database.yml delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environment.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/development.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/mysql.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/postgresql.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/production.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite3.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/test.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/config/routes.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/db/migrate/001_create_emails.rb delete mode 100755 vendor/plugins/validates_email_veracity_of/test/rails_root/script/console delete mode 100755 vendor/plugins/validates_email_veracity_of/test/rails_root/script/runner delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/test/test_helper.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/validates_email_veracity_of_test.sqlite3.db delete mode 100644 vendor/plugins/validates_email_veracity_of/test/rails_root/vendor/plugins/phone_validation/init.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/test_helper.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/unit/library_test.rb delete mode 100644 vendor/plugins/validates_email_veracity_of/test/unit/plugin_test.rb diff --git a/Gemfile b/Gemfile index 91195703..2843f17a 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,7 @@ gem 'calendar_date_select', "1.16.1" gem "acts-as-taggable-on", "2.0.6" gem "newrelic_rpm" gem 'hoptoad_notifier' +gem 'validates_email_format_of' group :development, :test do gem 'debugger' diff --git a/Gemfile.lock b/Gemfile.lock index befcb2d1..fed890d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,7 @@ GEM rdoc (4.1.1) json (~> 1.4) thoughtbot-shoulda (2.11.1) + validates_email_format_of (1.5.3) PLATFORMS ruby @@ -69,3 +70,4 @@ DEPENDENCIES rails (= 2.3.17) rdoc thoughtbot-shoulda + validates_email_format_of diff --git a/app/models/person.rb b/app/models/person.rb index 5ccc08ac..8d87aae8 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -25,7 +25,7 @@ # class Person < ActiveRecord::Base - + belongs_to :organization has_many :visits, :include => :note, :dependent => :destroy, :order => "arrived_at DESC" has_many :services, :include => :note, :dependent => :destroy, :order => "end_date DESC" do @@ -44,11 +44,11 @@ def on(service_type, time) has_many :notes, :as => :notable, :dependent => :destroy has_userstamps - + validates_presence_of :first_name, :organization_id validates_uniqueness_of :email, :scope => :organization_id, :case_sensitive => false, :allow_nil => true, :allow_blank => true validates_length_of :first_name, :last_name, :street1, :street2, :city, :state, :postal_code, :country, :within => 1..40, :allow_blank => true - validates_email_veracity_of :email, :domain_check => true + validates_email_format_of :email, :check_mx => true # Note that Date.today gets evaluates at class load time, not evaluation time, but we can live with that fudge validates_numericality_of :yob, :allow_nil => true, :only_integer => true, :greater_than => Date.today.year - 100, :less_than => Date.today.year + 1 @@ -84,7 +84,7 @@ def initialize(params={}) def membership @membership ||= services.last(:membership) end - + def member? !membership.nil? && membership.current? end @@ -156,4 +156,4 @@ def downcase_email def update_full_name self.full_name = [first_name, last_name].reject{|e| e.nil? || e.empty?}.join(' ') end -end \ No newline at end of file +end diff --git a/app/models/user.rb b/app/models/user.rb index 69dff19b..c46bb029 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -42,7 +42,7 @@ def accepts_role?(role, user) validates_confirmation_of :password, :if => :password_required? validates_length_of :login, :within => 3..40, :unless => proc { |user| user.errors.on :login } validates_length_of :email, :within => 3..100, :unless => proc { |user| user.errors.on :email } - validates_email_veracity_of :email, :domain_check => true, :unless => proc { |user| user.errors.on :email } + validates_email_format_of :email, :check_mx=> true, :unless => proc { |user| user.errors.on :email } validates_uniqueness_of :login, :email, :case_sensitive => false before_save :encrypt_password before_create :make_activation_code diff --git a/vendor/plugins/validates_email_veracity_of/MIT-LICENSE b/vendor/plugins/validates_email_veracity_of/MIT-LICENSE deleted file mode 100644 index a87fdd2a..00000000 --- a/vendor/plugins/validates_email_veracity_of/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2007 Carsten Nielsen - Savvica Inc. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/README b/vendor/plugins/validates_email_veracity_of/README deleted file mode 100644 index a07c3364..00000000 --- a/vendor/plugins/validates_email_veracity_of/README +++ /dev/null @@ -1,57 +0,0 @@ -= Validates Email Veracity Of - -Author:: Carsten Nielsen (mailto:carsten.nielsen@savvica.com) -License:: MIT -Type:: Rails Validation Plugin - - -Validates the form of an email address and verifies it's domain by checking if there are any -mail exchange or address servers associated with it. - -=== Options - -* message - - Changes the default error message. -* domain_check - - Skips server lookup unless true. -* timeout - - Time (in seconds) before the domain lookup is skipped. Default is 2. -* fail_on_timeout - - Causes validation to fail if a timeout occurs. -* timeout_message - - Changes the default timeout error message. -* mx_only - - When set, only mail exchange servers (MX) are looked up and the address server (A) - lookup is skipped. -* invalid_domains - - An array of domain names that are not to be used. Useful for stuff like dodgeit.com - and other services. -* invalid_domain_message - - Changes the default invalid domain error message. - - -=== Examples - -* validates_email_veracity_of :email, :message => 'is not correct.' - - Changes the default error message from 'is invalid.' to 'is not correct.' -* validates_email_veracity_of :email, :domain_check => false - - Domain lookup is skipped. -* validates_email_veracity_of :email, :timeout => 0.5 - - Causes the domain lookup to timeout if it does not complete within half a second. -* validates_email_veracity_of :email, :fail_on_timeout => true, :timeout_message => 'is invalid.' - - Causes the validation to fail on timeout and changes the error message to 'is invalid.' - to obfuscate it. -* validates_email_veracity_of :email, :mx_only => true - - The validator will only check the domain for mail exchange (MX) servers, ignoring address - servers (A) records. -* validates_email_veracity_of :email, :invalid_domains => %w[dodgeit.com harvard.edu] - - Any email addresses @dodgeit.com or @harvard.edu will be rejected. - - -=== Notes - -* You will need to be connected to the internet to utilize the remote features of the plugin - and to properly run the tests. -* To run the tests type rake test in the console from the plugin's root directory. -* The Resolv library has been known to screw up internally with a nil.include? error if - your domain resolver is ill-configured or out of service. \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/Rakefile b/vendor/plugins/validates_email_veracity_of/Rakefile deleted file mode 100644 index 49b9d0a8..00000000 --- a/vendor/plugins/validates_email_veracity_of/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the Email Veracity plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the Email Veracity plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Email Veracity Plugin' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/validates_email_veracity_of/init.rb b/vendor/plugins/validates_email_veracity_of/init.rb deleted file mode 100644 index 55b42941..00000000 --- a/vendor/plugins/validates_email_veracity_of/init.rb +++ /dev/null @@ -1 +0,0 @@ -require 'validation_extensions' \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb b/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb deleted file mode 100644 index 92fe43c3..00000000 --- a/vendor/plugins/validates_email_veracity_of/lib/validates_email_veracity_of.rb +++ /dev/null @@ -1,178 +0,0 @@ -# Contains the actual logic behind the plugin. -class ValidatesEmailVeracityOf - - - # Defines a server contains methods used to retrieve information from it. - class Server - - attr_accessor :name - - def to_s #:nodoc: - name - end - - def initialize(name = '') - self.name = name - end - - end - - - # Defines a domain and contains methods used to retrieve information from it such - # as mail exchange and address server information. - class Domain - - require 'resolv' - require 'timeout' - - attr_accessor :name - - # Creates a new Domain object, optionally accepts a domain as an argument. - # ==== Example - # Domain.new('gmail.com').exchange_servers # => ["ms1.google.com", - # "ms2.google.com", ...] - def initialize(name = '') - self.name = name - end - - def to_s #:nodoc: - name - end - - # Returns an array of server objects for address server the domain's A record, if - # the domain does not exist, it will return an empty array. If it times out, nil - # is returned. - # ==== Options - # * *timeout* - # - Sets a time (in seconds) that the method will time out and return nil. The - # default is two. - def address_servers(options = {}) - servers_in :address, options - end - - # Returns an array of server objects for each exchange server in the domain's MX - # record, if the domain does not exist, it will return an empty array. If it times - # out, nil is returned. - # ==== Options - # * *timeout* - # - Sets a time (in seconds) that the method will time out and return nil. The - # default is two. - def exchange_servers(options = {}) - servers_in :exchange, options - end - - protected - # Returns an array of server objects from the domain using the specified method. - # If the domain does not exist an empty array is returned. If the process times - # out, nil is returned. - # ==== Arguments - # * *record* - # - Either :exchange to return mail exchange servers (MX) or - # :address to return primary address servers (A) - # ==== Options - # * *timeout* - # - Sets a time (in seconds) that the method will time out and return nil. The - # default is two. - def servers_in(record, options = {}) - type = case record.to_s.downcase - when 'exchange' : Resolv::DNS::Resource::IN::MX - when 'address' : Resolv::DNS::Resource::IN::A - end - st = Timeout::timeout(options.fetch(:timeout, 2)) do - servers = [] - Resolv::DNS.open do |dns| - dns.getresources(name, type).each do |s| - servers << Server.new(s.send(record).to_s) - end - end - servers - end - rescue Timeout::Error - nil - end - - end - - - # Defines an email address and contains methods to perform things needed in order - # to validate it. - class EmailAddress - - attr_accessor :address - - # Creates a new EmailAddress object, optionally accepts an email address as an - # argument. - # ==== Example - # EmailAddress.new('heycarsten@gmail.com').domain # => "gmail.com" - def initialize(email = '') - self.address = email - end - - # Domains that we know have mail servers such as gmail.com, aol.com and - # yahoo.com. - def self.known_domains - %w[ aol.com gmail.com hotmail.com mac.com msn.com - rogers.com sympatico.ca yahoo.com ] - end - - # Checks the email's domain against any invalid domains passed in the options - # hash. This is useful when you don't want addresses from providers such as - # dodgeit.com. - # ==== Options - # * *invalid_domains* - # - An array of strings that indicate invalid domain names. - # ==== Example - # EmailAddress.new('carsten@dodgeit.com').domain_is_valid?(:invalid_domains => ['dodgeit.com']) # => false - def domain_is_valid?(options = {}) - configuration = { :invalid_domains => nil }.update(options) - return true unless configuration[:invalid_domains] - unless configuration[:invalid_domains].is_a?(Array) - raise ArgumentError, 'invalid_domains must be an Array' - end - !configuration[:invalid_domains].include?(domain.name.downcase) - end - - # Returns the domain portion of the email address. - # ==== Example - # EmailAddress.new('heycarsten@gmail.com').domain # => "gmail.com" - def domain - Domain.new((address.split('@')[1] || '').strip) - end - - # Verifies the email address for well-formedness against a well-known pattern. - # Note that it will not verifiy all RFC 2822 valid addresses. - def pattern_is_valid? - address =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i - end - - # Checks if the email address' domain has any servers in it's mail exchange (MX) - # or address (A) records. If it does then true is returned, otherwise false is - # returned. If the lookup times out, it will return false (or nil if the - # :fail_on_timeout option is specified.) Additionally the secondary (A record) - # lookup can be turned off (if your really picky) by passing in the option - # :mx_only => true. - # ==== Options - # * *mx_only* - # - The domain is only checked for the presence of mail exchange servers, the - # address record is ignored. - # * *timeout* - # - Time (in seconds) before the domain lookup is skipped. Default is two. - # * *fail_on_timeout* - # - Causes validation to fail if a timeout occurs. - def domain_has_servers?(options = {}) - return true if EmailAddress.known_domains.include?(domain.name.downcase) - servers = [] - servers << domain.exchange_servers(options) - servers << domain.address_servers(options) if !options[:mx_only] - servers.flatten! - if (servers.size - servers.nitems) > 0 - options.fetch(:fail_on_timeout, true) ? nil : true - else - !servers.empty? - end - end - - end - - -end diff --git a/vendor/plugins/validates_email_veracity_of/lib/validation_extensions.rb b/vendor/plugins/validates_email_veracity_of/lib/validation_extensions.rb deleted file mode 100644 index a7c304d8..00000000 --- a/vendor/plugins/validates_email_veracity_of/lib/validation_extensions.rb +++ /dev/null @@ -1,72 +0,0 @@ -module ActiveRecord - module Validations - module ClassMethods - - # Validates the form of an email address and verifies it's domain by checking if there are any - # mail exchange or address servers associated with it. - # - # ==== Options - # * message - # - Changes the default error message. - # * domain_check - # - Skips server lookup unless true. - # * timeout - # - Time (in seconds) before the domain lookup is skipped. Default is 2. - # * fail_on_timeout - # - Causes validation to fail if a timeout occurs. - # * timeout_message - # - Changes the default timeout error message. - # * mx_only - # - When set, only mail exchange servers (MX) are looked up and the address server (A) - # lookup is skipped. - # * invalid_domains - # - An array of domain names that are not to be used. Useful for stuff like dodgeit.com - # and other services. - # * invalid_domain_message - # - Changes the default invalid domain error message. - # - # ==== Examples - # * validates_email_veracity_of :email, :message => 'is not correct.' - # - Changes the default error message from 'is invalid.' to 'is not correct.' - # * validates_email_veracity_of :email, :domain_check => false - # - Domain lookup is skipped. - # * validates_email_veracity_of :email, :timeout => 0.5 - # - Causes the domain lookup to timeout if it does not complete within half a second. - # * validates_email_veracity_of :email, :fail_on_timeout => true, :timeout_message => 'is invalid.' - # - Causes the validation to fail on timeout and changes the error message to 'is invalid.' - # to obfuscate it. - # * validates_email_veracity_of :email, :mx_only => true - # - The validator will only check the domain for mail exchange (MX) servers, ignoring address - # servers (A) records. - # * validates_email_veracity_of :email, :invalid_domains => %w[dodgeit.com harvard.edu] - # - Any email addresses @dodgeit.com or @harvard.edu will be rejected. - def validates_email_veracity_of(*attr_names) - configuration = { - :message => 'is invalid.', - :timeout_message => 'domain is currently unreachable, try again later.', - :invalid_domain_message => 'provider is not supported, try another email address.', - :timeout => 2, - :domain_check => true, - :invalid_domains => [], - :mx_only => false, - :fail_on_timeout => false - } - configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) - validates_each(attr_names, configuration) do |record, attr_name, value| - next if value.blank? - email = ValidatesEmailVeracityOf::EmailAddress.new(value) - message = :message unless email.pattern_is_valid? - message = :invalid_domain_message unless email.domain_is_valid?(configuration) - if configuration[:domain_check] && !message - message = case email.domain_has_servers?(configuration) - when nil then :timeout_message - when false then :message - end - end - record.errors.add(attr_name, configuration[message]) if message - end - end - - end - end -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/fixtures/email.yml b/vendor/plugins/validates_email_veracity_of/test/fixtures/email.yml deleted file mode 100644 index f5e15e2b..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/fixtures/email.yml +++ /dev/null @@ -1,4 +0,0 @@ -fake: - address: test@fakefakefake.com -real: - address: wesley.moxam@savvica.com diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/README b/vendor/plugins/validates_email_veracity_of/test/rails_root/README deleted file mode 100644 index 7cd111f6..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/README +++ /dev/null @@ -1,211 +0,0 @@ -== Welcome to Rails - -Rails is a web-application and persistence framework that includes everything -needed to create database-backed web-applications according to the -Model-View-Control pattern of separation. This pattern splits the view (also -called the presentation) into "dumb" templates that are primarily responsible -for inserting pre-built data in between HTML tags. The model contains the -"smart" domain objects (such as Account, Product, Person, Post) that holds all -the business logic and knows how to persist themselves to a database. The -controller handles the incoming requests (such as Save New Account, Update -Product, Show Post) by manipulating the model and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting started - -1. At the command prompt, start a new rails application using the rails command - and your application name. Ex: rails myapp - (If you've downloaded rails in a complete tgz or zip, this step is already done) -2. Change directory into myapp and start the web server: script/server (run with --help for options) -3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!" -4. Follow the guidelines to start developing your application - - -== Web Servers - -By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise -Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server, -Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures -that you can always get up and running quickly. - -Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is -suitable for development and deployment of Rails applications. If you have Ruby Gems installed, -getting up and running with mongrel is as easy as: gem install mongrel. -More info at: http://mongrel.rubyforge.org - -If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than -Mongrel and WEBrick and also suited for production use, but requires additional -installation and currently only works well on OS X/Unix (Windows users are encouraged -to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from -http://www.lighttpd.net. - -And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby -web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not -for production. - -But of course its also possible to run Rails on any platform that supports FCGI. -Apache, LiteSpeed, IIS are just a few. For more information on FCGI, -please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands running -on the server.log and development.log. Rails will automatically display debugging -and runtime information to these files. Debugging info will also be shown in the -browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code using -the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/ including: - -* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two online (and free) books will bring you up to speed on the Ruby language -and also on programming in general. - - -== Breakpoints - -Breakpoint support is available through the script/breakpointer client. This -means that you can break out of execution at any point in the code, investigate -and change the model, AND then resume execution! Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - breakpoint "Breaking out from the list" - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the breakpointer window. Here you can do things like: - -Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' - - >> @posts.inspect - => "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>, - #\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" - >> @posts.first.title = "hello from a breakpoint" - => "hello from a breakpoint" - -...and even better is that you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you press CTRL-D - - -== Console - -You can interact with the domain model by starting the console through script/console. -Here you'll have all parts of the application configured, just like it is when the -application is running. You can inspect domain models, change values, and save to the -database. Starting the script without arguments will launch it in the development environment. -Passing an argument will specify a different environment, like script/console production. - -To reload your controllers and models after launching the console run reload! - -To reload your controllers and models after launching the console run reload! - - - -== Description of contents - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from ApplicationController - which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. - Most models will descend from ActiveRecord::Base. - -app/views - Holds the template files for the view that should be named like - weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby - syntax. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the common - header/footer method of wrapping views. In your views, define a layout using the - layout :default and create a file named default.rhtml. Inside default.rhtml, - call <% yield %> to render the view using this layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are generated - for you automatically when using script/generate for controllers. Helpers can be used to - wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, and other dependencies. - -components - Self-contained mini-applications that can bundle together controllers, models, and views. - -db - Contains the database schema in schema.rb. db/migrate contains all - the sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when generated - using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that doesn't - belong under controllers, models, or helpers. This directory is in the load path. - -public - The directory available for the web server. Contains subdirectories for images, stylesheets, - and javascripts. Also contains the dispatchers and the default HTML files. This should be - set as the DOCUMENT_ROOT of your web server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the script/generate scripts, template - test files will be generated for you and placed in this directory. - -vendor - External libraries that the application depends on. Also includes the plugins subdirectory. - This directory is in the load path. diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/Rakefile b/vendor/plugins/validates_email_veracity_of/test/rails_root/Rakefile deleted file mode 100644 index 3bb0e859..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/Rakefile +++ /dev/null @@ -1,10 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/controllers/application.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/controllers/application.rb deleted file mode 100644 index e4f52ab2..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/controllers/application.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ApplicationController < ActionController::Base - # Pick a unique cookie name to distinguish our session data from others' - session :session_key => '_rail_root_session_id' -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/helpers/application_helper.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/helpers/application_helper.rb deleted file mode 100644 index 22a7940e..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/helpers/application_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Methods added to this helper will be available to all templates in the application. -module ApplicationHelper -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email.rb deleted file mode 100644 index ef4c4aad..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Email < ActiveRecord::Base - - validates_email_veracity_of :address - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_fail_on_timeout.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_fail_on_timeout.rb deleted file mode 100644 index 231e775d..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_fail_on_timeout.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EmailFailOnTimeout < ActiveRecord::Base - - set_table_name :emails - validates_email_veracity_of :address, :fail_on_timeout => true, :timeout => 0.0001 - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_invalid_domains.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_invalid_domains.rb deleted file mode 100644 index 0eca7186..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_invalid_domains.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EmailInvalidDomains < ActiveRecord::Base - - set_table_name :emails - validates_email_veracity_of :address, :invalid_domains => %w[invalid.com invalid.ca surely-not-valid.net] - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_mx_only.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_mx_only.rb deleted file mode 100644 index 33b12300..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_mx_only.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EmailMxOnly < ActiveRecord::Base - - set_table_name :emails - validates_email_veracity_of :address, :mx_only => true - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_skip_remote.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_skip_remote.rb deleted file mode 100644 index c9b2c3d4..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_skip_remote.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EmailSkipRemote < ActiveRecord::Base - - set_table_name :emails - validates_email_veracity_of :address, :domain_check => false - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_timeout.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_timeout.rb deleted file mode 100644 index 857fb3ac..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/app/models/email_timeout.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EmailTimeout < ActiveRecord::Base - - set_table_name :emails - validates_email_veracity_of :address, :timeout => 0.0001 - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/boot.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/boot.rb deleted file mode 100644 index 0f034f07..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/boot.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb - -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -unless defined?(Rails::Initializer) - if File.directory?("#{RAILS_ROOT}/vendor/rails") - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - else - require 'rubygems' - - rails_gem_version = - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - else - File.read("#{File.dirname(__FILE__)}/environment.rb") =~ /^[^#]*RAILS_GEM_VERSION\s+=\s+'([\d.]+)'/ - $1 - end - - if rails_gem_version - rails_gem = Gem.cache.search('rails', "=#{rails_gem_version}.0").sort_by { |g| g.version.version }.last - - if rails_gem - gem "rails", "=#{rails_gem.version.version}" - require rails_gem.full_gem_path + '/lib/initializer' - else - STDERR.puts %(Cannot find gem for Rails =#{rails_gem_version}.0: - Install the missing gem with 'gem install -v=#{rails_gem_version} rails', or - change environment.rb to define RAILS_GEM_VERSION with your desired version. - ) - exit 1 - end - else - gem "rails" - require 'initializer' - end - end - - Rails::Initializer.run(:set_load_path) -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/database.yml b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/database.yml deleted file mode 100644 index 5fb11736..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/database.yml +++ /dev/null @@ -1,18 +0,0 @@ -sqlite: - :adapter: sqlite - :dbfile: validates_email_veracity_of_test.sqlite.db -sqlite3: - :adapter: sqlite3 - :dbfile: validates_email_veracity_of_test.sqlite3.db -postgresql: - :adapter: postgresql - :username: postgres - :password: postgres - :database: validates_email_veracity_of_test - :min_messages: ERROR -mysql: - :adapter: mysql - :host: localhost - :username: root - :password: - :database: validates_email_veracity_of_validation_test diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environment.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environment.rb deleted file mode 100644 index 093555a3..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environment.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - config.log_level = :debug - config.cache_classes = false - config.whiny_nils = true - config.breakpoint_server = true - config.load_paths << "#{File.dirname(__FILE__)}/../../../lib/" -end - -Dependencies.log_activity = true diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/development.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/development.rb deleted file mode 100644 index 0589aa97..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/development.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Enable the breakpoint server that script/breakpointer connects to -config.breakpoint_server = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_extensions = false -config.action_view.debug_rjs = true - -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/mysql.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/mysql.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/postgresql.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/postgresql.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/production.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/production.rb deleted file mode 100644 index cb295b83..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/production.rb +++ /dev/null @@ -1,18 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true - -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new - -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true - -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" - -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite3.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/sqlite3.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/test.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/test.rb deleted file mode 100644 index f0689b92..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/environments/test.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false - -# Tell ActionMailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/routes.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/config/routes.rb deleted file mode 100644 index 9bbc4637..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/config/routes.rb +++ /dev/null @@ -1,23 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - # The priority is based upon order of creation: first created -> highest priority. - - # Sample of regular route: - # map.connect 'products/:id', :controller => 'catalog', :action => 'view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' - # This route can be invoked with purchase_url(:id => product.id) - - # You can have the root of your site routed by hooking up '' - # -- just remember to delete public/index.html. - # map.connect '', :controller => "welcome" - - # Allow downloading Web Service WSDL as a file with an extension - # instead of a file named 'wsdl' - map.connect ':controller/service.wsdl', :action => 'wsdl' - - # Install the default route as the lowest priority. - map.connect ':controller/:action/:id.:format' - map.connect ':controller/:action/:id' -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/db/migrate/001_create_emails.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/db/migrate/001_create_emails.rb deleted file mode 100644 index b59d7585..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/db/migrate/001_create_emails.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateEmails < ActiveRecord::Migration - def self.up - create_table :emails do |t| - t.column :address, :string - end - end - - def self.down - drop_table :emails - end -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/script/console b/vendor/plugins/validates_email_veracity_of/test/rails_root/script/console deleted file mode 100755 index 42f28f7d..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/script/console +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/console' \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/script/runner b/vendor/plugins/validates_email_veracity_of/test/rails_root/script/runner deleted file mode 100755 index ccc30f9d..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/script/runner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/runner' \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/test/test_helper.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/test/test_helper.rb deleted file mode 100644 index a299c7f6..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/test/test_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -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. - 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 - - # Add more helper methods to be used by all tests here... -end diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/validates_email_veracity_of_test.sqlite3.db b/vendor/plugins/validates_email_veracity_of/test/rails_root/validates_email_veracity_of_test.sqlite3.db deleted file mode 100644 index 53220ea9c47c04132cdc6fd607b59e21b576865b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3072 zcmeH|u};G<5Qcqr1ykp$+bLZVsS~IZ3n>^>VNwX`&aA@vyUTf6a4gcP;MjT?N4kt~mKFSw=lGJ(p3{7ZPkf2l zyufTB#26!4mPT0{;a-~6Mw<9)GD+~BKcoxM79|2M2BQ(k|E_kmao4}=YF&Gh9`*MQ vFy1R;bzPyZ8uh76a+pnEzr?K&fj}V89Rds}z+wJRe){e(2rmr;I!)jY^0G!s diff --git a/vendor/plugins/validates_email_veracity_of/test/rails_root/vendor/plugins/phone_validation/init.rb b/vendor/plugins/validates_email_veracity_of/test/rails_root/vendor/plugins/phone_validation/init.rb deleted file mode 100644 index f678e8cc..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/rails_root/vendor/plugins/phone_validation/init.rb +++ /dev/null @@ -1,2 +0,0 @@ -init_path = "#{RAILS_ROOT}/../../init.rb" -silence_warnings { eval(IO.read(init_path), binding, init_path) } diff --git a/vendor/plugins/validates_email_veracity_of/test/test_helper.rb b/vendor/plugins/validates_email_veracity_of/test/test_helper.rb deleted file mode 100644 index 7d8727c6..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/test_helper.rb +++ /dev/null @@ -1,80 +0,0 @@ -ENV['RAILS_ENV'] ||= 'sqlite3' -require File.dirname(__FILE__) + '/rails_root/config/environment.rb' - -# Load the testing framework -require 'test_help' -silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] } - -# Run the migrations -ActiveRecord::Migrator.migrate("#{RAILS_ROOT}/db/migrate") - -# Setup the fixtures path -Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/" -$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path) - -class Test::Unit::TestCase #:nodoc: - - def create_fixtures(*table_names) - if block_given? - Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield } - else - Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) - end - end - - self.use_transactional_fixtures = true - self.use_instantiated_fixtures = false - - protected - def rfc2822_valid_addresses - ['"Abc\@def"@example.com', - '"Fred Bloggs"@example.com', - '"Joe\\\\Blow"@example.com', - '"Abc@def"@example.com', - 'customer/department=shipping@example.com', - '$A12345@example.com', - '!def!xyz%abc@example.com', - '_somename@example.com', - 'ice.cream@isfun.co.uk', - '"But I can not eat it because I am lactose intolerant!"@evildairy.on.ca'] - end - - def well_formed_addresses - ['itsme@heycarsten.com', - 'steve_jobs@apple.com', - 'SomeoneNice@SomePlace.com', - 'joe.blow@domain.co.uk', - 'joe.blow_2@web-site.net', - 'c00ki3@m0nst3r.org', - 'test+heycarsten@gmail.com'] - end - - def malformed_addresses - ['$#@%#@$%@#$%@#$%', - 'fake', - 'Do.Not.work', - 'nobody@', - '@', - '@noWhere.com', - 'hi*mom@%#+.&', - '#$%^&$', - 'sdf%^%@\'d.Com', - 'babyJesus@|cry.org', - 'hampton_smells_like_haml@.info'] - end - - def nonexistant_addresses - ['mynameis@slim.sha.dy', - 'butidont@reallylike.rap', - 'your_mother_was@hamster.and', - 'your_father_smells@of-elder-berr.ies'] - end - - def real_addresses - %w[ itsme@heycarsten.com - steve@apple.com - pete@unspace.ca - heycarsten@gmail.com ] - end - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/unit/library_test.rb b/vendor/plugins/validates_email_veracity_of/test/unit/library_test.rb deleted file mode 100644 index a652d7a9..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/unit/library_test.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'test/unit' -require 'test_helper' - - -class DomainTest < Test::Unit::TestCase - - def test_servers_with_no_name - domain = ValidatesEmailVeracityOf::Domain.new - assert domain.exchange_servers(:timeout => 30).empty?, 'Should fail gracefully by returning an empty array of mail servers.' - assert domain.address_servers(:timeout => 30).empty?, 'Should fail gracefully by returning an empty array of address servers.' - end - - def test_with_name_of_gmail_dot_com - domain = ValidatesEmailVeracityOf::Domain.new('gmail.com') - assert !domain.exchange_servers(:timeout => 30).empty?, 'Should return mail servers for gmail dot com.' - assert !domain.address_servers(:timeout => 30).empty?, 'Should return address servers for gmail dot com.' - end - - def test_with_nonexistant_name - domain = ValidatesEmailVeracityOf::Domain.new('idonot-exist.nil.xd') - assert domain.exchange_servers(:timeout => 30).empty?, 'Should return a blank array.' - assert domain.address_servers(:timeout => 30).empty?, 'Should return a blank array.' - end - - def test_timeout - domain = ValidatesEmailVeracityOf::Domain.new('nowhere-abcdef.ca') - assert !domain.exchange_servers(:timeout => 0.0001), 'Should return false by default on mail server timeout.' - assert !domain.address_servers(:timeout => 0.0001), 'Should return false by default on address server timeout.' - end - - def test_timeout_when_fail_on_timeout_is_set - domain = ValidatesEmailVeracityOf::Domain.new('nowhere-abcdef.ca') - assert_nil domain.exchange_servers(:timeout => 0.0001, :fail_on_timeout => true), 'Should return nil on mail server timeout.' - assert_nil domain.address_servers(:timeout => 0.0001, :fail_on_timeout => true), 'Should return nil on address server timeout.' - end - -end - - -class EmailAddressTest < Test::Unit::TestCase - - def test_with_invalid_domain - email = ValidatesEmailVeracityOf::EmailAddress.new('carsten@invalid.com') - assert !email.domain_is_valid?(:invalid_domains => %w[invalid.com]), 'Should not pass as a valid domain.' - end - - def test_domain_has_servers_with_no_email_address - email = ValidatesEmailVeracityOf::EmailAddress.new - assert !email.domain_has_servers?(:timeout => 30), 'Should fail gracefully.' - end - - def test_malformed_email_addresses - malformed_addresses.each do |address| - email = ValidatesEmailVeracityOf::EmailAddress.new(address) - assert_nil email.pattern_is_valid?, 'Should fail pattern validation.' - end - end - - def test_well_formed_email_addresses - well_formed_addresses.each do |address| - email = ValidatesEmailVeracityOf::EmailAddress.new(address) - assert email.pattern_is_valid?, 'Should pass pattern validation.' - end - end - - def test_itsme_at_heycarsten_dot_com - email = ValidatesEmailVeracityOf::EmailAddress.new('itsme@heycarsten.com') - assert email.domain_has_servers?(:timeout => 30), 'Should have servers.' - end - - def test_nobody_at_carstensnowhereland_dot_ca - email = ValidatesEmailVeracityOf::EmailAddress.new('nobody@carstensnowhereland.ca') - assert !email.domain_has_servers?(:timeout => 30), 'Should not have mail servers.' - end - - def test_an_object_with_no_address - email = ValidatesEmailVeracityOf::EmailAddress.new - assert_equal ValidatesEmailVeracityOf::Domain, email.domain.class, 'Should still have a domain object.' - end - - def test_an_object_with_an_address_but_no_domain - email = ValidatesEmailVeracityOf::EmailAddress.new('niltor@') - assert_equal '', email.domain.name, 'Should have a domain object with no name.' - end - -end \ No newline at end of file diff --git a/vendor/plugins/validates_email_veracity_of/test/unit/plugin_test.rb b/vendor/plugins/validates_email_veracity_of/test/unit/plugin_test.rb deleted file mode 100644 index 34f63d7e..00000000 --- a/vendor/plugins/validates_email_veracity_of/test/unit/plugin_test.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'test/unit' -require 'test_helper' - - -class ValidatesEmailVeracityOfTest < Test::Unit::TestCase - - def test_malformed_addresses - malformed_addresses.each do |email| - assert !Email.new(:address => email).valid?, 'Should not validate.' - end - end - - def test_well_formed_addresses - well_formed_addresses.each do |email| - assert EmailSkipRemote.new(:address => email).valid?, 'Should validate when skip remote is set.' - end - end - - def test_real_addresses - real_addresses.each do |email| - assert Email.new(:address => email).valid?, 'Should validate.' - end - end - - def test_email_addresses_with_nonexistant_domains - nonexistant_addresses.each do |email| - assert !Email.new(:address => email).valid?, 'Should not validate.' - end - end - - def test_email_address_with_mx_lookup_only - real_addresses.each do |email| - assert EmailMxOnly.new(:address => email).valid?, 'Should validate.' - end - end - - def test_email_address_with_invalid_domains - %w[carsten@invalid.com joe_smith@invalid.ca i_am@surely-not-valid.net].each do |email| - assert !EmailInvalidDomains.new(:address => email).valid?, 'Should not validate.' - end - end - - def test_blank_email_addresses - assert Email.new(:address => '').valid?, 'Should pass validation.' - end - - def test_nil_email_addresses - assert Email.new(:address => nil).valid?, 'Should pass validation.' - end - - def test_default_timeout_behavior - assert EmailTimeout.new(:address => 'fake@fake1fake2nowhere3.ca').valid?, 'Should pass validation on timeout.' - end - - def test_fail_on_timeout_behavior - assert !EmailFailOnTimeout.new(:address => 'fake@fake1fake2nowhere3.ca').valid?, 'Should fail validation on timeout.' - end - -end \ No newline at end of file From b60b4fe4cd97b4e5444a0faa8a3d577a562f3fcb Mon Sep 17 00:00:00 2001 From: alex-frost Date: Fri, 14 Mar 2014 10:58:47 -0700 Subject: [PATCH 09/18] fix some time zone issues --- test/fixtures/visits.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml index b99ba50b..f7a59f88 100644 --- a/test/fixtures/visits.yml +++ b/test/fixtures/visits.yml @@ -15,22 +15,22 @@ # mary_1: - arrived_at: 2007-02-01 18:01:00 + arrived_at: <%= DateTime.parse('2007-02-01 18:01:00 PST') %> volunteer: false staff: false member: true person: mary mary_2: - arrived_at: 2007-02-02 18:02:00 + arrived_at: <%= DateTime.parse('2007-02-02 18:02:00 PST') %> volunteer: true staff: false member: true person: mary - + <% (1..100).each do |count| %> daryl_<%= count %>: - arrived_at: <%= DateTime.parse('2007-02-02 18:02:00').advance(:hours => count * -16) %> + arrived_at: <%= DateTime.parse('2007-02-02 18:02:00 PST').advance(:hours => count * -16) %> person: daryl <% end %> From 7a2fdab6e78c0ed13270a95b2eb57914ea4ae9f1 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Sat, 15 Mar 2014 02:46:51 -0700 Subject: [PATCH 10/18] change require path --- script/console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/console b/script/console index 498077ab..e8cbb77f 100755 --- a/script/console +++ b/script/console @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' +require '../freehub/config/boot' require 'commands/console' From c8089ec616d2600690895f64b4feef077c22c04e Mon Sep 17 00:00:00 2001 From: alex-frost Date: Sat, 15 Mar 2014 03:16:11 -0700 Subject: [PATCH 11/18] use new auth consts --- Gemfile.lock | 2 +- config/environment.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fed890d3..49a25a8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/alex-frost/rails-authorization-plugin.git - revision: 83c1a1269b862a6978954ae9778399804f67bcd1 + revision: 5d2657cbfb64821da574e1f050b2de6456898902 specs: authorization (1.0.12) diff --git a/config/environment.rb b/config/environment.rb index 9eebff49..96c6832d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -8,7 +8,9 @@ # Authorization plugin AUTHORIZATION_MIXIN = 'object roles' -DEFAULT_REDIRECTION_HASH = { :controller => 'sessions', :action => 'new' } + +PERMISSION_DENIED_REDIRECTION = { :controller => 'sessions', :action => 'new' } +LOGIN_REQUIRED_REDIRECTION = PERMISSION_DENIED_REDIRECTION STORE_LOCATION_METHOD = :store_return_location Rails::Initializer.run do |config| From ed23a40fbfa736af5f95a23f4163d4af8339df3e Mon Sep 17 00:00:00 2001 From: Dan mi Sun Date: Tue, 18 Mar 2014 03:23:31 -0700 Subject: [PATCH 12/18] add :allow_blank to person.rb --- app/models/person.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/person.rb b/app/models/person.rb index 8d87aae8..623fa517 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -48,7 +48,7 @@ def on(service_type, time) validates_presence_of :first_name, :organization_id validates_uniqueness_of :email, :scope => :organization_id, :case_sensitive => false, :allow_nil => true, :allow_blank => true validates_length_of :first_name, :last_name, :street1, :street2, :city, :state, :postal_code, :country, :within => 1..40, :allow_blank => true - validates_email_format_of :email, :check_mx => true + validates_email_format_of :email, :check_mx => true, :allow_blank => true # Note that Date.today gets evaluates at class load time, not evaluation time, but we can live with that fudge validates_numericality_of :yob, :allow_nil => true, :only_integer => true, :greater_than => Date.today.year - 100, :less_than => Date.today.year + 1 From 4ccbb605c5110c73f210c8a608919601aba9f3ec Mon Sep 17 00:00:00 2001 From: alex-frost Date: Tue, 18 Mar 2014 03:59:24 -0700 Subject: [PATCH 13/18] fix csv newline issue, make the build green --- Gemfile.lock | 2 +- app/controllers/reports_controller.rb | 4 ++-- test/functional/reports_controller_test.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 49a25a8d..35704042 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/alex-frost/rails-authorization-plugin.git - revision: 5d2657cbfb64821da574e1f050b2de6456898902 + revision: 505bd47addf2ef5e3b5d98a7ea8d1352c2aa4ee6 specs: authorization (1.0.12) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index a5b6229e..ee49ea14 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -56,7 +56,7 @@ def services stream_csv("#{@organization.key}_services_#{@report[:end_after]}_#{@report[:end_before]}.csv") do |output| output.write CSV.generate_line(Service::CSV_FIELDS[:person] + Service::CSV_FIELDS[:self]) @services.each do |service| - output.write "\n#{service.to_csv}" + output.write "#{service.to_csv}" end end end @@ -84,7 +84,7 @@ def people stream_csv("#{@organization.key}_people_#{@report[:after]}_#{@report[:before]}.csv") do |output| output.write CSV.generate_line(Person::CSV_FIELDS[:self]) @people.each do |person| - output.write "\n#{person.to_csv}" + output.write "#{person.to_csv}" end end end diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb index 35d860c8..9309ce3d 100644 --- a/test/functional/reports_controller_test.rb +++ b/test/functional/reports_controller_test.rb @@ -84,7 +84,7 @@ def test_services_report_csv assert_nothing_raised { @response.body.call(@response, output) } lines = output.string.split("\n") assert_equal assigns(:services).size + 1, lines.size - assert_equal Service.csv_header, lines[0] + assert_equal Service.csv_header, lines[0]+"\n" assert_equal "attachment; filename=\"sfbk_services_2006-01-01_2009-01-01.csv\"", @response.headers['Content-Disposition'] end @@ -122,7 +122,7 @@ def test_people_report_csv assert_nothing_raised { @response.body.call(@response, output) } lines = output.string.split("\n") assert_equal assigns(:people).size + 1, lines.size - assert_equal Person.csv_header, lines[0] + assert_equal Person.csv_header, lines[0]+"\n" assert_equal "attachment; filename=\"sfbk_people_2008-01-01_2008-01-05.csv\"", @response.headers['Content-Disposition'] end From f0e933babbd97b77ce936e45efc68c6d24aa800e Mon Sep 17 00:00:00 2001 From: alex-frost Date: Tue, 18 Mar 2014 04:28:32 -0700 Subject: [PATCH 14/18] rm config/application.rb and revert script/console --- config/application.rb | 62 ------------------------------------------- script/console | 2 +- 2 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 config/application.rb diff --git a/config/application.rb b/config/application.rb deleted file mode 100644 index b811bf4f..00000000 --- a/config/application.rb +++ /dev/null @@ -1,62 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end - -module Del - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable escaping HTML in JSON. - config.active_support.escape_html_entities_in_json = true - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - end -end diff --git a/script/console b/script/console index e8cbb77f..498077ab 100755 --- a/script/console +++ b/script/console @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -require '../freehub/config/boot' +require File.dirname(__FILE__) + '/../config/boot' require 'commands/console' From 2d91f4461ed536500cd3eff04f9a9d2a9e942091 Mon Sep 17 00:00:00 2001 From: alex-frost Date: Tue, 18 Mar 2014 04:31:55 -0700 Subject: [PATCH 15/18] rm todo --- TODO | 4 ---- todo | 18 ------------------ 2 files changed, 22 deletions(-) delete mode 100644 TODO delete mode 100644 todo diff --git a/TODO b/TODO deleted file mode 100644 index b39284f2..00000000 --- a/TODO +++ /dev/null @@ -1,4 +0,0 @@ -= 2/12/2012 -Resolve deprecation warnings (rdoc, add_spec, haml) -Fix SendGrid emailing on staging - diff --git a/todo b/todo deleted file mode 100644 index 3de4fda6..00000000 --- a/todo +++ /dev/null @@ -1,18 +0,0 @@ -Move to new ruby / rails version -================================ - -The vendor plugins are very old and the format of keeping -them in a vendor dir is depricated. -rails-authorization-plugin -is a pain because it hasn't been worked on in years, -can we switch to using devise? Not sure if that would make -existing users lose their passwords. - -In the newer versions of rails the initialization / boot process -has changed. We need to migrate the config files to the new format. - - -Time zone issues -================ -The build only works on when using Pacific Ocean time zone. Some where -in the tests (maybe the fixtures..?) there is a implicit assumption. From 931e9aea9f564f2e72dc003acf35c93b2625a910 Mon Sep 17 00:00:00 2001 From: Alon Salant Date: Mon, 31 Mar 2014 21:38:54 -0700 Subject: [PATCH 16/18] Fix person name autocomplete - Array#toString change of behavior. --- app/helpers/people_helper.rb | 4 +++- test/functional/people_controller_test.rb | 26 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index e78d908d..2ae6dfa6 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -5,11 +5,13 @@ def auto_complete_result_with_add_person(entries, field, phrase = nil) return unless entries items = entries.map do |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field]), + :class => 'person', :url => person_path(:organization_key => @organization.key, :id => entry.id)) end items << content_tag("li", content_tag("b", 'Add Person'), + :class => 'add', :url => new_person_path(:organization_key => @organization.key)) - content_tag("ul", items.uniq) + content_tag("ul", items.uniq.join('')) end end diff --git a/test/functional/people_controller_test.rb b/test/functional/people_controller_test.rb index 2fc755e2..84505b1e 100644 --- a/test/functional/people_controller_test.rb +++ b/test/functional/people_controller_test.rb @@ -70,11 +70,27 @@ def test_requires_manager assert_redirected_to new_session_path end - def test_auto_complete - get :auto_complete_for_person_full_name, :organization_key => 'sfbk', :person => { :full_name => 'memb' } - assert_response :success - assert_not_nil assigns(:items) - assert_equal 1, assigns(:items).size + context "Auto-complete" do + + setup do + get :auto_complete_for_person_full_name, :organization_key => 'sfbk', :person => { :full_name => 'memb' } + end + + should respond_with :success + should assign_to :items + + should 'find matching items' do + assert_equal 1, assigns(:items).size + end + + should 'render list of people' do + assert_select 'ul li.person', 1 + end + + should 'render add link' do + assert_select 'ul li.add', 1 + end + end context "Update person" do From 13bc9410a70e7f31abd56b76f96f67ae6876474d Mon Sep 17 00:00:00 2001 From: Alon Salant Date: Mon, 31 Mar 2014 21:56:45 -0700 Subject: [PATCH 17/18] Fix bug where adding a tag did not show the full list of tags while in the edit state. --- app/controllers/taggings_controller.rb | 1 + test/functional/taggings_controller_test.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/taggings_controller.rb b/app/controllers/taggings_controller.rb index bd1c67e9..3495bf0d 100644 --- a/app/controllers/taggings_controller.rb +++ b/app/controllers/taggings_controller.rb @@ -5,6 +5,7 @@ def create @person.tag_list << params[:id] @person.save! if request.xhr? + @person.taggings.reload index else redirect_to_person_path diff --git a/test/functional/taggings_controller_test.rb b/test/functional/taggings_controller_test.rb index 857a8e08..0974bf50 100644 --- a/test/functional/taggings_controller_test.rb +++ b/test/functional/taggings_controller_test.rb @@ -68,6 +68,10 @@ class TaggingsControllerTest < ActionController::TestCase should 'have the new tag' do assert_equal ['mechanic', 'mom', 'three'], people(:mary).tag_list end + + should 'render links to delete tags' do + assert_select '.tags_control .edit .tag a.delete', 3 + end end end From 7f30df2f86080727267e1165a9a0153d8624d966 Mon Sep 17 00:00:00 2001 From: Alon Salant Date: Mon, 31 Mar 2014 22:04:42 -0700 Subject: [PATCH 18/18] Switch to using asalant/rails-authorization-plugin --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 2843f17a..e1726a76 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gem "rails", "2.3.17" gem "mysql" -gem "authorization", github: "alex-frost/rails-authorization-plugin" +gem "authorization", github: "asalant/rails-authorization-plugin" gem 'json', '1.7.7' # (CVE-2013-026) Can remove once rails depends on > 1.7.6 gem 'haml', "3.0.25" gem 'googlecharts', "1.6.0" diff --git a/Gemfile.lock b/Gemfile.lock index 35704042..9ea748b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GIT - remote: git://github.com/alex-frost/rails-authorization-plugin.git + remote: git://github.com/asalant/rails-authorization-plugin.git revision: 505bd47addf2ef5e3b5d98a7ea8d1352c2aa4ee6 specs: authorization (1.0.12)