consul 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of consul might be problematic. Click here for more details.

data/.gitignore CHANGED
@@ -3,5 +3,6 @@ pkg
3
3
  *.gem
4
4
  .idea
5
5
  spec/app_root/log/*
6
+ Gemfile.lock
6
7
 
7
8
 
data/Gemfile CHANGED
@@ -1,9 +1,8 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '<3.0.0'
3
+ gem 'rails', '=2.3.11'
4
4
  gem 'consul', :path => '.'
5
5
  gem 'rspec', '=1.3.1'
6
6
  gem 'rspec-rails', '=1.3.3'
7
7
  gem 'jeweler'
8
8
  gem 'ruby-debug'
9
-
@@ -188,10 +188,10 @@ Should you for some obscure reason want to forego the power check:
188
188
  == Installation
189
189
 
190
190
  Add the following to your <tt>Gemfile</tt>:
191
- gem 'consul'
191
+ gem 'consul'
192
192
 
193
193
  Now run
194
- bundle install
194
+ bundle install
195
195
 
196
196
 
197
197
  == Rails 3 compatibility
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{consul}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
12
- s.date = %q{2011-04-12}
12
+ s.date = %q{2011-04-13}
13
13
  s.description = %q{Consul is a scope-based authorization solution for Ruby on Rails.}
14
14
  s.email = %q{henning.koch@makandra.de}
15
15
  s.extra_rdoc_files = [
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.files = [
19
19
  ".gitignore",
20
20
  "Gemfile",
21
- "Gemfile.lock",
22
21
  "README.rdoc",
23
22
  "Rakefile",
24
23
  "VERSION",
@@ -29,6 +28,9 @@ Gem::Specification.new do |s|
29
28
  "lib/consul/power.rb",
30
29
  "lib/consul/spec/matchers.rb",
31
30
  "spec/app_root/app/controllers/application_controller.rb",
31
+ "spec/app_root/app/controllers/dashboards_controller.rb",
32
+ "spec/app_root/app/controllers/songs_controller.rb",
33
+ "spec/app_root/app/controllers/users_controller.rb",
32
34
  "spec/app_root/app/models/client.rb",
33
35
  "spec/app_root/app/models/note.rb",
34
36
  "spec/app_root/app/models/power.rb",
@@ -49,6 +51,9 @@ Gem::Specification.new do |s|
49
51
  "spec/app_root/log/.gitignore",
50
52
  "spec/app_root/script/console",
51
53
  "spec/consul/power_spec.rb",
54
+ "spec/controllers/dashboards_controller_spec.rb",
55
+ "spec/controllers/songs_controller_spec.rb",
56
+ "spec/controllers/users_controller_spec.rb",
52
57
  "spec/rcov.opts",
53
58
  "spec/spec.opts",
54
59
  "spec/spec_helper.rb"
@@ -64,20 +69,26 @@ Gem::Specification.new do |s|
64
69
  "spec/app_root/db/migrate/003_create_notes.rb",
65
70
  "spec/app_root/config/boot.rb",
66
71
  "spec/app_root/config/environment.rb",
67
- "spec/app_root/config/routes.rb",
68
72
  "spec/app_root/config/environments/in_memory.rb",
69
73
  "spec/app_root/config/environments/mysql.rb",
70
74
  "spec/app_root/config/environments/postgresql.rb",
71
75
  "spec/app_root/config/environments/sqlite.rb",
72
76
  "spec/app_root/config/environments/sqlite3.rb",
77
+ "spec/app_root/config/routes.rb",
73
78
  "spec/app_root/lib/console_with_fixtures.rb",
79
+ "spec/app_root/app/controllers/dashboards_controller.rb",
74
80
  "spec/app_root/app/controllers/application_controller.rb",
81
+ "spec/app_root/app/controllers/users_controller.rb",
82
+ "spec/app_root/app/controllers/songs_controller.rb",
75
83
  "spec/app_root/app/models/client.rb",
76
84
  "spec/app_root/app/models/note.rb",
77
- "spec/app_root/app/models/power.rb",
78
85
  "spec/app_root/app/models/user.rb",
86
+ "spec/app_root/app/models/power.rb",
79
87
  "spec/consul/power_spec.rb",
80
- "spec/spec_helper.rb"
88
+ "spec/spec_helper.rb",
89
+ "spec/controllers/users_controller_spec.rb",
90
+ "spec/controllers/dashboards_controller_spec.rb",
91
+ "spec/controllers/songs_controller_spec.rb"
81
92
  ]
82
93
 
83
94
  if s.respond_to? :specification_version then
@@ -68,7 +68,7 @@ module Consul
68
68
 
69
69
  private
70
70
 
71
- def unchecked_permissions
71
+ def unchecked_power
72
72
  raise Consul::UncheckedPower, "This controller does not check against a power"
73
73
  end
74
74
 
@@ -1,4 +1,4 @@
1
- module Aegis
1
+ module Consul
2
2
  module Spec
3
3
  module Matchers
4
4
 
@@ -37,4 +37,4 @@ module Aegis
37
37
  end
38
38
  end
39
39
 
40
- ActiveSupport::TestCase.send :include, Aegis::Spec::Matchers
40
+ ActiveSupport::TestCase.send :include, Consul::Spec::Matchers
@@ -1,3 +1,12 @@
1
1
  class ApplicationController < ActionController::Base
2
+ include Consul::Controller
2
3
 
4
+ require_power_check
5
+
6
+ private
7
+
8
+ def current_power
9
+ Power.new User.new
10
+ end
11
+
3
12
  end
@@ -0,0 +1,8 @@
1
+ class DashboardsController < ApplicationController
2
+
3
+ power :dashboard
4
+
5
+ def show
6
+ end
7
+
8
+ end
@@ -0,0 +1,13 @@
1
+ class SongsController < ApplicationController
2
+
3
+ # power check is missing
4
+
5
+ skip_power_check :only => :index
6
+
7
+ def show
8
+ end
9
+
10
+ def index
11
+ end
12
+
13
+ end
@@ -0,0 +1,11 @@
1
+ class UsersController < ApplicationController
2
+
3
+ power :admin, :map => { :index => :dashboard }
4
+
5
+ def index
6
+ end
7
+
8
+ def show
9
+ end
10
+
11
+ end
@@ -1,7 +1,9 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
 
3
- map.resources :properties do |properties|
4
- properties.resources :reviews
5
- end
3
+ map.resource :dashboard
4
+
5
+ map.resources :songs
6
+
7
+ map.resources :users
6
8
 
7
9
  end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe DashboardsController do
4
+
5
+ it "should not raise an error if the checked power is given" do
6
+ expect { get :show }.to_not raise_error
7
+ end
8
+
9
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe SongsController do
4
+
5
+ it "should raise an error if an action is not checked against a power" do
6
+ expect { get :show, :id => '123' }.to raise_error(Consul::UncheckedPower)
7
+ end
8
+
9
+ it 'should allow to skip a required power check' do
10
+ expect { get :index }.to_not raise_error
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe UsersController do
4
+
5
+ it "should raise an error if the checked power is not given" do
6
+ expect { get :show, :id => '1' }.to raise_error(Consul::Powerless)
7
+ end
8
+
9
+ it 'should allow to map actions to another power' do
10
+ expect { get :index }.to_not raise_error
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-12 00:00:00 +02:00
18
+ date: 2011-04-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -30,7 +30,6 @@ extra_rdoc_files:
30
30
  files:
31
31
  - .gitignore
32
32
  - Gemfile
33
- - Gemfile.lock
34
33
  - README.rdoc
35
34
  - Rakefile
36
35
  - VERSION
@@ -41,6 +40,9 @@ files:
41
40
  - lib/consul/power.rb
42
41
  - lib/consul/spec/matchers.rb
43
42
  - spec/app_root/app/controllers/application_controller.rb
43
+ - spec/app_root/app/controllers/dashboards_controller.rb
44
+ - spec/app_root/app/controllers/songs_controller.rb
45
+ - spec/app_root/app/controllers/users_controller.rb
44
46
  - spec/app_root/app/models/client.rb
45
47
  - spec/app_root/app/models/note.rb
46
48
  - spec/app_root/app/models/power.rb
@@ -61,6 +63,9 @@ files:
61
63
  - spec/app_root/log/.gitignore
62
64
  - spec/app_root/script/console
63
65
  - spec/consul/power_spec.rb
66
+ - spec/controllers/dashboards_controller_spec.rb
67
+ - spec/controllers/songs_controller_spec.rb
68
+ - spec/controllers/users_controller_spec.rb
64
69
  - spec/rcov.opts
65
70
  - spec/spec.opts
66
71
  - spec/spec_helper.rb
@@ -104,17 +109,23 @@ test_files:
104
109
  - spec/app_root/db/migrate/003_create_notes.rb
105
110
  - spec/app_root/config/boot.rb
106
111
  - spec/app_root/config/environment.rb
107
- - spec/app_root/config/routes.rb
108
112
  - spec/app_root/config/environments/in_memory.rb
109
113
  - spec/app_root/config/environments/mysql.rb
110
114
  - spec/app_root/config/environments/postgresql.rb
111
115
  - spec/app_root/config/environments/sqlite.rb
112
116
  - spec/app_root/config/environments/sqlite3.rb
117
+ - spec/app_root/config/routes.rb
113
118
  - spec/app_root/lib/console_with_fixtures.rb
119
+ - spec/app_root/app/controllers/dashboards_controller.rb
114
120
  - spec/app_root/app/controllers/application_controller.rb
121
+ - spec/app_root/app/controllers/users_controller.rb
122
+ - spec/app_root/app/controllers/songs_controller.rb
115
123
  - spec/app_root/app/models/client.rb
116
124
  - spec/app_root/app/models/note.rb
117
- - spec/app_root/app/models/power.rb
118
125
  - spec/app_root/app/models/user.rb
126
+ - spec/app_root/app/models/power.rb
119
127
  - spec/consul/power_spec.rb
120
128
  - spec/spec_helper.rb
129
+ - spec/controllers/users_controller_spec.rb
130
+ - spec/controllers/dashboards_controller_spec.rb
131
+ - spec/controllers/songs_controller_spec.rb
@@ -1,58 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- consul (0.0.1)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- actionmailer (2.3.10)
10
- actionpack (= 2.3.10)
11
- actionpack (2.3.10)
12
- activesupport (= 2.3.10)
13
- rack (~> 1.1.0)
14
- activerecord (2.3.10)
15
- activesupport (= 2.3.10)
16
- activeresource (2.3.10)
17
- activesupport (= 2.3.10)
18
- activesupport (2.3.10)
19
- columnize (0.3.2)
20
- gemcutter (0.6.1)
21
- git (1.2.5)
22
- jeweler (1.4.0)
23
- gemcutter (>= 0.1.0)
24
- git (>= 1.2.5)
25
- rubyforge (>= 2.0.0)
26
- json_pure (1.4.6)
27
- linecache (0.43)
28
- rack (1.1.0)
29
- rails (2.3.10)
30
- actionmailer (= 2.3.10)
31
- actionpack (= 2.3.10)
32
- activerecord (= 2.3.10)
33
- activeresource (= 2.3.10)
34
- activesupport (= 2.3.10)
35
- rake (>= 0.8.3)
36
- rake (0.8.7)
37
- rspec (1.3.1)
38
- rspec-rails (1.3.3)
39
- rack (>= 1.0.0)
40
- rspec (= 1.3.1)
41
- ruby-debug (0.10.4)
42
- columnize (>= 0.1)
43
- ruby-debug-base (~> 0.10.4.0)
44
- ruby-debug-base (0.10.4)
45
- linecache (>= 0.3)
46
- rubyforge (2.0.4)
47
- json_pure (>= 1.1.7)
48
-
49
- PLATFORMS
50
- ruby
51
-
52
- DEPENDENCIES
53
- consul!
54
- jeweler
55
- rails (< 3.0.0)
56
- rspec (= 1.3.1)
57
- rspec-rails (= 1.3.3)
58
- ruby-debug