cantango 0.8.9.5 → 0.9.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/README.textile +35 -7
  2. data/VERSION +1 -1
  3. data/cantango.gemspec +39 -12
  4. data/lib/cantango.rb +4 -3
  5. data/lib/cantango/ability.rb +17 -21
  6. data/lib/cantango/ability/cache/key.rb +32 -4
  7. data/lib/cantango/ability/cache/rules_cache.rb +9 -2
  8. data/lib/cantango/ability/cache_helpers.rb +1 -7
  9. data/lib/cantango/ability/engine_helpers.rb +27 -0
  10. data/lib/cantango/ability_executor.rb +41 -0
  11. data/lib/cantango/api/user/ability.rb +8 -12
  12. data/lib/cantango/api/user/session.rb +2 -1
  13. data/lib/cantango/api/user_account.rb +2 -2
  14. data/lib/cantango/api/user_account/ability.rb +19 -14
  15. data/lib/cantango/api/user_account/can.rb +8 -0
  16. data/lib/cantango/api/user_account/session.rb +33 -0
  17. data/lib/cantango/cached_ability.rb +26 -0
  18. data/lib/cantango/configuration.rb +3 -3
  19. data/lib/cantango/configuration/ability.rb +1 -0
  20. data/lib/cantango/configuration/candidate_registry.rb +51 -0
  21. data/lib/cantango/configuration/categories.rb +2 -2
  22. data/lib/cantango/configuration/engines.rb +7 -3
  23. data/lib/cantango/configuration/engines/permission.rb +5 -0
  24. data/lib/cantango/configuration/engines/permit.rb +1 -0
  25. data/lib/cantango/configuration/engines/user_ac.rb +19 -0
  26. data/lib/cantango/configuration/guest.rb +1 -1
  27. data/lib/cantango/configuration/modes.rb +21 -0
  28. data/lib/cantango/configuration/permits.rb +1 -1
  29. data/lib/cantango/configuration/role_groups.rb +1 -2
  30. data/lib/cantango/configuration/user_accounts.rb +1 -1
  31. data/lib/cantango/configuration/users.rb +1 -1
  32. data/lib/cantango/engine.rb +40 -0
  33. data/lib/cantango/helpers.rb +1 -1
  34. data/lib/cantango/helpers/debug.rb +9 -0
  35. data/lib/cantango/model.rb +6 -0
  36. data/lib/cantango/model/filter.rb +102 -0
  37. data/lib/cantango/model/scope.rb +57 -0
  38. data/lib/cantango/permission_engine.rb +14 -3
  39. data/lib/cantango/permission_engine/loader/base.rb +1 -6
  40. data/lib/cantango/permission_engine/loader/permissions.rb +10 -16
  41. data/lib/cantango/permission_engine/store.rb +1 -7
  42. data/lib/cantango/permission_engine/yaml_store.rb +3 -10
  43. data/lib/cantango/permit_engine.rb +17 -4
  44. data/lib/cantango/permit_engine/builder/base.rb +3 -1
  45. data/lib/cantango/permit_engine/executor/abstract.rb +2 -0
  46. data/lib/cantango/permit_engine/executor/base.rb +1 -1
  47. data/lib/cantango/permit_engine/factory.rb +5 -3
  48. data/lib/cantango/permit_engine/finder.rb +4 -6
  49. data/lib/cantango/permit_engine/util.rb +1 -1
  50. data/lib/cantango/permits/permit.rb +25 -0
  51. data/lib/cantango/permits/role_group_permit/builder.rb +23 -7
  52. data/lib/cantango/permits/role_permit.rb +1 -2
  53. data/lib/cantango/rails/helpers/rest_helper.rb +3 -2
  54. data/lib/cantango/user_ac_engine.rb +40 -0
  55. data/lib/cantango/user_ac_engine/executor.rb +59 -0
  56. data/lib/cantango/users/macros.rb +3 -0
  57. data/lib/cantango/users/user.rb +1 -1
  58. data/lib/cantango/users/user_account.rb +1 -1
  59. data/lib/generators/cantango/permission/permission_generator.rb +43 -0
  60. data/spec/active_record/migrations/008_create_permissions.rb +10 -0
  61. data/spec/cantango/ability_executor/cached_only_spec.rb +76 -0
  62. data/spec/cantango/ability_executor_spec.rb +75 -0
  63. data/spec/cantango/api/attributes_spec.rb +2 -1
  64. data/spec/cantango/api/current_user_accounts.rb +5 -1
  65. data/spec/cantango/api/user/ability_api_spec.rb +17 -4
  66. data/spec/cantango/api/user/can_api_spec.rb +9 -5
  67. data/spec/cantango/api/user/scope_api_spec.rb +15 -7
  68. data/spec/cantango/api/user_account/ability_api_spec.rb +12 -5
  69. data/spec/cantango/api/user_account/can_api_spec.rb +8 -4
  70. data/spec/cantango/cached_ability_spec.rb +0 -0
  71. data/spec/cantango/model/filter_spec.rb +168 -0
  72. data/spec/cantango/model/scope_spec.rb +107 -0
  73. data/spec/cantango/permission_engine/loader/permissions/{cantango_permissions_loader.rb → cantango_permissions_loader_spec.rb} +0 -0
  74. data/spec/cantango/permission_engine/loader/permissions/shared.rb +2 -2
  75. data/spec/cantango/permission_engine/yaml_store_spec.rb +0 -1
  76. data/spec/cantango/permit_engine/role_group_permit_spec.rb +2 -2
  77. data/spec/cantango/permits/permit_spec.rb +2 -2
  78. data/spec/cantango/rules_spec.rb +6 -6
  79. data/spec/cantango/user_ac_engine_spec.rb +53 -0
  80. data/spec/fixtures/config/cantango_permissions.yml +49 -0
  81. data/spec/fixtures/models/permission.rb +12 -0
  82. data/spec/fixtures/models/user.rb +8 -0
  83. data/spec/generators/cantango/permission_generator_spec.rb +44 -0
  84. metadata +59 -35
