cbac 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +6 -1
- data/Rakefile +1 -1
- data/cbac.gemspec +5 -5
- data/generators/cbac/templates/fixtures/cbac_generic_roles.yml +9 -9
- data/generators/cbac/templates/fixtures/cbac_memberships.yml +8 -8
- data/generators/cbac/templates/fixtures/cbac_permissions.yml +8 -8
- data/lib/cbac.rb +1 -2
- data/lib/cbac/cbac_pristine/pristine_file.rb +2 -1
- data/lib/cbac/privilege_new_api.rb +56 -0
- data/test/fixtures/cbac_generic_roles.yml +9 -9
- data/test/fixtures/cbac_memberships.yml +8 -8
- data/test/fixtures/cbac_permissions.yml +14 -14
- data/test/fixtures/cbac_privilege_set.yml +18 -18
- data/test/test_cbac_actions.rb +71 -0
- data/test/test_cbac_authorize_context_roles.rb +4 -7
- data/vendor/plugins/cbac/Manifest +60 -0
- data/vendor/plugins/cbac/cbac-0.5.3.gem +0 -0
- data/vendor/plugins/cbac/cbac.gemspec +31 -0
- data/vendor/plugins/cbac/pkg/cbac-0.5.3.gem +0 -0
- metadata +13 -5
data/Manifest
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
Manifest
|
2
2
|
README.rdoc
|
3
3
|
Rakefile
|
4
|
-
cbac.gemspec
|
5
4
|
generators/cbac/USAGE
|
6
5
|
generators/cbac/cbac_generator.rb
|
7
6
|
generators/cbac/templates/config/cbac.pristine
|
@@ -39,6 +38,7 @@ lib/cbac/known_permission.rb
|
|
39
38
|
lib/cbac/membership.rb
|
40
39
|
lib/cbac/permission.rb
|
41
40
|
lib/cbac/privilege.rb
|
41
|
+
lib/cbac/privilege_new_api.rb
|
42
42
|
lib/cbac/privilege_set.rb
|
43
43
|
lib/cbac/privilege_set_record.rb
|
44
44
|
lib/cbac/setup.rb
|
@@ -53,8 +53,13 @@ test/fixtures/cbac_generic_roles.yml
|
|
53
53
|
test/fixtures/cbac_memberships.yml
|
54
54
|
test/fixtures/cbac_permissions.yml
|
55
55
|
test/fixtures/cbac_privilege_set.yml
|
56
|
+
test/test_cbac_actions.rb
|
56
57
|
test/test_cbac_authorize_context_roles.rb
|
57
58
|
test/test_cbac_authorize_generic_roles.rb
|
58
59
|
test/test_cbac_context_role.rb
|
59
60
|
test/test_cbac_privilege.rb
|
60
61
|
test/test_cbac_privilege_set.rb
|
62
|
+
vendor/plugins/cbac/Manifest
|
63
|
+
vendor/plugins/cbac/cbac-0.5.3.gem
|
64
|
+
vendor/plugins/cbac/cbac.gemspec
|
65
|
+
vendor/plugins/cbac/pkg/cbac-0.5.3.gem
|
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
24
24
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
25
|
end
|
26
26
|
|
27
|
-
Echoe.new('cbac', '0.5.
|
27
|
+
Echoe.new('cbac', '0.5.4') do |p|
|
28
28
|
p.summary = "CBAC - Simple authorization system for Rails applications."
|
29
29
|
p.description = "Simple authorization system for Rails applications. Allows you to develop applications with a mixed role based authorization and a context based authorization model. Does not supply authentication."
|
30
30
|
p.url = "http://cbac.rubyforge.org"
|
data/cbac.gemspec
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cbac}
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.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 = ["Bert Meerman"]
|
9
|
-
s.date = %q{2010-11-
|
9
|
+
s.date = %q{2010-11-30}
|
10
10
|
s.description = %q{Simple authorization system for Rails applications. Allows you to develop applications with a mixed role based authorization and a context based authorization model. Does not supply authentication.}
|
11
11
|
s.email = %q{bertm@rubyforge.org}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/cbac.rb", "lib/cbac/cbac_pristine/pristine.rb", "lib/cbac/cbac_pristine/pristine_file.rb", "lib/cbac/cbac_pristine/pristine_permission.rb", "lib/cbac/cbac_pristine/pristine_role.rb", "lib/cbac/config.rb", "lib/cbac/context_role.rb", "lib/cbac/generic_role.rb", "lib/cbac/known_permission.rb", "lib/cbac/membership.rb", "lib/cbac/permission.rb", "lib/cbac/privilege.rb", "lib/cbac/privilege_set.rb", "lib/cbac/privilege_set_record.rb", "lib/cbac/setup.rb", "tasks/cbac.rake"]
|
13
|
-
s.files = ["Manifest", "README.rdoc", "Rakefile", "
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/cbac.rb", "lib/cbac/cbac_pristine/pristine.rb", "lib/cbac/cbac_pristine/pristine_file.rb", "lib/cbac/cbac_pristine/pristine_permission.rb", "lib/cbac/cbac_pristine/pristine_role.rb", "lib/cbac/config.rb", "lib/cbac/context_role.rb", "lib/cbac/generic_role.rb", "lib/cbac/known_permission.rb", "lib/cbac/membership.rb", "lib/cbac/permission.rb", "lib/cbac/privilege.rb", "lib/cbac/privilege_new_api.rb", "lib/cbac/privilege_set.rb", "lib/cbac/privilege_set_record.rb", "lib/cbac/setup.rb", "tasks/cbac.rake"]
|
13
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "generators/cbac/USAGE", "generators/cbac/cbac_generator.rb", "generators/cbac/templates/config/cbac.pristine", "generators/cbac/templates/config/context_roles.rb", "generators/cbac/templates/config/privileges.rb", "generators/cbac/templates/controllers/generic_roles_controller.rb", "generators/cbac/templates/controllers/memberships_controller.rb", "generators/cbac/templates/controllers/permissions_controller.rb", "generators/cbac/templates/controllers/upgrade_controller.rb", "generators/cbac/templates/fixtures/cbac_generic_roles.yml", "generators/cbac/templates/fixtures/cbac_memberships.yml", "generators/cbac/templates/fixtures/cbac_permissions.yml", "generators/cbac/templates/migrate/create_cbac_from_scratch.rb", "generators/cbac/templates/migrate/create_cbac_upgrade_path.rb", "generators/cbac/templates/stylesheets/cbac.css", "generators/cbac/templates/tasks/cbac.rake", "generators/cbac/templates/views/generic_roles/index.html.erb", "generators/cbac/templates/views/layouts/cbac.html.erb", "generators/cbac/templates/views/memberships/_update.html.erb", "generators/cbac/templates/views/memberships/index.html.erb", "generators/cbac/templates/views/permissions/_update_context_role.html.erb", "generators/cbac/templates/views/permissions/_update_generic_role.html.erb", "generators/cbac/templates/views/permissions/index.html.erb", "generators/cbac/templates/views/upgrade/index.html.erb", "init.rb", "lib/cbac.rb", "lib/cbac/cbac_pristine/pristine.rb", "lib/cbac/cbac_pristine/pristine_file.rb", "lib/cbac/cbac_pristine/pristine_permission.rb", "lib/cbac/cbac_pristine/pristine_role.rb", "lib/cbac/config.rb", "lib/cbac/context_role.rb", "lib/cbac/generic_role.rb", "lib/cbac/known_permission.rb", "lib/cbac/membership.rb", "lib/cbac/permission.rb", "lib/cbac/privilege.rb", "lib/cbac/privilege_new_api.rb", "lib/cbac/privilege_set.rb", "lib/cbac/privilege_set_record.rb", "lib/cbac/setup.rb", "spec/cbac_pristine_file_spec.rb", "spec/cbac_pristine_permission_spec.rb", "spec/cbac_pristine_role_spec.rb", "spec/rcov.opts", "spec/spec.opts", "spec/spec_helper.rb", "tasks/cbac.rake", "test/fixtures/cbac_generic_roles.yml", "test/fixtures/cbac_memberships.yml", "test/fixtures/cbac_permissions.yml", "test/fixtures/cbac_privilege_set.yml", "test/test_cbac_actions.rb", "test/test_cbac_authorize_context_roles.rb", "test/test_cbac_authorize_generic_roles.rb", "test/test_cbac_context_role.rb", "test/test_cbac_privilege.rb", "test/test_cbac_privilege_set.rb", "vendor/plugins/cbac/Manifest", "vendor/plugins/cbac/cbac-0.5.3.gem", "vendor/plugins/cbac/cbac.gemspec", "vendor/plugins/cbac/pkg/cbac-0.5.3.gem", "cbac.gemspec"]
|
14
14
|
s.homepage = %q{http://cbac.rubyforge.org}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cbac", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{cbac}
|
18
18
|
s.rubygems_version = %q{1.3.7}
|
19
19
|
s.summary = %q{CBAC - Simple authorization system for Rails applications.}
|
20
|
-
s.test_files = ["test/test_cbac_context_role.rb", "test/test_cbac_authorize_context_roles.rb", "test/test_cbac_privilege.rb", "test/test_cbac_authorize_generic_roles.rb", "test/test_cbac_privilege_set.rb"]
|
20
|
+
s.test_files = ["test/test_cbac_context_role.rb", "test/test_cbac_authorize_context_roles.rb", "test/test_cbac_actions.rb", "test/test_cbac_privilege.rb", "test/test_cbac_authorize_generic_roles.rb", "test/test_cbac_privilege_set.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
@@ -1,9 +1,9 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the generic roles
|
4
|
-
|
5
|
-
one:
|
6
|
-
id: 1
|
7
|
-
name: administrator
|
8
|
-
remarks: Administrators role. Grants full access to the entire system.
|
9
|
-
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the generic roles
|
4
|
+
|
5
|
+
one:
|
6
|
+
id: 1
|
7
|
+
name: administrator
|
8
|
+
remarks: Administrators role. Grants full access to the entire system.
|
9
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the memberships
|
4
|
-
|
5
|
-
# Making the first user member of the administrator group
|
6
|
-
one:
|
7
|
-
user_id: 1
|
8
|
-
generic_role_id: 1
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the memberships
|
4
|
+
|
5
|
+
# Making the first user member of the administrator group
|
6
|
+
one:
|
7
|
+
user_id: 1
|
8
|
+
generic_role_id: 1
|
@@ -1,8 +1,8 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the permissions
|
4
|
-
<% PrivilegeSet.sets.each do |set| %>
|
5
|
-
fix_<%= set.id %>:
|
6
|
-
generic_role_id: 1
|
7
|
-
privilege_set_id: <%= set.id %>
|
8
|
-
<% end %>
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the permissions
|
4
|
+
<% PrivilegeSet.sets.each do |set| %>
|
5
|
+
fix_<%= set.id %>:
|
6
|
+
generic_role_id: 1
|
7
|
+
privilege_set_id: <%= set.id %>
|
8
|
+
<% end %>
|
data/lib/cbac.rb
CHANGED
@@ -40,8 +40,7 @@ module Cbac
|
|
40
40
|
puts "Checking for context_role:#{permission.context_role} on privilege_set:#{permission.privilege_set.name}" if Cbac::Config.verbose
|
41
41
|
eval_string = ContextRole.roles[permission.context_role.to_sym]
|
42
42
|
# Not sure if this will work everywhere
|
43
|
-
|
44
|
-
context[:session] = session
|
43
|
+
context["foo"] = "bar"
|
45
44
|
context["session"] = session
|
46
45
|
begin
|
47
46
|
return true if eval_string.call(context)
|
@@ -137,6 +137,7 @@ module Cbac
|
|
137
137
|
if context_role.nil?
|
138
138
|
# this is a never-before-seen context role
|
139
139
|
context_role = PristineRole.new(:role_id => 0, :role_type => PristineRole.ROLE_TYPES[:context], :name => context_role_name.captures[0]) if context_role.nil?
|
140
|
+
context_role.save if use_db
|
140
141
|
@context_roles.push context_role
|
141
142
|
end
|
142
143
|
return context_role
|
@@ -166,4 +167,4 @@ module Cbac
|
|
166
167
|
end
|
167
168
|
end
|
168
169
|
end
|
169
|
-
end
|
170
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# New API interface for CBAC system
|
2
|
+
#
|
3
|
+
# Changelog
|
4
|
+
# 101022 Bert Meerman Initial commit
|
5
|
+
#
|
6
|
+
|
7
|
+
module Cbac
|
8
|
+
# Starts a privileges and privilegeset declaration block
|
9
|
+
def privileges(&block)
|
10
|
+
# Defines a new privilegeset
|
11
|
+
def set(name, description, &block)
|
12
|
+
|
13
|
+
# Adds a post declaration
|
14
|
+
def post(controller, *methods)
|
15
|
+
raise "Cannot add privilege without a set" unless @current_set_name
|
16
|
+
methods.each {|method|
|
17
|
+
Privilege.resource @current_set_name, controller.to_s + "/" + method.to_s, :post
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Adds a get declaration
|
22
|
+
def get(controller, *method)
|
23
|
+
raise "Cannot add privilege without a set" unless @current_set_name
|
24
|
+
methods.each {|method|
|
25
|
+
Privilege.resource @current_set_name, controller.to_s + "/" + method.to_s, :get
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Includes the stuff from another set
|
30
|
+
def includes(*set)
|
31
|
+
raise "includes is not yet supported"
|
32
|
+
end
|
33
|
+
|
34
|
+
raise "Cannot embed a set in another set" if @current_set
|
35
|
+
name = name.to_sym
|
36
|
+
description = description.to_str
|
37
|
+
PrivilegeSet.add(name, description)
|
38
|
+
@current_set = PrivilegeSet.sets[name]
|
39
|
+
@current_set_name = name
|
40
|
+
yield block
|
41
|
+
@current_set = nil
|
42
|
+
@current_set_name = nil
|
43
|
+
end
|
44
|
+
|
45
|
+
# Start an additional namespace declaration
|
46
|
+
def in_module (name, &block)
|
47
|
+
current_namespace = @cbac_namespace
|
48
|
+
@cbac_namespace = @cbac_namespace.to_s + name.to_s + "/"
|
49
|
+
yield block
|
50
|
+
@cbac_namespace = current_namespace
|
51
|
+
end
|
52
|
+
|
53
|
+
# Runs the block
|
54
|
+
yield block
|
55
|
+
end
|
56
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the generic roles
|
4
|
-
|
5
|
-
one:
|
6
|
-
id: 1
|
7
|
-
name: administrator
|
8
|
-
remarks: Administrators role. Grants full access to the entire system.
|
9
|
-
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the generic roles
|
4
|
+
|
5
|
+
one:
|
6
|
+
id: 1
|
7
|
+
name: administrator
|
8
|
+
remarks: Administrators role. Grants full access to the entire system.
|
9
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the memberships
|
4
|
-
|
5
|
-
# Making the first user member of the administrator group
|
6
|
-
one:
|
7
|
-
user_id: 1
|
8
|
-
generic_role_id: 1
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the memberships
|
4
|
+
|
5
|
+
# Making the first user member of the administrator group
|
6
|
+
one:
|
7
|
+
user_id: 1
|
8
|
+
generic_role_id: 1
|
@@ -1,15 +1,15 @@
|
|
1
|
-
###
|
2
|
-
# Context
|
3
|
-
## YAML template for the permissions
|
4
|
-
#role_id: GenericRole.get_id :authorize_context_role
|
5
|
-
|
6
|
-
# used by test_cbac_authorize_context_roles
|
7
|
-
one:
|
8
|
-
context_role: authorize_context_role
|
9
|
-
privilege_set_id: 2
|
10
|
-
|
11
|
-
# used by test_cbac_authorize_generic_roles
|
12
|
-
two:
|
13
|
-
generic_role_id: 1
|
14
|
-
privilege_set_id: 3
|
1
|
+
###
|
2
|
+
# Context
|
3
|
+
## YAML template for the permissions
|
4
|
+
#role_id: GenericRole.get_id :authorize_context_role
|
5
|
+
|
6
|
+
# used by test_cbac_authorize_context_roles
|
7
|
+
one:
|
8
|
+
context_role: authorize_context_role
|
9
|
+
privilege_set_id: 2
|
10
|
+
|
11
|
+
# used by test_cbac_authorize_generic_roles
|
12
|
+
two:
|
13
|
+
generic_role_id: 1
|
14
|
+
privilege_set_id: 3
|
15
15
|
|
@@ -1,18 +1,18 @@
|
|
1
|
-
###
|
2
|
-
# YAML template for the PrivilegeSets
|
3
|
-
#
|
4
|
-
|
5
|
-
# Privilegeset
|
6
|
-
one:
|
7
|
-
id: 1
|
8
|
-
name: existing_privilege_set
|
9
|
-
|
10
|
-
# Used by the test_cbac_authorize_context_roles
|
11
|
-
two:
|
12
|
-
id: 2
|
13
|
-
name: cbac_context_role
|
14
|
-
|
15
|
-
# Used by the test_cbac_authorize_generic_roles
|
16
|
-
three:
|
17
|
-
id: 3
|
18
|
-
name: cbac_generic_role
|
1
|
+
###
|
2
|
+
# YAML template for the PrivilegeSets
|
3
|
+
#
|
4
|
+
|
5
|
+
# Privilegeset
|
6
|
+
one:
|
7
|
+
id: 1
|
8
|
+
name: existing_privilege_set
|
9
|
+
|
10
|
+
# Used by the test_cbac_authorize_context_roles
|
11
|
+
two:
|
12
|
+
id: 2
|
13
|
+
name: cbac_context_role
|
14
|
+
|
15
|
+
# Used by the test_cbac_authorize_generic_roles
|
16
|
+
three:
|
17
|
+
id: 3
|
18
|
+
name: cbac_generic_role
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright 2010 Bert Meerman
|
2
|
+
|
3
|
+
########
|
4
|
+
# Test the actions
|
5
|
+
# This test set will test whether actions and sets are created. Proper usage
|
6
|
+
# of these data structures is left to other test files
|
7
|
+
class CbacActionsTest < ActiveSupport::TestCase
|
8
|
+
# Adding actions using a simple get or post command
|
9
|
+
def test_add_simple_action
|
10
|
+
cbac do
|
11
|
+
set :cbac_actions_test do
|
12
|
+
post :foo, :bar
|
13
|
+
get :foo, :bar
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Adding multiple methods with a single call
|
19
|
+
def test_add_multiple_methods
|
20
|
+
cbac do
|
21
|
+
set :cbac_actions_test do
|
22
|
+
post :foo, [:bar, :bar2]
|
23
|
+
get :foo, [:bar, :bar2]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Add methods with single parameter
|
29
|
+
def test_add_method_with_single_parameter
|
30
|
+
cbac do
|
31
|
+
set :cbac_actions_test do
|
32
|
+
post :foo, :bar, :foobar
|
33
|
+
get :foo, :bar, :foobar
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Add methods with multiple parameters
|
39
|
+
def test_add_method_with_multiple_parameter
|
40
|
+
cbac do
|
41
|
+
set :cbac_actions_test do
|
42
|
+
post :foo, :bar, [:foobar, :foobar2]
|
43
|
+
get :foo, :bar, [:foobar, :foobar2]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_add_method_with_parameter_mapping
|
49
|
+
cbac do
|
50
|
+
set :cbac_actions_test do
|
51
|
+
post :foo, :bar, :foobar, {:map => :me}
|
52
|
+
get :foo, :bar, :foobar, {:map => :me}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Test must return multiple warnings, due to usage of _id in the identifier
|
58
|
+
# specifications (parameters are /always/ identifiers
|
59
|
+
def test_warning_on_adding_method_with_identifier
|
60
|
+
cbac do
|
61
|
+
set :cbac_actions_test do
|
62
|
+
post :foo, :bar, :foobar_id
|
63
|
+
get :foo, :bar, :foobar_id
|
64
|
+
post :foo, :bar, [:foobar, :foobar2_id]
|
65
|
+
get :foo, :bar, [:foobar, :foobar2_id]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# By default, all parameters will be blocked
|
71
|
+
end
|
@@ -18,26 +18,23 @@ class CbacAuthorizeContextRolesTest < ActiveSupport::TestCase
|
|
18
18
|
self.fixture_path = File.join(File.dirname(__FILE__), "fixtures")
|
19
19
|
fixtures :all
|
20
20
|
attr_accessor :authorize_context_eval_string
|
21
|
+
attr_accessor :session
|
21
22
|
|
22
23
|
# Setup defines the PrivilegeSet that is being used by all PrivilegeTest methods
|
23
24
|
def setup
|
24
25
|
return if PrivilegeSet.sets.include?(:cbac_context_role)
|
25
26
|
PrivilegeSet.add :cbac_context_role, ""
|
26
27
|
Privilege.resource :cbac_context_role, "authorize/context/roles", :get
|
27
|
-
ContextRole.add :authorize_context_role, "context
|
28
|
+
ContextRole.add :authorize_context_role, "context[:authorize_context_eval_string]"
|
28
29
|
end
|
29
30
|
|
30
31
|
# Check to see if action is correctly authorized
|
31
32
|
def test_authorize_ok
|
32
|
-
|
33
|
-
assert_equal true, authorization_check("authorize/context", "roles", :get, self)
|
33
|
+
assert_equal true, authorization_check("authorize/context", "roles", :get, {:authorize_context_eval_string => true})
|
34
34
|
end
|
35
35
|
|
36
36
|
# Run authorization with incorrect authorization
|
37
37
|
def test_authorize_incorrect_privilege
|
38
|
-
|
39
|
-
# ContextRole.roles[:authorize_context_role] = "false"
|
40
|
-
assert_equal false, authorization_check("authorize/context", "roles", :get, self)
|
41
|
-
# ContextRole.roles[:authorize_context_role] = "true"
|
38
|
+
assert_equal false, authorization_check("authorize/context", "roles", :get, {:authorize_context_eval_string => false})
|
42
39
|
end
|
43
40
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Manifest
|
2
|
+
README.rdoc
|
3
|
+
Rakefile
|
4
|
+
cbac.gemspec
|
5
|
+
generators/cbac/USAGE
|
6
|
+
generators/cbac/cbac_generator.rb
|
7
|
+
generators/cbac/templates/config/cbac.pristine
|
8
|
+
generators/cbac/templates/config/context_roles.rb
|
9
|
+
generators/cbac/templates/config/privileges.rb
|
10
|
+
generators/cbac/templates/controllers/generic_roles_controller.rb
|
11
|
+
generators/cbac/templates/controllers/memberships_controller.rb
|
12
|
+
generators/cbac/templates/controllers/permissions_controller.rb
|
13
|
+
generators/cbac/templates/controllers/upgrade_controller.rb
|
14
|
+
generators/cbac/templates/fixtures/cbac_generic_roles.yml
|
15
|
+
generators/cbac/templates/fixtures/cbac_memberships.yml
|
16
|
+
generators/cbac/templates/fixtures/cbac_permissions.yml
|
17
|
+
generators/cbac/templates/migrate/create_cbac_from_scratch.rb
|
18
|
+
generators/cbac/templates/migrate/create_cbac_upgrade_path.rb
|
19
|
+
generators/cbac/templates/stylesheets/cbac.css
|
20
|
+
generators/cbac/templates/tasks/cbac.rake
|
21
|
+
generators/cbac/templates/views/generic_roles/index.html.erb
|
22
|
+
generators/cbac/templates/views/layouts/cbac.html.erb
|
23
|
+
generators/cbac/templates/views/memberships/_update.html.erb
|
24
|
+
generators/cbac/templates/views/memberships/index.html.erb
|
25
|
+
generators/cbac/templates/views/permissions/_update_context_role.html.erb
|
26
|
+
generators/cbac/templates/views/permissions/_update_generic_role.html.erb
|
27
|
+
generators/cbac/templates/views/permissions/index.html.erb
|
28
|
+
generators/cbac/templates/views/upgrade/index.html.erb
|
29
|
+
init.rb
|
30
|
+
lib/cbac.rb
|
31
|
+
lib/cbac/cbac_pristine/pristine.rb
|
32
|
+
lib/cbac/cbac_pristine/pristine_file.rb
|
33
|
+
lib/cbac/cbac_pristine/pristine_permission.rb
|
34
|
+
lib/cbac/cbac_pristine/pristine_role.rb
|
35
|
+
lib/cbac/config.rb
|
36
|
+
lib/cbac/context_role.rb
|
37
|
+
lib/cbac/generic_role.rb
|
38
|
+
lib/cbac/known_permission.rb
|
39
|
+
lib/cbac/membership.rb
|
40
|
+
lib/cbac/permission.rb
|
41
|
+
lib/cbac/privilege.rb
|
42
|
+
lib/cbac/privilege_set.rb
|
43
|
+
lib/cbac/privilege_set_record.rb
|
44
|
+
lib/cbac/setup.rb
|
45
|
+
spec/cbac_pristine_file_spec.rb
|
46
|
+
spec/cbac_pristine_permission_spec.rb
|
47
|
+
spec/cbac_pristine_role_spec.rb
|
48
|
+
spec/rcov.opts
|
49
|
+
spec/spec.opts
|
50
|
+
spec/spec_helper.rb
|
51
|
+
tasks/cbac.rake
|
52
|
+
test/fixtures/cbac_generic_roles.yml
|
53
|
+
test/fixtures/cbac_memberships.yml
|
54
|
+
test/fixtures/cbac_permissions.yml
|
55
|
+
test/fixtures/cbac_privilege_set.yml
|
56
|
+
test/test_cbac_authorize_context_roles.rb
|
57
|
+
test/test_cbac_authorize_generic_roles.rb
|
58
|
+
test/test_cbac_context_role.rb
|
59
|
+
test/test_cbac_privilege.rb
|
60
|
+
test/test_cbac_privilege_set.rb
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{cbac}
|
5
|
+
s.version = "0.5.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Bert Meerman"]
|
9
|
+
s.date = %q{2010-11-18}
|
10
|
+
s.description = %q{Simple authorization system for Rails applications. Allows you to develop applications with a mixed role based authorization and a context based authorization model. Does not supply authentication.}
|
11
|
+
s.email = %q{bertm@rubyforge.org}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/cbac.rb", "lib/cbac/cbac_pristine/pristine.rb", "lib/cbac/cbac_pristine/pristine_file.rb", "lib/cbac/cbac_pristine/pristine_permission.rb", "lib/cbac/cbac_pristine/pristine_role.rb", "lib/cbac/config.rb", "lib/cbac/context_role.rb", "lib/cbac/generic_role.rb", "lib/cbac/known_permission.rb", "lib/cbac/membership.rb", "lib/cbac/permission.rb", "lib/cbac/privilege.rb", "lib/cbac/privilege_set.rb", "lib/cbac/privilege_set_record.rb", "lib/cbac/setup.rb", "tasks/cbac.rake"]
|
13
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "cbac.gemspec", "generators/cbac/USAGE", "generators/cbac/cbac_generator.rb", "generators/cbac/templates/config/cbac.pristine", "generators/cbac/templates/config/context_roles.rb", "generators/cbac/templates/config/privileges.rb", "generators/cbac/templates/controllers/generic_roles_controller.rb", "generators/cbac/templates/controllers/memberships_controller.rb", "generators/cbac/templates/controllers/permissions_controller.rb", "generators/cbac/templates/controllers/upgrade_controller.rb", "generators/cbac/templates/fixtures/cbac_generic_roles.yml", "generators/cbac/templates/fixtures/cbac_memberships.yml", "generators/cbac/templates/fixtures/cbac_permissions.yml", "generators/cbac/templates/migrate/create_cbac_from_scratch.rb", "generators/cbac/templates/migrate/create_cbac_upgrade_path.rb", "generators/cbac/templates/stylesheets/cbac.css", "generators/cbac/templates/tasks/cbac.rake", "generators/cbac/templates/views/generic_roles/index.html.erb", "generators/cbac/templates/views/layouts/cbac.html.erb", "generators/cbac/templates/views/memberships/_update.html.erb", "generators/cbac/templates/views/memberships/index.html.erb", "generators/cbac/templates/views/permissions/_update_context_role.html.erb", "generators/cbac/templates/views/permissions/_update_generic_role.html.erb", "generators/cbac/templates/views/permissions/index.html.erb", "generators/cbac/templates/views/upgrade/index.html.erb", "init.rb", "lib/cbac.rb", "lib/cbac/cbac_pristine/pristine.rb", "lib/cbac/cbac_pristine/pristine_file.rb", "lib/cbac/cbac_pristine/pristine_permission.rb", "lib/cbac/cbac_pristine/pristine_role.rb", "lib/cbac/config.rb", "lib/cbac/context_role.rb", "lib/cbac/generic_role.rb", "lib/cbac/known_permission.rb", "lib/cbac/membership.rb", "lib/cbac/permission.rb", "lib/cbac/privilege.rb", "lib/cbac/privilege_set.rb", "lib/cbac/privilege_set_record.rb", "lib/cbac/setup.rb", "spec/cbac_pristine_file_spec.rb", "spec/cbac_pristine_permission_spec.rb", "spec/cbac_pristine_role_spec.rb", "spec/rcov.opts", "spec/spec.opts", "spec/spec_helper.rb", "tasks/cbac.rake", "test/fixtures/cbac_generic_roles.yml", "test/fixtures/cbac_memberships.yml", "test/fixtures/cbac_permissions.yml", "test/fixtures/cbac_privilege_set.yml", "test/test_cbac_authorize_context_roles.rb", "test/test_cbac_authorize_generic_roles.rb", "test/test_cbac_context_role.rb", "test/test_cbac_privilege.rb", "test/test_cbac_privilege_set.rb"]
|
14
|
+
s.homepage = %q{http://cbac.rubyforge.org}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cbac", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{cbac}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{CBAC - Simple authorization system for Rails applications.}
|
20
|
+
s.test_files = ["test/test_cbac_context_role.rb", "test/test_cbac_authorize_context_roles.rb", "test/test_cbac_privilege.rb", "test/test_cbac_authorize_generic_roles.rb", "test/test_cbac_privilege_set.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 4
|
10
|
+
version: 0.5.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bert Meerman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-30 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -39,6 +39,7 @@ extra_rdoc_files:
|
|
39
39
|
- lib/cbac/membership.rb
|
40
40
|
- lib/cbac/permission.rb
|
41
41
|
- lib/cbac/privilege.rb
|
42
|
+
- lib/cbac/privilege_new_api.rb
|
42
43
|
- lib/cbac/privilege_set.rb
|
43
44
|
- lib/cbac/privilege_set_record.rb
|
44
45
|
- lib/cbac/setup.rb
|
@@ -47,7 +48,6 @@ files:
|
|
47
48
|
- Manifest
|
48
49
|
- README.rdoc
|
49
50
|
- Rakefile
|
50
|
-
- cbac.gemspec
|
51
51
|
- generators/cbac/USAGE
|
52
52
|
- generators/cbac/cbac_generator.rb
|
53
53
|
- generators/cbac/templates/config/cbac.pristine
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/cbac/membership.rb
|
86
86
|
- lib/cbac/permission.rb
|
87
87
|
- lib/cbac/privilege.rb
|
88
|
+
- lib/cbac/privilege_new_api.rb
|
88
89
|
- lib/cbac/privilege_set.rb
|
89
90
|
- lib/cbac/privilege_set_record.rb
|
90
91
|
- lib/cbac/setup.rb
|
@@ -99,11 +100,17 @@ files:
|
|
99
100
|
- test/fixtures/cbac_memberships.yml
|
100
101
|
- test/fixtures/cbac_permissions.yml
|
101
102
|
- test/fixtures/cbac_privilege_set.yml
|
103
|
+
- test/test_cbac_actions.rb
|
102
104
|
- test/test_cbac_authorize_context_roles.rb
|
103
105
|
- test/test_cbac_authorize_generic_roles.rb
|
104
106
|
- test/test_cbac_context_role.rb
|
105
107
|
- test/test_cbac_privilege.rb
|
106
108
|
- test/test_cbac_privilege_set.rb
|
109
|
+
- vendor/plugins/cbac/Manifest
|
110
|
+
- vendor/plugins/cbac/cbac-0.5.3.gem
|
111
|
+
- vendor/plugins/cbac/cbac.gemspec
|
112
|
+
- vendor/plugins/cbac/pkg/cbac-0.5.3.gem
|
113
|
+
- cbac.gemspec
|
107
114
|
has_rdoc: true
|
108
115
|
homepage: http://cbac.rubyforge.org
|
109
116
|
licenses: []
|
@@ -147,6 +154,7 @@ summary: CBAC - Simple authorization system for Rails applications.
|
|
147
154
|
test_files:
|
148
155
|
- test/test_cbac_context_role.rb
|
149
156
|
- test/test_cbac_authorize_context_roles.rb
|
157
|
+
- test/test_cbac_actions.rb
|
150
158
|
- test/test_cbac_privilege.rb
|
151
159
|
- test/test_cbac_authorize_generic_roles.rb
|
152
160
|
- test/test_cbac_privilege_set.rb
|