canard 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/TODO +0 -2
- data/lib/canard.rb +1 -0
- data/lib/canard/adapters/active_record.rb +56 -0
- data/lib/canard/find_abilities.rb +2 -2
- data/lib/canard/railtie.rb +1 -0
- data/lib/canard/user_model.rb +17 -53
- data/lib/canard/version.rb +1 -1
- data/test/{abilities_test.rb → canard/abilities_test.rb} +0 -0
- data/test/{ability_test.rb → canard/ability_test.rb} +1 -0
- data/test/{user_model_test.rb → canard/adapters/active_record_test.rb} +36 -78
- data/test/{canard_test.rb → canard/canard_test.rb} +0 -0
- data/test/{find_abilities_test.rb → canard/find_abilities_test.rb} +1 -0
- data/test/canard/user_model_test.rb +91 -0
- data/test/dummy/app/models/plain_ruby_non_user.rb +0 -2
- data/test/dummy/app/models/plain_ruby_user.rb +0 -2
- data/test/dummy/app/models/user_without_role_mask.rb +1 -2
- data/test/dummy/db/migrate/20120430083231_initialize_db.rb +1 -0
- metadata +27 -24
data/.gitignore
CHANGED
data/TODO
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
0.4.0
|
2
|
-
* Make the roles_attribute_name configureable in UserModel.
|
3
2
|
* Make the Ability user referece configureable in Ability.
|
4
3
|
* Test the generators.
|
5
4
|
* Test the railtie (currently implicity tested in dummy app).
|
@@ -7,7 +6,6 @@
|
|
7
6
|
* Remove old definition syntax and therefore deprecations.
|
8
7
|
* Remove ActiveSupport runtime dependency (which is just used for deprecation warnings).
|
9
8
|
0.5.0
|
10
|
-
* Abstract out the ActiveRecord extensions into a model adapter to become framework independent.
|
11
9
|
* Expand the generated tests to produce all the standard abilities: index,show,read,new,create,edit,update,destroy.
|
12
10
|
* Add test unit generator.
|
13
11
|
* Add install generator to allow overriding of the default tests.
|
data/lib/canard.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Canard
|
2
|
+
module Adapters
|
3
|
+
module ActiveRecord
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def add_role_scopes
|
8
|
+
if active_record_table?
|
9
|
+
valid_roles.each do |role|
|
10
|
+
define_scopes_for_role role
|
11
|
+
end
|
12
|
+
|
13
|
+
define_scope_method(:with_any_role) do |*roles|
|
14
|
+
where("#{role_mask_column} & :role_mask > 0", { :role_mask => mask_for(*roles) })
|
15
|
+
end
|
16
|
+
|
17
|
+
define_scope_method(:with_all_roles) do |*roles|
|
18
|
+
where("#{role_mask_column} & :role_mask = :role_mask", { :role_mask => mask_for(*roles) })
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def active_record_table?
|
24
|
+
respond_to?(:table_exists?) && table_exists?
|
25
|
+
end
|
26
|
+
|
27
|
+
def has_roles_mask_accessors?
|
28
|
+
active_record_table? && column_names.include?(roles_attribute_name.to_s) || super
|
29
|
+
end
|
30
|
+
|
31
|
+
def define_scopes_for_role(role)
|
32
|
+
include_scope = role.to_s.pluralize
|
33
|
+
exclude_scope = "non_#{include_scope}"
|
34
|
+
|
35
|
+
define_scope_method(include_scope) do
|
36
|
+
where("#{role_mask_column} & :role_mask > 0", { :role_mask => mask_for(role) })
|
37
|
+
end
|
38
|
+
|
39
|
+
define_scope_method(exclude_scope) do
|
40
|
+
where("#{role_mask_column} & :role_mask = 0 or #{role_mask_column} is null", { :role_mask => mask_for(role) })
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def define_scope_method(method, &block)
|
45
|
+
(class << self; self end).class_eval do
|
46
|
+
define_method(method, block)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def role_mask_column
|
51
|
+
"#{quoted_table_name}.#{connection.quote_column_name roles_attribute_name}"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -7,7 +7,7 @@ module Canard
|
|
7
7
|
attr_writer :abilities_path
|
8
8
|
|
9
9
|
def abilities_path
|
10
|
-
@abilities_path ||=
|
10
|
+
@abilities_path ||= 'abilities'
|
11
11
|
end
|
12
12
|
|
13
13
|
def ability_definitions
|
@@ -22,7 +22,7 @@ module Canard
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.load_paths
|
25
|
-
Abilities.definition_paths.map { |path| File.
|
25
|
+
Abilities.definition_paths.map { |path| File.expand_path(path) }
|
26
26
|
end
|
27
27
|
|
28
28
|
# TODO remove at version 0.4.0
|
data/lib/canard/railtie.rb
CHANGED
data/lib/canard/user_model.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Canard
|
2
|
-
|
3
2
|
module UserModel
|
4
3
|
|
5
4
|
# Canard applies roles to a model using the acts_as_user class method. The following User model
|
@@ -7,7 +6,7 @@ module Canard
|
|
7
6
|
#
|
8
7
|
# class User < ActiveRecord::Base
|
9
8
|
#
|
10
|
-
# acts_as_user :roles =>
|
9
|
+
# acts_as_user :roles => [:manager, :admin]
|
11
10
|
#
|
12
11
|
# end
|
13
12
|
#
|
@@ -20,14 +19,19 @@ module Canard
|
|
20
19
|
#
|
21
20
|
# attr_accessor :roles_mask
|
22
21
|
#
|
23
|
-
# acts_as_user :roles =>
|
22
|
+
# acts_as_user :roles => [:manager, :admin]
|
24
23
|
#
|
25
24
|
# end
|
26
25
|
#
|
26
|
+
# You can choose the attribute used for the roles_mask by specifying :roles_mask. If no
|
27
|
+
# roles_mask is specified it uses RoleModel's default of 'roles_mask'
|
28
|
+
#
|
29
|
+
# acts_as_user :roles_mask => :my_roles_mask, :roles => [:manager, :admin]
|
30
|
+
#
|
27
31
|
# == Scopes
|
28
32
|
#
|
29
|
-
# Beyond applying the roles to model acts_as_user also creates some useful scopes
|
30
|
-
#
|
33
|
+
# Beyond applying the roles to the model, acts_as_user also creates some useful scopes for
|
34
|
+
# ActiveRecord models;
|
31
35
|
#
|
32
36
|
# User.with_any_role(:manager, :admin)
|
33
37
|
#
|
@@ -54,66 +58,26 @@ module Canard
|
|
54
58
|
# returns all the users who don't have the manager role.
|
55
59
|
def acts_as_user(*args)
|
56
60
|
include RoleModel
|
61
|
+
extend Adapters::ActiveRecord if defined?(ActiveRecord) && self < ActiveRecord::Base
|
57
62
|
|
58
|
-
options = args.
|
63
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
59
64
|
|
60
|
-
|
65
|
+
roles_attribute options[:roles_mask] if options.has_key?(:roles_mask)
|
66
|
+
|
67
|
+
roles options[:roles] if options.has_key?(:roles) && has_roles_mask_accessors?
|
61
68
|
|
62
|
-
if
|
63
|
-
valid_roles.each do |role|
|
64
|
-
define_scopes_for_role role
|
65
|
-
end
|
66
|
-
|
67
|
-
define_scope_method(:with_any_role) do |*roles|
|
68
|
-
where("#{role_mask_column} & :role_mask > 0", { :role_mask => mask_for(*roles) })
|
69
|
-
end
|
70
|
-
|
71
|
-
define_scope_method(:with_all_roles) do |*roles|
|
72
|
-
where("#{role_mask_column} & :role_mask = :role_mask", { :role_mask => mask_for(*roles) })
|
73
|
-
end
|
74
|
-
end
|
69
|
+
add_role_scopes if respond_to?(:add_role_scopes, true)
|
75
70
|
end
|
76
71
|
|
77
72
|
private
|
78
73
|
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
74
|
+
# This is overridden by the ActiveRecord adapter as the attribute accessors
|
75
|
+
# don't show up in instance_methods.
|
83
76
|
def has_roles_mask_accessors?
|
84
77
|
instance_method_names = instance_methods.map { |method_name| method_name.to_s }
|
85
78
|
[roles_attribute_name.to_s, "#{roles_attribute_name}="].all? do |accessor|
|
86
79
|
instance_method_names.include?(accessor)
|
87
80
|
end
|
88
81
|
end
|
89
|
-
|
90
|
-
def has_roles_mask_attribute?
|
91
|
-
active_record_table? && column_names.include?(roles_attribute_name.to_s)
|
92
|
-
end
|
93
|
-
|
94
|
-
def define_scopes_for_role(role)
|
95
|
-
include_scope = role.to_s.pluralize
|
96
|
-
exclude_scope = "non_#{include_scope}"
|
97
|
-
|
98
|
-
define_scope_method(include_scope) do
|
99
|
-
where("#{role_mask_column} & :role_mask > 0", { :role_mask => mask_for(role) })
|
100
|
-
end
|
101
|
-
|
102
|
-
define_scope_method(exclude_scope) do
|
103
|
-
where("#{role_mask_column} & :role_mask = 0 or #{role_mask_column} is null", { :role_mask => mask_for(role) })
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def define_scope_method(method, &block)
|
108
|
-
(class << self; self end).class_eval do
|
109
|
-
define_method(method, block)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def role_mask_column
|
114
|
-
%{"#{table_name}"."#{roles_attribute_name}"}
|
115
|
-
end
|
116
|
-
|
117
82
|
end
|
118
|
-
|
119
83
|
end
|
data/lib/canard/version.rb
CHANGED
File without changes
|
@@ -1,92 +1,68 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'canard'
|
3
2
|
|
4
|
-
describe Canard::
|
5
|
-
|
6
|
-
before do
|
7
|
-
Canard.abilities_path = 'abilities'
|
8
|
-
end
|
9
|
-
|
10
|
-
# Sanity test
|
11
|
-
it "must be an user" do
|
12
|
-
user = User.new
|
13
|
-
user.must_be_instance_of User
|
14
|
-
user = UserWithoutRole.new
|
15
|
-
user.must_be_instance_of UserWithoutRole
|
16
|
-
user = UserWithoutRoleMask.new
|
17
|
-
user.must_be_instance_of UserWithoutRoleMask
|
18
|
-
end
|
3
|
+
describe Canard::Adapters::ActiveRecord do
|
19
4
|
|
20
5
|
describe 'acts_as_user' do
|
21
6
|
|
22
|
-
|
23
|
-
User.included_modules.must_include RoleModel
|
24
|
-
User.must_respond_to :roles
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "on an ActiveRecord model" do
|
7
|
+
describe 'with a role_mask' do
|
28
8
|
|
29
|
-
describe '
|
9
|
+
describe 'and :roles => [] specified' do
|
10
|
+
|
11
|
+
it 'sets the valid_roles for the class' do
|
12
|
+
User.valid_roles.must_equal [:viewer, :author, :admin]
|
13
|
+
end
|
30
14
|
|
31
|
-
|
15
|
+
end
|
32
16
|
|
33
|
-
|
34
|
-
User.valid_roles.must_equal [:viewer, :author, :admin]
|
35
|
-
end
|
17
|
+
describe 'and no :roles => [] specified' do
|
36
18
|
|
19
|
+
it 'sets no roles' do
|
20
|
+
UserWithoutRole.valid_roles.must_equal []
|
37
21
|
end
|
22
|
+
end
|
38
23
|
|
39
|
-
|
24
|
+
end
|
40
25
|
|
41
|
-
|
42
|
-
UserWithoutRole.valid_roles.must_equal []
|
43
|
-
end
|
44
|
-
end
|
26
|
+
describe 'with no roles_mask' do
|
45
27
|
|
28
|
+
before do
|
29
|
+
UserWithoutRoleMask.acts_as_user :roles => [:viewer, :admin]
|
46
30
|
end
|
47
31
|
|
48
|
-
|
49
|
-
|
50
|
-
it 'sets no roles' do
|
51
|
-
UserWithoutRole.valid_roles.must_equal []
|
52
|
-
end
|
32
|
+
it 'sets no roles' do
|
33
|
+
UserWithoutRoleMask.valid_roles.must_equal []
|
53
34
|
end
|
35
|
+
end
|
54
36
|
|
55
|
-
|
37
|
+
describe "with no table" do
|
56
38
|
|
57
|
-
|
39
|
+
subject { Class.new(ActiveRecord::Base) }
|
58
40
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
41
|
+
it "sets no roles" do
|
42
|
+
subject.class_eval { acts_as_user :roles => [:admin] }
|
43
|
+
subject.valid_roles.must_equal []
|
44
|
+
end
|
63
45
|
|
64
|
-
|
65
|
-
|
66
|
-
|
46
|
+
it "does not raise any errors" do
|
47
|
+
proc { subject.class_eval { acts_as_user :roles => [:admin] } }.must_be_silent
|
48
|
+
end
|
67
49
|
|
68
|
-
|
69
|
-
|
70
|
-
end
|
50
|
+
it "returns nil" do
|
51
|
+
subject.class_eval { acts_as_user :roles => [:admin] }.must_be_nil
|
71
52
|
end
|
72
53
|
end
|
73
54
|
|
74
|
-
describe
|
75
|
-
|
76
|
-
describe "with a roles_mask" do
|
55
|
+
describe 'with an alternative roles_mask specified' do
|
77
56
|
|
78
|
-
|
79
|
-
|
80
|
-
end
|
57
|
+
before do
|
58
|
+
UserWithoutRoleMask.acts_as_user :roles_mask => :my_roles_mask, :roles => [:viewer, :admin]
|
81
59
|
end
|
82
60
|
|
83
|
-
|
84
|
-
|
85
|
-
it "sets no roles" do
|
86
|
-
PlainRubyNonUser.valid_roles.must_equal []
|
87
|
-
end
|
61
|
+
it 'sets no roles' do
|
62
|
+
UserWithoutRoleMask.valid_roles.must_equal [:viewer, :admin]
|
88
63
|
end
|
89
64
|
end
|
65
|
+
|
90
66
|
end
|
91
67
|
|
92
68
|
describe "scopes" do
|
@@ -461,24 +437,6 @@ describe Canard::UserModel do
|
|
461
437
|
end
|
462
438
|
|
463
439
|
end
|
464
|
-
|
465
|
-
describe "on a plain Ruby class" do
|
466
|
-
|
467
|
-
subject { PlainRubyUser }
|
468
|
-
|
469
|
-
it "creates no scope methods" do
|
470
|
-
subject.wont_respond_to :admins
|
471
|
-
subject.wont_respond_to :authors
|
472
|
-
subject.wont_respond_to :viewers
|
473
|
-
subject.wont_respond_to :non_admins
|
474
|
-
subject.wont_respond_to :non_authors
|
475
|
-
subject.wont_respond_to :non_viewers
|
476
|
-
subject.wont_respond_to :with_any_role
|
477
|
-
subject.wont_respond_to :with_all_roles
|
478
|
-
end
|
479
|
-
|
480
|
-
end
|
481
|
-
|
482
440
|
end
|
483
441
|
|
484
442
|
end
|
File without changes
|
@@ -9,6 +9,7 @@ describe Canard do
|
|
9
9
|
# Stop the deprecation warnings coming to stderr for these tests.
|
10
10
|
ActiveSupport::Deprecation.behavior = :notify
|
11
11
|
|
12
|
+
Canard::Abilities.default_path = File.expand_path('../../dummy/app/abilities', __FILE__)
|
12
13
|
Canard.abilities_path = File.expand_path('../abilities', __FILE__)
|
13
14
|
end
|
14
15
|
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Canard::UserModel do
|
4
|
+
|
5
|
+
describe 'acts_as_user' do
|
6
|
+
|
7
|
+
describe "integrating RoleModel" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
PlainRubyUser.acts_as_user
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'adds role_model to the class' do
|
14
|
+
PlainRubyUser.included_modules.must_include RoleModel
|
15
|
+
PlainRubyUser.must_respond_to :roles
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "with a roles_mask" do
|
20
|
+
|
21
|
+
describe 'and :roles => [] specified' do
|
22
|
+
|
23
|
+
before do
|
24
|
+
PlainRubyUser.acts_as_user :roles => [:viewer, :author, :admin]
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'sets the valid_roles for the class' do
|
28
|
+
PlainRubyUser.valid_roles.must_equal [:viewer, :author, :admin]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'and no :roles => [] specified' do
|
33
|
+
|
34
|
+
before do
|
35
|
+
PlainRubyUser.acts_as_user
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sets no roles' do
|
39
|
+
PlainRubyUser.valid_roles.must_equal []
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "with no roles_mask" do
|
45
|
+
|
46
|
+
before do
|
47
|
+
PlainRubyNonUser.acts_as_user :roles => [:viewer, :author, :admin]
|
48
|
+
end
|
49
|
+
|
50
|
+
it "sets no roles" do
|
51
|
+
PlainRubyNonUser.valid_roles.must_equal []
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "setting the role_mask" do
|
56
|
+
|
57
|
+
before do
|
58
|
+
PlainRubyNonUser.send :attr_accessor, :my_roles
|
59
|
+
PlainRubyNonUser.acts_as_user :roles => [:viewer, :author], :roles_mask => :my_roles
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'sets the valid_roles for the class' do
|
63
|
+
PlainRubyNonUser.valid_roles.must_equal [:viewer, :author]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "scopes" do
|
69
|
+
|
70
|
+
before do
|
71
|
+
PlainRubyUser.acts_as_user :roles => [:viewer, :author, :admin]
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "on a plain Ruby class" do
|
75
|
+
|
76
|
+
subject { PlainRubyUser }
|
77
|
+
|
78
|
+
it "creates no scope methods" do
|
79
|
+
subject.wont_respond_to :admins
|
80
|
+
subject.wont_respond_to :authors
|
81
|
+
subject.wont_respond_to :viewers
|
82
|
+
subject.wont_respond_to :non_admins
|
83
|
+
subject.wont_respond_to :non_authors
|
84
|
+
subject.wont_respond_to :non_viewers
|
85
|
+
subject.wont_respond_to :with_any_role
|
86
|
+
subject.wont_respond_to :with_all_roles
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152663460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152663460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152663000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152663000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152662380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 3.2.3
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152662380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &2152661900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152661900
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cancan
|
60
|
-
requirement: &
|
60
|
+
requirement: &2152661320 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152661320
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: role_model
|
71
|
-
requirement: &
|
71
|
+
requirement: &2152660780 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2152660780
|
80
80
|
description: Wraps CanCan and RoleModel up to make role based authorisation really
|
81
81
|
easy in Rails 3.x.
|
82
82
|
email:
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/ability.rb
|
96
96
|
- lib/canard.rb
|
97
97
|
- lib/canard/abilities.rb
|
98
|
+
- lib/canard/adapters/active_record.rb
|
98
99
|
- lib/canard/find_abilities.rb
|
99
100
|
- lib/canard/railtie.rb
|
100
101
|
- lib/canard/user_model.rb
|
@@ -106,9 +107,12 @@ files:
|
|
106
107
|
- lib/generators/rspec/ability/ability_generator.rb
|
107
108
|
- lib/generators/rspec/ability/templates/abilities_spec.rb.erb
|
108
109
|
- test/abilities/admins.rb
|
109
|
-
- test/abilities_test.rb
|
110
|
-
- test/ability_test.rb
|
111
|
-
- test/
|
110
|
+
- test/canard/abilities_test.rb
|
111
|
+
- test/canard/ability_test.rb
|
112
|
+
- test/canard/adapters/active_record_test.rb
|
113
|
+
- test/canard/canard_test.rb
|
114
|
+
- test/canard/find_abilities_test.rb
|
115
|
+
- test/canard/user_model_test.rb
|
112
116
|
- test/dummy/Rakefile
|
113
117
|
- test/dummy/app/abilities/admins.rb
|
114
118
|
- test/dummy/app/abilities/authors.rb
|
@@ -139,10 +143,8 @@ files:
|
|
139
143
|
- test/dummy/db/schema.rb
|
140
144
|
- test/dummy/log/.gitkeep
|
141
145
|
- test/dummy/script/rails
|
142
|
-
- test/find_abilities_test.rb
|
143
146
|
- test/support/reloadable.rb
|
144
147
|
- test/test_helper.rb
|
145
|
-
- test/user_model_test.rb
|
146
148
|
homepage: https://github.com/james2m/canard
|
147
149
|
licenses: []
|
148
150
|
post_install_message:
|
@@ -169,9 +171,12 @@ specification_version: 3
|
|
169
171
|
summary: Adds role based authorisation to Rails by combining RoleModel and CanCan.
|
170
172
|
test_files:
|
171
173
|
- test/abilities/admins.rb
|
172
|
-
- test/abilities_test.rb
|
173
|
-
- test/ability_test.rb
|
174
|
-
- test/
|
174
|
+
- test/canard/abilities_test.rb
|
175
|
+
- test/canard/ability_test.rb
|
176
|
+
- test/canard/adapters/active_record_test.rb
|
177
|
+
- test/canard/canard_test.rb
|
178
|
+
- test/canard/find_abilities_test.rb
|
179
|
+
- test/canard/user_model_test.rb
|
175
180
|
- test/dummy/Rakefile
|
176
181
|
- test/dummy/app/abilities/admins.rb
|
177
182
|
- test/dummy/app/abilities/authors.rb
|
@@ -202,7 +207,5 @@ test_files:
|
|
202
207
|
- test/dummy/db/schema.rb
|
203
208
|
- test/dummy/log/.gitkeep
|
204
209
|
- test/dummy/script/rails
|
205
|
-
- test/find_abilities_test.rb
|
206
210
|
- test/support/reloadable.rb
|
207
211
|
- test/test_helper.rb
|
208
|
-
- test/user_model_test.rb
|