@@ -0,0 +1,107 @@
1
+ require 'rspec'
2
+ require 'cantango'
3
+ # require 'active_record/spec_helper'
4
+
5
+ require 'simple_roles'
6
+ require 'fixtures/models'
7
+ require 'cantango/api/current_users'
8
+ require 'cantango/api/current_user_accounts'
9
+
10
+ class User
11
+ include_and_extend SimpleRoles
12
+ tango_user
13
+ end
14
+
15
+ class Admin < User
16
+ tango_user
17
+ end
18
+
19
+ class UserAccount
20
+ tango_account # register
21
+ include_and_extend SimpleRoles
22
+ end
23
+
24
+
25
+ class AdminAccount
26
+ tango_account
27
+ include_and_extend SimpleRoles
28
+ end
29
+
30
+
31
+ CanTango.configure do |config|
32
+ config.cache_engine.set :off
33
+ config.permit_engine.set :on
34
+ end
35
+
36
+ class Context
37
+ include CanTango::Api::User::Ability
38
+
39
+ include_and_extend ::CurrentUsers
40
+ include_and_extend ::CurrentUserAccounts
41
+ end
42
+
43
+ class UserRolePermit < CanTango::RolePermit
44
+ def initialize ability
45
+ super
46
+ end
47
+
48
+ def permit_rules
49
+ can :edit, Project
50
+ can :create, Project
51
+ end
52
+ end
53
+
54
+ class AdminRolePermit < CanTango::RolePermit
55
+ def initialize ability
56
+ super
57
+ end
58
+
59
+ def permit_rules
60
+ can :create, Project
61
+ can :show, Project
62
+ end
63
+ end
64
+
65
+ class Project
66
+ include CanTango::Model::Scope
67
+
68
+ attr_accessor :name
69
+
70
+ def initialize name = 'proj'
71
+ @name = name
72
+ end
73
+
74
+ def self.all
75
+ [Project.new('a'), Project.new('b')]
76
+ end
77
+ end
78
+
79
+ describe CanTango::Model::Scope do
80
+ let(:context) { Context.new }
81
+
82
+ subject { Project }
83
+
84
+ describe 'Model scope API' do
85
+ (CanTango::Model::Scope.rest_actions - [:edit, :create]).each do |action|
86
+ meth_name = action.to_s.sub(/e$/, '') << "able"
87
+ specify { subject.send(:"#{meth_name}_by", context.current_user).should be_empty }
88
+ end
89
+
90
+ [:edit, :create].each do |action|
91
+ meth_name = action.to_s.sub(/e$/, '') << "able"
92
+ specify { subject.send(:"#{meth_name}_by", context.current_user).should_not be_empty }
93
+ end
94
+
95
+ describe '#allowed_to' do
96
+ specify { subject.allowed_to(:create).by_user(context.current_user).should_not be_empty }
97
+
98
+ specify { subject.allowed_to(:create, :edit).by_user(context.current_user).should_not be_empty }
99
+
100
+ specify { subject.allowed_to(:delete).by_user(context.current_user).should be_empty }
101
+
102
+ specify { subject.allowed_to(:delete, :manage).by_user(context.current_user).should be_empty }
103
+ end
104
+ end
105
+ end
106
+
107
+
@@ -1,6 +1,6 @@
1
1
  def config_folder
