roles_active_record 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +20 -7
- data/Rakefile +5 -6
- data/VERSION +1 -1
- data/roles_active_record.gemspec +17 -20
- data/spec/spec_helper.rb +3 -3
- metadata +16 -33
data/README.markdown
CHANGED
@@ -48,6 +48,7 @@ Multi role:
|
|
48
48
|
* many_roles
|
49
49
|
* roles_mask
|
50
50
|
|
51
|
+
_Note_ The strategies *one_role* and *many_roles* both use a separate Role model (roles table). The others use an inline strategy with an attribute in the User model.
|
51
52
|
|
52
53
|
### Admin flag
|
53
54
|
|
@@ -145,23 +146,35 @@ The following role strategies are included by default. Add your own by adding ex
|
|
145
146
|
* one_role
|
146
147
|
* many_roles
|
147
148
|
|
148
|
-
_Important:_
|
149
|
-
|
150
|
-
The generators are a bit rusty and needs to be updated to take advantage of the [rails3_artifactor](http://github.com/kristianmandrup/rails3_artifactor)
|
151
|
-
Please see the [roles mongoid](http://github.com/kristianmandrup/roles_mongoid) for an example. You are most welcome to submit a patch to make it work for AR ;)
|
152
149
|
|
153
150
|
### Generators
|
154
151
|
|
155
152
|
* active_record:roles
|
156
153
|
* active_record:roles_migration
|
157
154
|
|
155
|
+
*Roles*
|
156
|
+
|
157
|
+
Apply :admin_flag Role strategy to User model using default roles :admin and :guest (default)
|
158
|
+
|
159
|
+
<code>$ rails g active_record:roles User --strategy admin_flag</code>
|
160
|
+
|
161
|
+
Apply :admin_flag Role strategy to User model using default roles and extra role :author
|
162
|
+
|
163
|
+
<code>$ rails g active_record:roles_migration User --strategy admin_flag --roles author</code>
|
164
|
+
|
165
|
+
Apply :one_role Role strategy to User model without default roles, only with roles :user, :special and :editor
|
166
|
+
|
167
|
+
<code>$ rails g active_record:roles_migration User --strategy one_role --roles user special editor --no-default-roles</code>
|
168
|
+
|
169
|
+
*Roles Migration*
|
170
|
+
|
158
171
|
Example: admin_flag Role strategy - generate migrations and model files
|
159
172
|
|
160
|
-
<code>$ rails g active_record:
|
173
|
+
<code>$ rails g active_record:roles_migration User --strategy admin_flag</code>
|
161
174
|
|
162
|
-
|
175
|
+
Create reverse migration
|
163
176
|
|
164
|
-
<code>$ rails g active_record:roles_migration User admin_flag</code>
|
177
|
+
<code>$ rails g active_record:roles_migration User --strategy admin_flag --reverse</code>
|
165
178
|
|
166
179
|
## Note on Patches/Pull Requests
|
167
180
|
|
data/Rakefile
CHANGED
@@ -7,18 +7,17 @@ begin
|
|
7
7
|
gem.email = "kmandrup@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/kristianmandrup/roles_for_dm"
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec", "~> 2.0.0
|
10
|
+
gem.add_development_dependency "rspec", "~> 2.0.0"
|
11
11
|
gem.add_development_dependency 'database_cleaner', '~> 0.5.2'
|
12
|
-
gem.add_development_dependency "generator-spec", '~> 0.
|
12
|
+
gem.add_development_dependency "generator-spec", '~> 0.6.1'
|
13
13
|
|
14
14
|
gem.add_dependency "activerecord", "~> 3.0.0"
|
15
15
|
gem.add_dependency "activesupport", "~> 3.0.0"
|
16
16
|
gem.add_dependency "arel", "~> 1.0.0"
|
17
|
-
gem.add_dependency "meta_where", "
|
18
|
-
gem.add_dependency "sugar-high", "~> 0.2.
|
17
|
+
gem.add_dependency "meta_where", "~> 0.9.3"
|
18
|
+
gem.add_dependency "sugar-high", "~> 0.2.5"
|
19
19
|
gem.add_dependency "require_all", '~> 1.1.0'
|
20
|
-
gem.add_dependency "
|
21
|
-
gem.add_dependency "roles_generic", '~> 0.2.2'
|
20
|
+
gem.add_dependency "roles_generic", '~> 0.2.5'
|
22
21
|
|
23
22
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
24
23
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/roles_active_record.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{roles_active_record}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-13}
|
13
13
|
s.description = %q{Makes it easy to set a role strategy on your User model in Active Record}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -133,42 +133,39 @@ Gem::Specification.new do |s|
|
|
133
133
|
s.specification_version = 3
|
134
134
|
|
135
135
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
136
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.0.0
|
136
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0"])
|
137
137
|
s.add_development_dependency(%q<database_cleaner>, ["~> 0.5.2"])
|
138
|
-
s.add_development_dependency(%q<generator-spec>, ["~> 0.
|
138
|
+
s.add_development_dependency(%q<generator-spec>, ["~> 0.6.1"])
|
139
139
|
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
|
140
140
|
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
|
141
141
|
s.add_runtime_dependency(%q<arel>, ["~> 1.0.0"])
|
142
|
-
s.add_runtime_dependency(%q<meta_where>, ["
|
143
|
-
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.
|
142
|
+
s.add_runtime_dependency(%q<meta_where>, ["~> 0.9.3"])
|
143
|
+
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.5"])
|
144
144
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
|
145
|
-
s.add_runtime_dependency(%q<
|
146
|
-
s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.2"])
|
145
|
+
s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
147
146
|
else
|
148
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0
|
147
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
149
148
|
s.add_dependency(%q<database_cleaner>, ["~> 0.5.2"])
|
150
|
-
s.add_dependency(%q<generator-spec>, ["~> 0.
|
149
|
+
s.add_dependency(%q<generator-spec>, ["~> 0.6.1"])
|
151
150
|
s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
|
152
151
|
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
153
152
|
s.add_dependency(%q<arel>, ["~> 1.0.0"])
|
154
|
-
s.add_dependency(%q<meta_where>, ["
|
155
|
-
s.add_dependency(%q<sugar-high>, ["~> 0.2.
|
153
|
+
s.add_dependency(%q<meta_where>, ["~> 0.9.3"])
|
154
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.5"])
|
156
155
|
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
157
|
-
s.add_dependency(%q<
|
158
|
-
s.add_dependency(%q<roles_generic>, ["~> 0.2.2"])
|
156
|
+
s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
159
157
|
end
|
160
158
|
else
|
161
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0
|
159
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
162
160
|
s.add_dependency(%q<database_cleaner>, ["~> 0.5.2"])
|
163
|
-
s.add_dependency(%q<generator-spec>, ["~> 0.
|
161
|
+
s.add_dependency(%q<generator-spec>, ["~> 0.6.1"])
|
164
162
|
s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
|
165
163
|
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
166
164
|
s.add_dependency(%q<arel>, ["~> 1.0.0"])
|
167
|
-
s.add_dependency(%q<meta_where>, ["
|
168
|
-
s.add_dependency(%q<sugar-high>, ["~> 0.2.
|
165
|
+
s.add_dependency(%q<meta_where>, ["~> 0.9.3"])
|
166
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.5"])
|
169
167
|
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
170
|
-
s.add_dependency(%q<
|
171
|
-
s.add_dependency(%q<roles_generic>, ["~> 0.2.2"])
|
168
|
+
s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
|
172
169
|
end
|
173
170
|
end
|
174
171
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require '
|
1
|
+
require 'rspec/core'
|
2
|
+
# require 'autotest/rspec2'
|
3
3
|
require 'rails'
|
4
4
|
require 'active_record'
|
5
5
|
require 'arel'
|
@@ -7,7 +7,7 @@ require 'meta_where'
|
|
7
7
|
require 'yaml'
|
8
8
|
require 'logger'
|
9
9
|
require 'database_cleaner'
|
10
|
-
require '
|
10
|
+
require 'roles_active_record'
|
11
11
|
|
12
12
|
module Rails
|
13
13
|
def self.config_root_dir
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-13 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -29,9 +29,7 @@ dependencies:
|
|
29
29
|
- 2
|
30
30
|
- 0
|
31
31
|
- 0
|
32
|
-
|
33
|
-
- 19
|
34
|
-
version: 2.0.0.beta.19
|
32
|
+
version: 2.0.0
|
35
33
|
type: :development
|
36
34
|
version_requirements: *id001
|
37
35
|
- !ruby/object:Gem::Dependency
|
@@ -59,9 +57,9 @@ dependencies:
|
|
59
57
|
- !ruby/object:Gem::Version
|
60
58
|
segments:
|
61
59
|
- 0
|
62
|
-
-
|
63
|
-
-
|
64
|
-
version: 0.
|
60
|
+
- 6
|
61
|
+
- 1
|
62
|
+
version: 0.6.1
|
65
63
|
type: :development
|
66
64
|
version_requirements: *id003
|
67
65
|
- !ruby/object:Gem::Dependency
|
@@ -115,13 +113,13 @@ dependencies:
|
|
115
113
|
requirement: &id007 !ruby/object:Gem::Requirement
|
116
114
|
none: false
|
117
115
|
requirements:
|
118
|
-
- -
|
116
|
+
- - ~>
|
119
117
|
- !ruby/object:Gem::Version
|
120
118
|
segments:
|
121
119
|
- 0
|
122
|
-
-
|
123
|
-
-
|
124
|
-
version: 0.
|
120
|
+
- 9
|
121
|
+
- 3
|
122
|
+
version: 0.9.3
|
125
123
|
type: :runtime
|
126
124
|
version_requirements: *id007
|
127
125
|
- !ruby/object:Gem::Dependency
|
@@ -135,8 +133,8 @@ dependencies:
|
|
135
133
|
segments:
|
136
134
|
- 0
|
137
135
|
- 2
|
138
|
-
-
|
139
|
-
version: 0.2.
|
136
|
+
- 5
|
137
|
+
version: 0.2.5
|
140
138
|
type: :runtime
|
141
139
|
version_requirements: *id008
|
142
140
|
- !ruby/object:Gem::Dependency
|
@@ -155,7 +153,7 @@ dependencies:
|
|
155
153
|
type: :runtime
|
156
154
|
version_requirements: *id009
|
157
155
|
- !ruby/object:Gem::Dependency
|
158
|
-
name:
|
156
|
+
name: roles_generic
|
159
157
|
prerelease: false
|
160
158
|
requirement: &id010 !ruby/object:Gem::Requirement
|
161
159
|
none: false
|
@@ -165,25 +163,10 @@ dependencies:
|
|
165
163
|
segments:
|
166
164
|
- 0
|
167
165
|
- 2
|
168
|
-
-
|
169
|
-
version: 0.2.
|
166
|
+
- 5
|
167
|
+
version: 0.2.5
|
170
168
|
type: :runtime
|
171
169
|
version_requirements: *id010
|
172
|
-
- !ruby/object:Gem::Dependency
|
173
|
-
name: roles_generic
|
174
|
-
prerelease: false
|
175
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
176
|
-
none: false
|
177
|
-
requirements:
|
178
|
-
- - ~>
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
segments:
|
181
|
-
- 0
|
182
|
-
- 2
|
183
|
-
- 2
|
184
|
-
version: 0.2.2
|
185
|
-
type: :runtime
|
186
|
-
version_requirements: *id011
|
187
170
|
description: Makes it easy to set a role strategy on your User model in Active Record
|
188
171
|
email: kmandrup@gmail.com
|
189
172
|
executables: []
|