rarbac 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/helpers/rarbac/application_helper.rb +11 -3
- data/lib/rarbac/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29554fd5e3f334856cbaada6930537167c8a79f6
|
4
|
+
data.tar.gz: 945169b4e0c4222a707c94913e4a9d62206021a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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,
|
46
|
-
|
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
|
data/lib/rarbac/version.rb
CHANGED