2
- File.dirname(__FILE__)+ "/../../../fixtures/config/"
3
- end
2
+ File.join(File.dirname(__FILE__), "/../../../../fixtures/config/")
3
+ end
4
4
 
5
5
  shared_examples_for "Permissions Loader" do
6
6
  it "should load a permission file" do
@@ -28,7 +28,6 @@ describe CanTango::PermissionEngine::YamlStore do
28
28
 
29
29
  context 'Caching permissions by types' do
30
30
  let (:store) do
31
- # filename: 'cantango_permissions.yml',
32
31
  @store ||= CanTango::PermissionEngine::YamlStore.new 'permissions', :path => config_folder
33
32
  end
34
33
 
@@ -26,8 +26,8 @@ describe CanTango::Permits::RoleGroupPermit do
26
26
  let (:ability) do
27
27
  CanTango::Ability.new user_account
28
28
  end
29
-
30
- let (:permit) do
29
+
30
+ let (:permit) do
31
31
  AdminsRoleGroupPermit.new ability
32
32
  end
33
33
 
@@ -16,11 +16,11 @@ describe CanTango::Permits::Permit do
16
16
  CanTango.config.permits.admin_account.role[:admin].should == AdminAccountPermits::AdminRolePermit
17
17
  CanTango.config.permits.role[:musician].should == MusicianRolePermit
18
18
  end
19
-
19
+
20
20
  it "should register RoleGroupPermit-based permits" do
21
21
  CanTango.config.permits.role_group[:editors].should == EditorsRoleGroupPermit
22
22
  end
23
-
23
+
24
24
  it "should register UserPermit-based permits" do
25
25
  CanTango.config.permits.user[:admin].should == AdminPermit
26
26
  end
@@ -29,9 +29,9 @@ def setup
29
29
 
30
30
  let (:permit) do
31
31
  SystemRolePermit.new ability
32
- end
33
-
34
- let (:executor) do
32
+ end
33
+
34
+ let (:executor) do
35
35
  CanTango::PermitEngine::Executor::System.new permit, user_account
36
36
  end
37
37
  end
@@ -44,12 +44,12 @@ describe CanTango::Rules do
44
44
  it "should not have any rules" do
45
45
  permit.rules.should be_empty
46
46
  end
47
-
47
+
48
48
  it "should have rules after can" do
49
49
  permit.can :read, Comment
50
50
  permit.rules.should_not be_empty
51
- end
52
- end
51
+ end
52
+ end
53
53
  end
54
54
 
55
55
 
