joshuaclayton-sentinel 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/sentinel/controller.rb +7 -2
- data/sentinel.gemspec +10 -10
- data/shoulda_macros/sentinel.rb +1 -1
- data/test/partial_rails/controllers/application_controller.rb +3 -0
- metadata +5 -5
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ 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.4") 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"
|
data/lib/sentinel/controller.rb
CHANGED
@@ -2,6 +2,9 @@ module Sentinel
|
|
2
2
|
module Controller
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
+
base.class_inheritable_writer :sentinel, :instance_writer => false
|
6
|
+
base.class_inheritable_accessor :access_denied, :access_granted
|
7
|
+
|
5
8
|
base.send :include, InstanceMethods
|
6
9
|
base.extend ClassMethods
|
7
10
|
|
@@ -9,8 +12,6 @@ module Sentinel
|
|
9
12
|
helper_method :sentinel
|
10
13
|
end
|
11
14
|
|
12
|
-
base.class_inheritable_accessor :sentinel, :access_denied, :access_granted
|
13
|
-
|
14
15
|
base.on_denied_with do
|
15
16
|
respond_to do |format|
|
16
17
|
format.html { render :text => "You do not have the proper privileges to access this page.", :status => :unauthorized }
|
@@ -34,6 +35,10 @@ module Sentinel
|
|
34
35
|
self.sentinel = block
|
35
36
|
end
|
36
37
|
|
38
|
+
def sentinel
|
39
|
+
read_inheritable_attribute(:sentinel)
|
40
|
+
end
|
41
|
+
|
37
42
|
def on_denied_with(name = :default, &block)
|
38
43
|
self.access_denied ||= {}
|
39
44
|
self.access_denied[name] = block
|
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.4"
|
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-
|
9
|
+
s.date = %q{2009-05-05}
|
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"]
|
@@ -16,23 +16,23 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sentinel", "--main", "README.textile"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{sentinel}
|
19
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.2}
|
20
20
|
s.summary = %q{Simple authorization for Rails}
|
21
21
|
s.test_files = ["test/functional/sentinel_controller_test.rb", "test/test_helper.rb", "test/unit/sentinel_test.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
-
s.specification_version =
|
25
|
+
s.specification_version = 3
|
26
26
|
|
27
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
-
s.add_development_dependency(%q<actionpack>, [">= 0", "
|
29
|
-
s.add_development_dependency(%q<activesupport>, [">= 0", "
|
28
|
+
s.add_development_dependency(%q<actionpack>, [">= 0", ">= 2.1.0"])
|
29
|
+
s.add_development_dependency(%q<activesupport>, [">= 0", ">= 2.1.0"])
|
30
30
|
else
|
31
|
-
s.add_dependency(%q<actionpack>, [">= 0", "
|
32
|
-
s.add_dependency(%q<activesupport>, [">= 0", "
|
31
|
+
s.add_dependency(%q<actionpack>, [">= 0", ">= 2.1.0"])
|
32
|
+
s.add_dependency(%q<activesupport>, [">= 0", ">= 2.1.0"])
|
33
33
|
end
|
34
34
|
else
|
35
|
-
s.add_dependency(%q<actionpack>, [">= 0", "
|
36
|
-
s.add_dependency(%q<activesupport>, [">= 0", "
|
35
|
+
s.add_dependency(%q<actionpack>, [">= 0", ">= 2.1.0"])
|
36
|
+
s.add_dependency(%q<activesupport>, [">= 0", ">= 2.1.0"])
|
37
37
|
end
|
38
38
|
end
|
data/shoulda_macros/sentinel.rb
CHANGED
@@ -5,7 +5,7 @@ module Sentinel
|
|
5
5
|
context "When sentinel is set up to #{options.inspect}" do
|
6
6
|
setup do
|
7
7
|
options.keys.each do |key|
|
8
|
-
@controller.sentinel.stubs(key).returns(options[key])
|
8
|
+
@controller.sentinel.class.any_instance.stubs(key).returns(options[key])
|
9
9
|
end
|
10
10
|
options.keys.each do |key|
|
11
11
|
assert_equal options[key], @controller.sentinel.send(key)
|
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.4
|
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-
|
12
|
+
date: 2009-05-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.1.0
|
27
27
|
version:
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: "0"
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 2.1.0
|
40
40
|
version:
|
@@ -95,7 +95,7 @@ requirements: []
|
|
95
95
|
rubyforge_project: sentinel
|
96
96
|
rubygems_version: 1.2.0
|
97
97
|
signing_key:
|
98
|
-
specification_version:
|
98
|
+
specification_version: 3
|
99
99
|
summary: Simple authorization for Rails
|
100
100
|
test_files:
|
101
101
|
- test/functional/sentinel_controller_test.rb
|