simple-navigation-acl 0.1.2 → 0.1.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/README.md +6 -1
- data/lib/simple_navigation_acl/base.rb +3 -2
- data/lib/simple_navigation_acl/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: fdb8332bcf728cb3dc6929fd66efc3c14c9ae075
|
4
|
+
data.tar.gz: f2f2f3bf37a53df4b321bf7c6c4e02148f7e390b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676dccb0ab8b820259e1f4cc73bfb35573edc5fefcbad4f22ed2a2265bc76d84d3b582829e9985102c9288916ac76a47d7166212704608adb4944ca7e7c3335b
|
7
|
+
data.tar.gz: ec854928da332e87c2c61a65c3eb8a7a4cb975e2167250e19279d9ff2e2a4a41410bc5dbcac3b6a3cf2e5b1117659a34a05f88b0cfd9d39d92207db91fddfcc4
|
data/README.md
CHANGED
@@ -28,7 +28,12 @@ Add it to your **app/assets/javascripts/application.js**
|
|
28
28
|
|
29
29
|
Modify simple-navigation helper `render_navigation` in your views to simple-navigation-acl helper `render_navigation_acl` and add param `acl_id`, like:
|
30
30
|
```haml
|
31
|
-
= render_navigation_acl acl_id: current_user.role
|
31
|
+
= render_navigation_acl acl_id: current_user.role
|
32
|
+
```
|
33
|
+
|
34
|
+
If you need to see all navigations like a Super Admin, pass `:all` to **acl_id**:
|
35
|
+
```haml
|
36
|
+
= render_navigation_acl acl_id: :all
|
32
37
|
```
|
33
38
|
|
34
39
|
|
@@ -35,9 +35,10 @@ module SimpleNavigationAcl
|
|
35
35
|
|
36
36
|
def apply_acl(navigation, id, context)
|
37
37
|
context=:default if context.nil?
|
38
|
-
rules_keys = SimpleNavigationAcl::AclRule.where(
|
38
|
+
rules_keys = SimpleNavigationAcl::AclRule.where(context: context)
|
39
|
+
rules_keys = rules_keys.where(id: id) unless id==:all
|
39
40
|
container = navigation.is_a?(SimpleNavigation::Configuration) ? navigation.instance_variable_get(:@primary_navigation) : navigation
|
40
|
-
filter_simple_navigation_with_rules!(container, rules_keys)
|
41
|
+
filter_simple_navigation_with_rules!(container, rules_keys.pluck(:key))
|
41
42
|
true
|
42
43
|
end
|
43
44
|
|