@@ -0,0 +1,53 @@
1
+ require 'rspec'
2
+ require 'cantango'
3
+ require 'fixtures/models'
4
+ require 'cantango/rspec'
5
+
6
+ def config_folder
7
+ File.dirname(__FILE__)+ "/../fixtures/config/"
8
+ end
9
+
10
+ CanTango.configure do |config|
11
+ config.clear!
12
+ end
13
+
14
+ class Thingy
15
+ attr_reader :name, :id
16
+
17
+ def initialize name
18
+ @name = name
19
+ @id = rand(1000)
20
+ end
21
+ end
22
+
23
+
24
+ describe CanTango::UserAcEngine do
25
+ context 'User model has_many Permissions' do
26
+ before do
27
+ @thingy = Thingy.new 'a'
28
+ @user = User.new 'kris'
29
+ @permission = Permission.new @user, :edit, @thingy
30
+ @user.permissions << @permission
31
+ end
32
+
33
+ describe 'Permission' do
34
+ subject { @permission }
35
+ its(:thing_id) { should be_a(Integer) }
36
+ end
37
+
38
+ describe 'UserAc engine' do
39
+ let (:ability) do
40
+ CanTango::Ability.new @user
41
+ end
42
+ subject { CanTango::UserAcEngine.new ability }
43
+
44
+ describe '#execute!' do
45
+ before do
46
+ subject.execute!
47
+ end
48
+
49
+ specify { subject.ability.send(:rules).should_not be_empty }
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,49 @@
1
+ ---
2
+ roles:
3
+ admin:
4
+ can:
5
+ manage:
6
+ - all
7
+ user:
8
+ can:
9
+ read:
10
+ - ^articles
11
+ - Post
12
+ write:
13
+ - Comment
14
+ cannot:
15
+ write:
16
+ - Article
17
+ role_groups:
18
+ bloggers:
19
+ can:
20
+ read:
21
+ - Article
22
+ - Comment
23
+ cannot:
24
+ write:
25
+ - Article
26
+ - Post
27
+ editors:
28
+ can:
29
+ read:
30
+ - Article
31
+ - Comment
32
+ cannot:
33
+ write:
34
+ - Article
35
+ - Post
36
+ licenses:
37
+ editors:
38
+ can:
39
+ manage:
40
+ - all
41
+ users:
42
+ kris@gmail.com:
43
+ can:
44
+ read:
45
+ - Article
46
+ user_types: {}
47
+
48
+ account_types: {}
49
+
@@ -0,0 +1,12 @@
1
+ class Permission
2
+ attr_accessor :thing, :thing_type, :action, :user
3
+
4
+ def initialize user, action, thing
5
+ @user, @action, @thing = [user, action, thing]
6
+ @thing_type = @thing.class.to_s
7
+ end
8
+
9
+ def thing_id
10
+ thing.id
11
+ end
12
+ end
@@ -23,4 +23,12 @@ class User
23
23
  def email
24
24
  @email ||= 'default@gmail.com'
25
25
  end
26
+
27
+ def role
28
+ @role || ''
29
+ end
30
+
31
+ def permissions
32
+ @permissions ||= []
33
+ end
26
34
  end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+ require 'generator-spec'
