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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3f96733ce7e408ff0b4898584a59e02e9de3c34
4
- data.tar.gz: efc94e4ef4df468d844279310de3ce068197bea3
3
+ metadata.gz: 13a453a54282b105475ead0fca3e6456f14e4031
4
+ data.tar.gz: b47cfb8ad4ada90f963b107f095aa394b9209db2
5
5
  SHA512:
6
- metadata.gz: 7e541628b696d2f01b60a65e260dbbd20c04c7c9e0dea12289d62aeda67862d786b4d123701384a154d080d69ddcb17be09999f45a9c6aecd7ce9dd34ad30ff2
7
- data.tar.gz: 2879a5834be6ba0727cf07620651eab855d93d49d06991d032a09a779414d651e429f3256616451e24977f3119b8446dc69ea9e22412a31ceaebf40bdf4971a6
6
+ metadata.gz: e4d14427df8937a81939043e88dcb9732fd9678aed159bb674ca8867b3f9bca36a7acb10c2bd9d5720d54d030c2f4f0658299f43218b153fd47f84ba58f9c114
7
+ data.tar.gz: 08bee54f39b0be0d5e04bddbe5687bc6d9f76ff5350373901237219d2a7f15e741c25726225c30f66c879037d2cedf70aef249a7c0e8e2a9c5228e7904486a9b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.12
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) ? klass.name :
89
- klass.is_a?(String) ? klass :
90
- klass.class.name
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
@@ -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.12 ruby lib
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.12"
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-11-28"
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.12
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-28 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails