permitters 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmY3NGJmNTczNzExZjRkYjQ3MDRiZWJiNGM3NDhjOWI5ZTYyZThlZQ==
4
+ YTE2MWYzNGU3OWQ3NzllN2E1M2NjZDg5ZWQzMzY3YWM1ZmNjOTk2Yg==
5
5
  data.tar.gz: !binary |-
6
- NmZmYTk1MTExNDg2YmQ4OGQyM2I5YjE2OTUzNjA2MGVhZjRlMGY4YQ==
6
+ YWM5ODEyZGFmMGJkOWUwNzYwMWI3MzVlOGY0MjEyY2ViMTYxZWY3ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmQ5ZGYxY2I4NTcwZDY1OTBkOTg0M2VmYzIwYWM4OTlhZjBjMjJiNGU1YzU4
10
- ZmU5OTY5MTVhNTFjZGMwZGFhN2MyNWFhN2Y5ODQ4ZGIzY2I2ZWM5ZmRjMDNj
11
- NzUxYTQzNWZiNjRmYTBmZjdiZGViMTdlMmY3NzI1YzJiZThmMDE=
9
+ MWQxZWU1YjIzNWYyOGY5OWQ5ODE5ZmRkNTllNzA2NmRkMDQwZTdhNzVkNTMy
10
+ MzMzMDNkZWEyNWU2YzdlYjM3NjRlMzFmZDE0MDE5Mjg5NzdjOTQwOWIyMTU5
11
+ MjE0MTc2YTJlYjVmZDdiMGZjYWFkZWNjMTU2N2UyM2E3ZGZmNTU=
12
12
  data.tar.gz: !binary |-
13
- OTcxMzUxMjBmNGFiNDg4MzliNDhmMTg1MzA2MTg5NTIzNjhkNWVmMzk2MTRk
14
- NzUxZTczN2M5MTFlMTE0MzQwNGZmOGZlNDZhM2MwMjBiZjczNmVlZDUzMTgx
15
- NGE2NGI1ZDRjZmVmMjg1YWVkMDQzNDIyNDNjOWI2NWM4NDkyMzA=
13
+ NmNjMDMwYWJiODE1NjI2NGI4YTgwZDg3MDM1YmQ1ODYzOTc1OTU4NGFlMTFi
14
+ NDAwMDQ3M2I4MDA0MDM2ODZmNjBiYTM3MWMzN2I5Y2UwNjJjZDY1OGZlODE3
15
+ YTJlY2RjOTQyNDdkNGQ3Mjc5OTgzNzNhZDRlM2ExZjk0Y2U1Y2I=
data/README.md CHANGED
@@ -12,7 +12,7 @@ The original version of the Permitters framework that this was based on was prov
12
12
  In your Rails app's `Gemfile`:
13
13
 
14
14
  ```ruby
15
- gem 'permitters', '~> 0.0.1'
15
+ gem 'permitters'
16
16
  ```
17
17
 
18
18
  Then:
@@ -81,6 +81,9 @@ class DealPermitter < ActionController::Permitter
81
81
  # No premissions required to set this
82
82
  permit :name, :description, :close_by, :state
83
83
 
84
+ # For non-scalar serialized attributes such as `Deal.serialize :favorite_colors, Array`
85
+ permit({:favorite_colors => [], {}})
86
+
84
87
  # can pass `:authorize` with a permission:
85
88
  # This line allows user_id if the user can read the user specified
86
89
  # by the user_id. This only happens if it's present
@@ -280,12 +283,14 @@ See the [changelog][changelog].
280
283
 
281
284
  ### Contributors
282
285
 
283
- * Adam Hawkins (https://github.com/twinturbo)
284
- * Gary Weaver (https://github.com/garysweaver)
286
+ * [Adam Hawkins](https://github.com/ahawkins)
287
+ * [Gary Weaver](https://github.com/garysweaver)
288
+ * [Mark Campbell](https://github.com/Nitrodist)
289
+ * [Alex Peattie](https://github.com/alexpeattie)
285
290
 
286
291
  ### License
287
292
 
288
- Copyright (c) 2013 Adam Hawkins and Gary S. Weaver, released under the [MIT license][lic].
293
+ Permitters is released under the [MIT license][lic].
289
294
 
290
295
  [post]: http://broadcastingadam.com/2012/07/parameter_authorization_in_rails_apis/
291
296
  [cancan]: https://github.com/ryanb/cancan
data/Rakefile CHANGED
@@ -5,14 +5,15 @@ require 'appraisal'
5
5
  require 'rspec/core/rake_task'
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default do |t|
8
+ # Override the default task
9
+ task :default => [] # Just in case it hasn't already been set
10
+ Rake::Task[:default].clear
11
+ task :default => :appraise
12
+
13
+ task :appraise do |t|
9
14
  if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
10
- exec 'rake spec'
15
+ Rake::Task[:spec].invoke
11
16
  else
12
- exec 'rake appraise'
17
+ exec 'rake appraisal:install && rake appraisal'
13
18
  end
14
19
  end
15
-
16
- task :appraise => ['appraisal:install'] do |t|
17
- exec 'rake appraisal'
18
- end
@@ -15,7 +15,7 @@ module ActionController
15
15
  pinstance = (@permitter_class_to_permitter ||= {})[pclass]
16
16
  return pinstance if pinstance
17
17
  current_authorizer_method = ActionController::Permitter.current_authorizer_method ? ActionController::Permitter.current_authorizer_method.to_sym : nil
18
- @permitter_class_to_permitter[pclass] = pclass.new(params, current_user, current_authorizer_method && defined?(current_authorizer_method) ? __send__(current_authorizer_method) : nil)
18
+ @permitter_class_to_permitter[pclass] = pclass.new(params, defined?(current_user) ? current_user : nil, current_authorizer_method && defined?(current_authorizer_method) ? __send__(current_authorizer_method) : nil)
19
19
  end
20
20
 
21
21
  # Returns the permitter class corresponding to the controller by matching everything in the controller class name
@@ -1,3 +1,3 @@
1
1
  module Permitters
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permitters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hawkins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-27 00:00:00.000000000 Z
12
+ date: 2013-10-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Permitters are an object-oriented way of defining what request parameters
15
15
  are permitted. using Strong Parameters. It is to Strong Parameters what ActiveModel::Serializers
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.0.3
51
+ rubygems_version: 2.0.6
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Object-oriented parameter authorization with Strong Parameters