3
+
4
+ require_generator :cantango => :permission
5
+
6
+ RSpec::Generator.configure do |config|
7
+ config.debug = true
8
+ config.remove_temp_dir = true #false
9
+ config.default_rails_root(__FILE__)
10
+ config.lib = File.dirname(__FILE__) + '/../lib'
11
+ config.logger = :stdout # :file
12
+ end
13
+
14
+
15
+ describe Cantango::Generators::PermissionGenerator do
16
+ use_helpers :model, :special, :file
17
+
18
+ setup_generator :permission do
19
+ tests Cantango::Generators::PermissionGenerator
20
+ end
21
+
22
+ describe 'Run Permission generator' do
23
+ before :each do
24
+ @generator = with_generator do |g|
25
+ g.run_generator ["user"]
26
+ end
27
+ end
28
+
29
+ describe 'result of running Permission generator' do
30
+ it "should create Permission model for user" do
31
+ @generator.should have_model :permission do |model|
32
+ # model.should match /belongs_to :user/
33
+ end
34
+ end
35
+
36
+ it "should add has_many :permissions on User model" do
37
+ @generator.should have_model :user do |model|
38
+ # model.should match /has_many :permissions/
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.9.5
4
+ version: 0.9.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-17 00:00:00.000000000Z
13
+ date: 2011-10-29 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2158013060 !ruby/object:Gem::Requirement
17
+ requirement: &70260734920200 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2158013060
25
+ version_requirements: *70260734920200
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cancan
28
- requirement: &2158012580 !ruby/object:Gem::Requirement
28
+ requirement: &70260734919700 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2158012580
36
+ version_requirements: *70260734919700
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sugar-high
39
- requirement: &2158012100 !ruby/object:Gem::Requirement
39
+ requirement: &70260734919140 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.6.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2158012100
47
+ version_requirements: *70260734919140
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sweetloader
50
- requirement: &2158011620 !ruby/object:Gem::Requirement
50
+ requirement: &70260734918400 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2158011620
58
+ version_requirements: *70260734918400
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: hashie
61
- requirement: &2158011140 !ruby/object:Gem::Requirement
61
+ requirement: &70260734917620 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0.4'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2158011140
69
+ version_requirements: *70260734917620
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec-rails
72
- requirement: &2158010640 !ruby/object:Gem::Requirement
72
+ requirement: &70260734916760 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 2.6.1
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2158010640
80
+ version_requirements: *70260734916760
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: forgery
83
- requirement: &2158006000 !ruby/object:Gem::Requirement
83
+ requirement: &70260734916020 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0.3'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2158006000
91
+ version_requirements: *70260734916020
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: factory_girl
94
- requirement: &2158005420 !ruby/object:Gem::Requirement
94
+ requirement: &70260734915520 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2158005420
102
+ version_requirements: *70260734915520
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: sqlite3
105
- requirement: &2158004820 !ruby/object:Gem::Requirement
105
+ requirement: &70260734914840 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *2158004820
113
+ version_requirements: *70260734914840
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: sourcify
116
- requirement: &2158004240 !ruby/object:Gem::Requirement
116
+ requirement: &70260734914360 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *2158004240
124
+ version_requirements: *70260734914360
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: dkastner-moneta
127
- requirement: &2158003640 !ruby/object:Gem::Requirement
127
+ requirement: &70260734913880 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '1.0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *2158003640
135
+ version_requirements: *70260734913880
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec
138
- requirement: &2158003060 !ruby/object:Gem::Requirement
138
+ requirement: &70260734913400 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: 2.4.0
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *2158003060
146
+ version_requirements: *70260734913400
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: jeweler
149
- requirement: &2158002480 !ruby/object:Gem::Requirement
149
+ requirement: &70260734912920 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: 1.6.4
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *2158002480
157
+ version_requirements: *70260734912920
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: bundler
160
- requirement: &2158001940 !ruby/object:Gem::Requirement
160
+ requirement: &70260734912420 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ! '>='
@@ -165,10 +165,10 @@ dependencies:
165
165
  version: 1.0.1
166
166
  type: :development
167
167
  prerelease: false
168
- version_requirements: *2158001940
168
+ version_requirements: *70260734912420
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: rdoc
171
- requirement: &2158001460 !ruby/object:Gem::Requirement
171
+ requirement: &70260734911940 !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements:
174
174
  - - ! '>='
@@ -176,7 +176,7 @@ dependencies:
176
176
  version: '0'
177
177
  type: :development
178
178
  prerelease: false
179
- version_requirements: *2158001460
179
+ version_requirements: *70260734911940
180
180
  description: ! 'Define your permission rules as role- or role group specific permits.
181
181
 
182
182
  Integrates well with multiple Devise user acounts.
@@ -212,12 +212,14 @@ files:
212
212
  - lib/cantango/ability/cache/session_cache.rb
213
213
  - lib/cantango/ability/cache/writer.rb
214
214
  - lib/cantango/ability/cache_helpers.rb
215
+ - lib/cantango/ability/engine_helpers.rb
215
216
  - lib/cantango/ability/masquerade_helpers.rb
216
217
  - lib/cantango/ability/permission_helpers.rb
217
218
  - lib/cantango/ability/permit_helpers.rb
218
219
  - lib/cantango/ability/role_helpers.rb
219
220
  - lib/cantango/ability/scope.rb
220
221
  - lib/cantango/ability/user_helpers.rb
222
+ - lib/cantango/ability_executor.rb
221
223
  - lib/cantango/adapter/compiler.rb
222
224
  - lib/cantango/adapter/moneta.rb
223
225
  - lib/cantango/api.rb
@@ -234,14 +236,17 @@ files:
234
236
  - lib/cantango/api/user_account/ability.rb
235
237
  - lib/cantango/api/user_account/can.rb
236
238
  - lib/cantango/api/user_account/scope.rb
239
+ - lib/cantango/api/user_account/session.rb
237
240
  - lib/cantango/cache.rb
238
241
  - lib/cantango/cache/hash_cache.rb
239
242
  - lib/cantango/cache/moneta_cache.rb
