active_permission 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a73ca4d8b69856637415f09baae78e1bff8a9569
4
- data.tar.gz: c715703d8f0ee0a9cdd4b3615f33a472e5c04311
3
+ metadata.gz: f7884c2a9df82a44420cf0cae72f544f8cfbe198
4
+ data.tar.gz: be5626d3cb6929fdb3b1331e0e6128f7c3a65aa4
5
5
  SHA512:
6
- metadata.gz: 4427383c2e3032e18848b164acee93a4dc747a197e44ae9645657ae26930405199be127bc95d330f3a9e2a4fbbc8dae979bf11cea4bb30ab0a0f1fa21e3cf254
7
- data.tar.gz: 108677d1708b6636109f7d53ff2c5750c271ee5f2306b0a20cd5f23dd38c9176f31af7037d9a80e743b9657e633411bdbe03eb179f60a11e1c26462c997a4e5e
6
+ metadata.gz: 741dc75811de73cb9115300c8ca614497df861354a35dc4774dbf6d381f5ea21ed4ba1e3ed23a7333280480f5637e30e29829d198e5ea95cc2aa2a5a326f8e16
7
+ data.tar.gz: 4d26ab693249a1af351c17083d91e26decbb5ce75e1fd9c4c187c84d115ebe9354b04b3b108d1119bcb4d55cb921093cbe406702f40c24c11b7fe16428b880ba
@@ -3,6 +3,7 @@ require 'active_permission/controller_additions'
3
3
  require 'active_permission/base'
4
4
 
5
5
  module ActivePermission
6
+ class MissingParameter < RuntimeError ; end
6
7
  class AccessDenied < RuntimeError
7
8
  attr_reader :controller, :action, :resources
8
9
  def initialize(controller = nil , action = nil , resources = nil)
@@ -49,7 +49,7 @@ module ActivePermission
49
49
  if options[:through] and options[:association]
50
50
  object = instance_variable_get("@#{options[:through]}").send(options[:association])
51
51
  elsif options[:object].nil?
52
- raise AccessDenied.new(controller.params[:controller], controller.params[:action], object)
52
+ raise MissingParameter.new('Please add parameter :object to resource')
53
53
  elsif options[:object].kind_of? Symbol
54
54
  object = send(options[:object])
55
55
  elsif options[:object].kind_of? String
@@ -1,3 +1,3 @@
1
1
  module ActivePermission
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_permission
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Shurmin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.4.5
108
+ rubygems_version: 2.4.5.1
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: This gem allow you load and authorize resource in Ruby on Rails inside controllers