cantango 0.9.4.5 → 0.9.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,10 +38,19 @@ Run bundler in a terminal/console from the folder of your Gemfile (root folder o
38
38
 
39
39
  h2. Update Nov 21, 2011
40
40
 
41
- Version 0.9.4.5 has been released. Fixes bug in configuration/permit_registry.
41
+ Version 0.9.4.6 has been released. Fixes bug in configuration/permit_registry.
42
42
 
43
43
  The "wiki":https://github.com/kristianmandrup/cantango/wiki has been rewritten and updated to reflect all latest design changes and feature additions.
44
44
 
45
+ I am now in the process of a major refactoring effort in the *major-refactor* branch.
46
+ I've split up cantango into separate gems which will be developed independently in the future (towards a 1.0 release), notably one gem for each engine. I might rename the "engine" concept into "component" so that developers don't confuse it with Rails engines ;)
47
+
48
+ * "cantango-cache":https://github.com/kristianmandrup/cantango-cache
49
+ * "permits":https://github.com/kristianmandrup/permits
50
+ * "permit_store":https://github.com/kristianmandrup/permit_store
51
+
52
+ I might also extract the _permission_ engine (currently known as _user_ac_). Lot's of changes coming doewn the pipeline. Please help make CanTango much better and more stable! Thanks!
53
+
45
54
  h2. Quickstart
46
55
 
47
56
  See the "Quickstart guide":https://github.com/kristianmandrup/cantango/wiki/Quickstart in the wiki.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.4.5
1
+ 0.9.4.6
@@ -4,17 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{cantango}
8
- s.version = "0.9.4.5"
7
+ s.name = "cantango"
8
+ s.version = "0.9.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Kristian Mandrup}, %q{Stanislaw Pankevich}]
12
- s.date = %q{2011-11-21}
13
- s.description = %q{Define your permission rules as role- or role group specific permits.
14
- Integrates well with multiple Devise user acounts.
15
- Includes rules caching.
16
- Store permissions in yaml file or key-value store}
17
- s.email = %q{kmandrup@gmail.com, s.pankevich@gmail.com}
11
+ s.authors = ["Kristian Mandrup", "Stanislaw Pankevich"]
12
+ s.date = "2011-11-24"
13
+ s.description = "Define your permission rules as role- or role group specific permits.\nIntegrates well with multiple Devise user acounts.\nIncludes rules caching.\nStore permissions in yaml file or key-value store"
14
+ s.email = "kmandrup@gmail.com, s.pankevich@gmail.com"
18
15
  s.extra_rdoc_files = [
19
16
  "LICENSE.txt",
20
17
  "README.textile"
@@ -688,11 +685,11 @@ Store permissions in yaml file or key-value store}
688
685
  "wiki/when_to_use.markdown",
689
686
  "wiki/why_to_use.markdown"
690
687
  ]