243
+ - lib/cantango/cached_ability.rb
240
244
  - lib/cantango/cancan/rule.rb
241
245
  - lib/cantango/configuration.rb
242
246
  - lib/cantango/configuration/ability.rb
243
247
  - lib/cantango/configuration/adapters.rb
244
248
  - lib/cantango/configuration/autoload.rb
249
+ - lib/cantango/configuration/candidate_registry.rb
245
250
  - lib/cantango/configuration/categories.rb
246
251
  - lib/cantango/configuration/debug.rb
247
252
  - lib/cantango/configuration/engines.rb
@@ -250,10 +255,12 @@ files:
250
255
  - lib/cantango/configuration/engines/permission.rb
251
256
  - lib/cantango/configuration/engines/permit.rb
252
257
  - lib/cantango/configuration/engines/store.rb
258
+ - lib/cantango/configuration/engines/user_ac.rb
253
259
  - lib/cantango/configuration/factory.rb
254
260
  - lib/cantango/configuration/guest.rb
255
261
  - lib/cantango/configuration/hash_registry.rb
256
262
  - lib/cantango/configuration/models.rb
263
+ - lib/cantango/configuration/modes.rb
257
264
  - lib/cantango/configuration/permit_registry.rb
258
265
  - lib/cantango/configuration/permits.rb
259
266
  - lib/cantango/configuration/registry.rb
@@ -270,7 +277,11 @@ files:
270
277
  - lib/cantango/filters/role_filter.rb
271
278
  - lib/cantango/filters/role_group_filter.rb
272
279
  - lib/cantango/helpers.rb
280
+ - lib/cantango/helpers/debug.rb
273
281
  - lib/cantango/helpers/role_methods.rb
282
+ - lib/cantango/model.rb
283
+ - lib/cantango/model/filter.rb
284
+ - lib/cantango/model/scope.rb
274
285
  - lib/cantango/permission_engine.rb
275
286
  - lib/cantango/permission_engine/collector.rb
276
287
  - lib/cantango/permission_engine/compiler.rb
@@ -357,6 +368,8 @@ files:
357
368
  - lib/cantango/rules/rule_class.rb
358
369
  - lib/cantango/rules/scope.rb
359
370
  - lib/cantango/rules/user_relation.rb
371
+ - lib/cantango/user_ac_engine.rb
372
+ - lib/cantango/user_ac_engine/executor.rb
360
373
  - lib/cantango/users.rb
361
374
  - lib/cantango/users/macros.rb
362
375
  - lib/cantango/users/masquerade.rb
@@ -375,6 +388,7 @@ files:
375
388
  - lib/generators/cantango/license/templates/license.erb
376
389
  - lib/generators/cantango/license_base.rb
377
390
  - lib/generators/cantango/licenses/licenses_generator.rb
391
+ - lib/generators/cantango/permission/permission_generator.rb
378
392
  - lib/generators/cantango/permit_generator.rb
379
393
  - lib/generators/cantango/role_permit/role_permit_generator.rb
380
394
  - lib/generators/cantango/role_permit/templates/account_permit.erb
@@ -401,6 +415,7 @@ files:
401
415
  - spec/active_record/migrations/005_create_account.rb
402
416
  - spec/active_record/migrations/006_create_todo.rb
403
417
  - spec/active_record/migrations/007_create_user_todos.rb
418
+ - spec/active_record/migrations/008_create_permissions.rb
404
419
  - spec/active_record/scenarios/SCENARIOS README.textile
405
420
  - spec/active_record/scenarios/engines/permission_engine/categories.yml
406
421
  - spec/active_record/scenarios/engines/permission_engine/permissions.yml
@@ -455,6 +470,8 @@ files:
455
470
  - spec/cantango/ability/cache/session_cache_spec.rb
456
471
  - spec/cantango/ability/cache/writer_spec.rb
457
472
  - spec/cantango/ability/cache_spec.rb
473
+ - spec/cantango/ability_executor/cached_only_spec.rb
474
+ - spec/cantango/ability_executor_spec.rb
458
475
  - spec/cantango/ability_filters_spec.rb
459
476
  - spec/cantango/ability_spec.rb
460
477
  - spec/cantango/api/attributes_spec.rb
