kibali 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/kibali.gemspec +2 -2
- data/lib/kibali/access_control.rb +4 -0
- data/test/app/controllers/empty_controller.rb +2 -1
- data/test/test_access.rb +10 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/kibali.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "kibali"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daudi Amani"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-12-14"
|
13
13
|
s.description = "simple Rails role authentication"
|
14
14
|
s.email = "dsaronin@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -54,6 +54,10 @@ module Kibali
|
|
54
54
|
# shown as a loop, but only the first entry is meaningful
|
55
55
|
self.role_control_hash[my_role].each do |limit_type, action_list|
|
56
56
|
|
57
|
+
unless action_list.kind_of?( Array )
|
58
|
+
raise Kibali::SyntaxError, "all action lists should be arrays of symbols"
|
59
|
+
end
|
60
|
+
|
57
61
|
permitted = ( action_list.empty? || action_list.include?( expected_action ) )
|
58
62
|
|
59
63
|
case limit_type
|
@@ -10,7 +10,8 @@ class EmptyController < ApplicationController
|
|
10
10
|
:denier2 => { :deny => [ :index, :edit ] },
|
11
11
|
:error1 => { :wild => [ :index ] },
|
12
12
|
:error2 => { 'allow' => [ :index ] },
|
13
|
-
:error3 => { :allow => [ :index, 'show' ] }
|
13
|
+
:error3 => { :allow => [ :index, 'show' ] },
|
14
|
+
:error4 => { 'allow' => :index }
|
14
15
|
|
15
16
|
}
|
16
17
|
|
data/test/test_access.rb
CHANGED
@@ -144,6 +144,16 @@ context "ctlr" do
|
|
144
144
|
end # should do
|
145
145
|
|
146
146
|
|
147
|
+
should 'error action list syntax ' do
|
148
|
+
@deshaun.has_role!( :error4 )
|
149
|
+
|
150
|
+
assert_raise( Kibali::SyntaxError ) do
|
151
|
+
get :index, :user => @deshaun.id.to_s
|
152
|
+
end # block
|
153
|
+
|
154
|
+
end # should do
|
155
|
+
|
156
|
+
|
147
157
|
|
148
158
|
|
149
159
|
end # context
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kibali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: 455055425
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|