691
- s.homepage = %q{http://github.com/kristianmandrup/cantango}
692
- s.licenses = [%q{MIT}]
693
- s.require_paths = [%q{lib}]
694
- s.rubygems_version = %q{1.8.6}
695
- s.summary = %q{CanCan extension with role oriented permission management and more}
688
+ s.homepage = "http://github.com/kristianmandrup/cantango"
689
+ s.licenses = ["MIT"]
690
+ s.require_paths = ["lib"]
691
+ s.rubygems_version = "1.8.10"
692
+ s.summary = "CanCan extension with role oriented permission management and more"
696
693
 
697
694
  if s.respond_to? :specification_version then
698
695
  s.specification_version = 3
@@ -1,9 +1,9 @@
1
1
  module CanTango
2
2
  class Configuration
3
3
  class PermitRegistry
4
- def get_permit label
5
- raise ArgumentError, "Not an available permit" if !CanTango.config.permits.available_types.include? label
6
- inst_var_name = "@#{label}"
4
+ def permits_for type
5
+ raise ArgumentError, "Not an available permit type: #{type}, available are: #{available_types}" if !available_types.include? type
6
+ inst_var_name = "@#{type}"
7
7
  instance_variable_set(inst_var_name, HashRegistry.new) if !instance_variable_get(inst_var_name)
8
8
  instance_variable_get(inst_var_name)
9
9
  end
@@ -13,16 +13,20 @@ module CanTango
13
13
  end
14
14
 
15
15
  def registered_by type
16
- get(type).registered
16
+ permits_for(type).registered
17
17
  end
18
18
 
19
19
  def all
20
- (CanTango.config.permits.available_types - [:special]).map{|label| get_permit(label) }
20
+ (available_types - [:special]).map{|type| permits_for(type)}
21
21
  end
22
22
 
23
23
  def show_all
24
24
  all.map(&:registered)
25
25
  end
26
+
27
+ def available_types
28
+ CanTango.config.permits.available_types
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -80,9 +80,8 @@ module CanTango
80
80
  def register_permit_class(permit_name, permit_clazz, permit_type, account_name)
81
81
  registry = account_name ? get_permit(account_name.to_sym) : self
82
82
  debug "Registering #{permit_type} permit: #{permit_name} of class #{permit_clazz}"
83
-
84
- registry.get(permit_type)[permit_name] = permit_clazz
85
- debug registry.get_permit(permit_type).inspect
83
+ registry.permits_for(permit_type)[permit_name] = permit_clazz
84
+ debug registry.permits_for(permit_type).inspect
86
85
  end
87
86
 
88
87
  def allowed candidate, actions, subjects, *extra_args
@@ -3,12 +3,24 @@ module CanTango
3
3
  class RoleGroups < RoleRegistry
4
4
  include Singleton
5
5
 
6
+ attr_writer :role_groups_system
7
+
8
+ def role_groups_system
9
+ @role_groups_system ||= :troles
10
+ end
11
+
6
12
  def default_has_method
7
13
  :in_role_group?
8
14
  end
9
15
 
10
16
  def default_list_method
11
- :role_groups_list
17
+ role_groups_list_map[role_groups_system] || :role_groups_list
18
+ end
19
+
20
+ def role_groups_list_map
21
+ @role_groups_list_map ||= {
22
+ :troles => :role_group_list
23
+ }
12
24
  end
13
25
  end
14
26
  end
@@ -3,12 +3,24 @@ module CanTango
3
3
  class Roles < RoleRegistry
4
4
  include Singleton
5
5
 
6
+ attr_writer :roles_system
7
+
8
+ def roles_system
9
+ @roles_system ||= :troles
10
+ end
11
+
6
12
  def default_has_method
7
13
  :has_role?
8
14
  end
9
15
 
10
16
  def default_list_method
11
- :roles_list
17
+ role_list_map[roles_system] || :roles_list
18
+ end
19
+
20
+ def role_list_map
21
+ @role_list_map ||= {
22
+ :troles => :role_list
23
+ }
12
24
  end
13
25
  end
14
26
  end
@@ -23,7 +23,6 @@ module CanTango
23
23
  end
24
24
 
25
25
  def valid?
26
- puts "valid_mode? #{valid_mode?} #{modes} #{cached?}"
27
26
  return false if !valid_mode?
28
27
  permissions.empty? ? invalid : true
29
28
  end
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.9.4.5
4
+ version: 0.9.4.6
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-11-21 00:00:00.000000000Z
13
+ date: 2011-11-24 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70220124631000 !ruby/object:Gem::Requirement
17
+ requirement: &760593560 !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: *70220124631000
25
+ version_requirements: *760593560
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cancan
28
- requirement: &70220124630520 !ruby/object:Gem::Requirement
28
+ requirement: &760570980 !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: *70220124630520
36
+ version_requirements: *760570980
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sugar-high
39
- requirement: &70220124630020 !ruby/object:Gem::Requirement
39
+ requirement: &760567230 !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: *70220124630020
47
+ version_requirements: *760567230
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sweetloader
50
- requirement: &70220124629400 !ruby/object:Gem::Requirement
50
+ requirement: &760562470 !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: *70220124629400
58
+ version_requirements: *760562470
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: hashie
61
- requirement: &70220124628760 !ruby/object:Gem::Requirement
61
+ requirement: &760559870 !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: *70220124628760
69
+ version_requirements: *760559870
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec-rails
72
- requirement: &70220124628100 !ruby/object:Gem::Requirement
72
+ requirement: &760553610 !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: *70220124628100
80
+ version_requirements: *760553610
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: forgery
83
- requirement: &70220124627420 !ruby/object:Gem::Requirement
83
+ requirement: &760551830 !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: *70220124627420
91
+ version_requirements: *760551830
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: factory_girl
94
- requirement: &70220124626940 !ruby/object:Gem::Requirement
94
+ requirement: &760549670 !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: *70220124626940
102
+ version_requirements: *760549670
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: sqlite3
105
- requirement: &70220124620920 !ruby/object:Gem::Requirement
105
+ requirement: &760536730 !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: *70220124620920
113
+ version_requirements: *760536730
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: sourcify
116
- requirement: &70220124620260 !ruby/object:Gem::Requirement
116
+ requirement: &760536290 !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: *70220124620260
124
+ version_requirements: *760536290
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: dkastner-moneta
127
- requirement: &70220124619620 !ruby/object:Gem::Requirement
127
+ requirement: &760535520 !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: *70220124619620
135
+ version_requirements: *760535520
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec
138
- requirement: &70220124618860 !ruby/object:Gem::Requirement
138
+ requirement: &760535020 !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: *70220124618860
146
+ version_requirements: *760535020
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: jeweler
149
- requirement: &70220124618380 !ruby/object:Gem::Requirement
149
+ requirement: &760534760 !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: *70220124618380
157
+ version_requirements: *760534760
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: bundler
160
- requirement: &70220124617720 !ruby/object:Gem::Requirement
160
+ requirement: &760534360 !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: *70220124617720
168
+ version_requirements: *760534360
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: rdoc
171
- requirement: &70220124617020 !ruby/object:Gem::Requirement
171
+ requirement: &760533950 !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: *70220124617020
179
+ version_requirements: *760533950
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.
@@ -873,7 +873,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
873
873
  version: '0'
874
874
  segments:
875
875
  - 0
876
- hash: -477019430598223523
876
+ hash: 967356769
877
877
  required_rubygems_version: !ruby/object:Gem::Requirement
878
878
  none: false
879
879
  requirements:
@@ -882,7 +882,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
882
882
  version: '0'
883
883
  requirements: []
884
884
  rubyforge_project:
885
- rubygems_version: 1.8.6
885
+ rubygems_version: 1.8.10
886
886
  signing_key:
887
887
  specification_version: 3
888
888
  summary: CanCan extension with role oriented permission management and more