joshuaclayton-sentinel 0.1.1 → 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.
- data/Manifest +16 -0
- data/Rakefile +2 -2
- data/sentinel.gemspec +5 -2
- data/shoulda_macros/sentinel.rb +5 -2
- metadata +15 -2
data/Manifest
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
lib/sentinel/controller.rb
|
2
|
+
lib/sentinel/sentinel.rb
|
3
|
+
lib/sentinel.rb
|
4
|
+
Manifest
|
5
|
+
MIT-LICENSE
|
6
|
+
rails/init.rb
|
7
|
+
Rakefile
|
8
|
+
README.textile
|
9
|
+
sentinel.gemspec
|
10
|
+
shoulda_macros/sentinel.rb
|
11
|
+
test/functional/sentinel_controller_test.rb
|
12
|
+
test/partial_rails/controllers/application_controller.rb
|
13
|
+
test/partial_rails/controllers/forums_controller.rb
|
14
|
+
test/partial_rails/forum_sentinel.rb
|
15
|
+
test/test_helper.rb
|
16
|
+
test/unit/sentinel_test.rb
|
data/Rakefile
CHANGED
@@ -3,13 +3,13 @@ require 'rake'
|
|
3
3
|
require 'echoe'
|
4
4
|
require 'rake/rdoctask'
|
5
5
|
|
6
|
-
Echoe.new("sentinel", "0.1.
|
6
|
+
Echoe.new("sentinel", "0.1.3") do |p|
|
7
7
|
p.description = "Simple authorization for Rails"
|
8
8
|
p.url = "http://github.com/joshuaclayton/sentinel"
|
9
9
|
p.author = "Joshua Clayton"
|
10
10
|
p.email = "joshua.clayton@gmail.com"
|
11
11
|
p.ignore_pattern = ["tmp/*"]
|
12
|
-
p.development_dependencies = ["actionpack >= 2.1.0"]
|
12
|
+
p.development_dependencies = ["actionpack >= 2.1.0", "activesupport >= 2.1.0"]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'Generate documentation for the sentinel plugin.'
|
data/sentinel.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{sentinel}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Joshua Clayton"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-10}
|
10
10
|
s.description = %q{Simple authorization for Rails}
|
11
11
|
s.email = %q{joshua.clayton@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["lib/sentinel/controller.rb", "lib/sentinel/sentinel.rb", "lib/sentinel.rb", "README.textile"]
|
@@ -26,10 +26,13 @@ Gem::Specification.new do |s|
|
|
26
26
|
|
27
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
28
|
s.add_development_dependency(%q<actionpack>, [">= 0", "= 2.1.0"])
|
29
|
+
s.add_development_dependency(%q<activesupport>, [">= 0", "= 2.1.0"])
|
29
30
|
else
|
30
31
|
s.add_dependency(%q<actionpack>, [">= 0", "= 2.1.0"])
|
32
|
+
s.add_dependency(%q<activesupport>, [">= 0", "= 2.1.0"])
|
31
33
|
end
|
32
34
|
else
|
33
35
|
s.add_dependency(%q<actionpack>, [">= 0", "= 2.1.0"])
|
36
|
+
s.add_dependency(%q<activesupport>, [">= 0", "= 2.1.0"])
|
34
37
|
end
|
35
38
|
end
|
data/shoulda_macros/sentinel.rb
CHANGED
@@ -48,7 +48,8 @@ module Sentinel
|
|
48
48
|
def should_grant_access_to(command)
|
49
49
|
context "performing `#{command}`" do
|
50
50
|
should "allow access" do
|
51
|
-
@controller.class.
|
51
|
+
granted = @controller.class.read_inheritable_attribute(:access_granted)
|
52
|
+
@controller.class.expects(:access_granted).at_least(1).returns(granted)
|
52
53
|
eval command
|
53
54
|
end
|
54
55
|
end
|
@@ -60,7 +61,9 @@ module Sentinel
|
|
60
61
|
|
61
62
|
context "performing `#{command}`" do
|
62
63
|
should "call the proper denied handler" do
|
63
|
-
|
64
|
+
denied_with = options[:with] || :default
|
65
|
+
handler = @controller.class.read_inheritable_attribute(:access_denied)[denied_with]
|
66
|
+
@controller.class.access_denied.expects(:[]).with(denied_with).returns(handler)
|
64
67
|
eval command
|
65
68
|
end
|
66
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joshuaclayton-sentinel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Clayton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.1.0
|
27
27
|
version:
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activesupport
|
30
|
+
type: :development
|
31
|
+
version_requirement:
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: "0"
|
37
|
+
- - "="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.1.0
|
40
|
+
version:
|
28
41
|
description: Simple authorization for Rails
|
29
42
|
email: joshua.clayton@gmail.com
|
30
43
|
executables: []
|