rarbac 0.0.2 → 0.0.3

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: ce43d1567a57a30f8b620d6e1170cf20f74dd7be
4
- data.tar.gz: 5f0157aa6b2e5344afcbcfb4fc3b91e27cc79294
3
+ metadata.gz: 29554fd5e3f334856cbaada6930537167c8a79f6
4
+ data.tar.gz: 945169b4e0c4222a707c94913e4a9d62206021a9
5
5
  SHA512:
6
- metadata.gz: 7cb575153cbfd401d280ce2f30952b31391dc269ca8062dd16c9416280c887ee2a1a3685b3a4da9d7621297522466c5c7be6537e4dfc66853f575b8b58335ca5
7
- data.tar.gz: 791b13437baf4522404da91606ced01f6e92a168a0a1fc7cf15559255cb21809a8d20cb1d4319bfe0e26d50f7a6c56ff7647f6e25e1db74b559579ac825d7c95
6
+ metadata.gz: f8679666bcde1c267c35b46e1f97cd815c27f446da28c410b656c596c5c93dedfbf3f04a9a1ec3a01b1dfd57e6f03660bcae2c0974cc21f52c34cc969482e582
7
+ data.tar.gz: 3e31e604fbd57db8aa2abdfbdddf108a4b50b7a740e96997b65a5d77ad5bfe8808a97028a6930a30948c2acf0aac4276b55a99ec46f65136f8fbc3c2b2252e60
@@ -37,13 +37,21 @@ module Rarbac
37
37
  action = "#{klass}##{action_name}"
38
38
  end
39
39
 
40
- has_something?(:has_permission?, action, block)
40
+ # If the action doesn't exist, don't worry about the current_user
41
+ if Action.where(name: action).count == 0
42
+ maybe_render(true, block)
43
+ else
44
+ has_something?(:has_permission?, action, block)
45
+ end
41
46
  end
42
47
 
43
48
  private
44
49
 
45
- def has_something?(method, args, &block)
46
- success = current_user.send(method, args)
50
+ def has_something?(method, args, block)
51
+ maybe_render(current_user.send(method, args), block)
52
+ end
53
+
54
+ def maybe_render(success, block)
47
55
  if block
48
56
  block.call(success)
49
57
  elsif !success
@@ -1,3 +1,3 @@
1
1
  module Rarbac
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rarbac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Margison