vigilante 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/models/permission_hash.rb +8 -3
- data/spec/models/permission_hash_spec.rb +14 -0
- data/vigilante.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13a453a54282b105475ead0fca3e6456f14e4031
|
4
|
+
data.tar.gz: b47cfb8ad4ada90f963b107f095aa394b9209db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d14427df8937a81939043e88dcb9732fd9678aed159bb674ca8867b3f9bca36a7acb10c2bd9d5720d54d030c2f4f0658299f43218b153fd47f84ba58f9c114
|
7
|
+
data.tar.gz: 08bee54f39b0be0d5e04bddbe5687bc6d9f76ff5350373901237219d2a7f15e741c25726225c30f66c879037d2cedf70aef249a7c0e8e2a9c5228e7904486a9b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.13
|
@@ -85,9 +85,13 @@ class PermissionHash < HashWithIndifferentAccess
|
|
85
85
|
|
86
86
|
|
87
87
|
def to_controller_name(klass)
|
88
|
-
klass_str = klass.is_a?(Class)
|
89
|
-
|
90
|
-
klass.
|
88
|
+
klass_str = if klass.is_a?(Class)
|
89
|
+
klass.name
|
90
|
+
elsif klass.is_a?(String) || klass.is_a?(Symbol)
|
91
|
+
klass.to_s
|
92
|
+
else
|
93
|
+
klass.class.name
|
94
|
+
end
|
91
95
|
"#{klass_str.underscore.pluralize}"
|
92
96
|
end
|
93
97
|
|
@@ -113,6 +117,7 @@ class PermissionHash < HashWithIndifferentAccess
|
|
113
117
|
action = action || 'index'
|
114
118
|
action = action.to_sym
|
115
119
|
controller_name = 'homepage' if controller_name == '/'
|
120
|
+
controller_name = controller_name.underscore
|
116
121
|
controller_name = controller_name[1..-1] if controller_name.starts_with?('/')
|
117
122
|
|
118
123
|
p = ''
|
@@ -66,6 +66,20 @@ describe PermissionHash do
|
|
66
66
|
it "can visit posts index in context 1" do
|
67
67
|
@ph.is_allowed_by_context('posts', :index, ['1']).should be_true
|
68
68
|
end
|
69
|
+
describe "alternative writing styles" do
|
70
|
+
it "can visit :post index in context 1" do
|
71
|
+
@ph.is_allowed_by_context(:post, :index, ['1']).should be_true
|
72
|
+
end
|
73
|
+
it "can visit :post index in context 1" do
|
74
|
+
@ph.is_allowed_by_context(Post, :index, ['1']).should be_true
|
75
|
+
end
|
76
|
+
it "can visit :post index in context 1" do
|
77
|
+
@ph.is_allowed_by_context(:posts, :index, ['1']).should be_true
|
78
|
+
end
|
79
|
+
it "cannot visit 'post' index in context 1 --strings are not transformed" do
|
80
|
+
@ph.is_allowed_by_context('post', :index, ['1']).should be_false
|
81
|
+
end
|
82
|
+
end
|
69
83
|
it "cannot visit posts index without context" do
|
70
84
|
@ph.is_allowed_by_context('posts', :index, nil).should be_false
|
71
85
|
end
|
data/vigilante.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: vigilante 1.0.
|
5
|
+
# stub: vigilante 1.0.13 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vigilante"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.13"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Nathan Van der Auwera"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-12-15"
|
15
15
|
s.description = "Vigilante is a db-backed authorisation, completely configurable and dynamic; where permissions can be limited to extents."
|
16
16
|
s.email = "nathan@dixis.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vigilante
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Van der Auwera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|