@@ -468,6 +485,7 @@ files:
468
485
  - spec/cantango/api/user_account/scope_api_spec.rb
469
486
  - spec/cantango/api/user_account_api_spec.rb
470
487
  - spec/cantango/api/user_api_spec.rb
488
+ - spec/cantango/cached_ability_spec.rb
471
489
  - spec/cantango/configuration/ability_spec.rb
472
490
  - spec/cantango/configuration/adapter_spec.rb
473
491
  - spec/cantango/configuration/autoload_spec.rb
@@ -497,6 +515,8 @@ files:
497
515
  - spec/cantango/configuration/user_spec.rb
498
516
  - spec/cantango/configuration_spec.rb
499
517
  - spec/cantango/license/save_license_spec.rb
518
+ - spec/cantango/model/filter_spec.rb
519
+ - spec/cantango/model/scope_spec.rb
500
520
  - spec/cantango/models/items.rb
501
521
  - spec/cantango/models/users.rb
502
522
  - spec/cantango/moneta_spec.rb
@@ -506,7 +526,7 @@ files:
506
526
  - spec/cantango/permission_engine/categories_store_spec.rb
507
527
  - spec/cantango/permission_engine/compiler_spec.rb
508
528
  - spec/cantango/permission_engine/loader/categories_spec.rb
509
- - spec/cantango/permission_engine/loader/permissions/cantango_permissions_loader.rb
529
+ - spec/cantango/permission_engine/loader/permissions/cantango_permissions_loader_spec.rb
510
530
  - spec/cantango/permission_engine/loader/permissions/shared.rb
511
531
  - spec/cantango/permission_engine/moneta_store_spec.rb
512
532
  - spec/cantango/permission_engine/parser_spec.rb
@@ -533,6 +553,7 @@ files:
533
553
  - spec/cantango/permits/macros_spec.rb
534
554
  - spec/cantango/permits/permit_spec.rb
535
555
  - spec/cantango/rules_spec.rb
556
+ - spec/cantango/user_ac_engine_spec.rb
536
557
  - spec/cantango_spec.rb
537
558
  - spec/devise-dummy/Rakefile
538
559
  - spec/devise-dummy/app/controllers/accounts_controller.rb
@@ -736,6 +757,7 @@ files:
736
757
  - spec/entire_suite_spec.rb
737
758
  - spec/factories/user.rb
738
759
  - spec/factories/user_account.rb
760
+ - spec/fixtures/config/cantango_permissions.yml
739
761
  - spec/fixtures/config/categories.yml
740
762
  - spec/fixtures/config/evaluator_fixtures.yml
741
763
  - spec/fixtures/config/licenses.yml
@@ -747,6 +769,7 @@ files:
747
769
  - spec/fixtures/models/admin.rb
748
770
  - spec/fixtures/models/admin_account.rb
749
771
  - spec/fixtures/models/items.rb
772
+ - spec/fixtures/models/permission.rb
750
773
  - spec/fixtures/models/simple_roles.rb
751
774
  - spec/fixtures/models/user.rb
752
775
  - spec/fixtures/models/user_account.rb
@@ -756,6 +779,7 @@ files:
756
779
  - spec/generators/cantango/install_generator_spec.rb
757
780
  - spec/generators/cantango/license_generator_spec.rb
758
781
  - spec/generators/cantango/licenses_generator_spec.rb
782
+ - spec/generators/cantango/permission_generator_spec.rb
759
783
  - spec/generators/cantango/role_permit_generator_spec.rb
760
784
  - spec/generators/cantango/role_permits_generator_spec.rb
761
785
  - spec/helpers/dummy_app_ability.rb
@@ -823,7 +847,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
823
847
  version: '0'
824
848
  segments:
825
849
  - 0
826
- hash: 3473046494406271623
850
+ hash: -2229342728946118666
827
851
  required_rubygems_version: !ruby/object:Gem::Requirement
828
852
  none: false
829
853
  requirements:
@@ -832,7 +856,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
832
856
  version: '0'
833
857
  requirements: []
834
858
  rubyforge_project:
835
- rubygems_version: 1.8.10
859
+ rubygems_version: 1.8.6
836
860
  signing_key:
837
861
  specification_version: 3
838
862
  summary: CanCan extension with role oriented permission management and more