cream 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,6 +79,8 @@ The following Rails 3 demo apps use Cream 0.7.7 and above and were created aroun
79
79
  * "Cream app with Mongoid":https://github.com/kristianmandrup/cream-app-mongoid
80
80
  * "Cream app with Mongo Mapper":https://github.com/kristianmandrup/cream-app-mongo_mapper
81
81
 
82
+ You are most welcome to publish your own demo app with a later version of Cream. These apps need to be updated and demonstrate the real functionality of using the various APIs and DSLs that come with Cream and its supporting libs ;)
83
+
82
84
  h2. Authentication systems
83
85
 
84
86
  Cream targets "Devise":http://github.com/plataformatec/devise as the Authentication system of choice
@@ -97,7 +99,7 @@ Devise Configuration options:
97
99
  10. Validatable: provides validations of email and password. It’s optional and can be customized, so you’re able to define your own validations.
98
100
  11. Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
99
101
 
100
- Configuration is done using the _devise_ statement in the User class.
102
+ Configuration is done using the _devise_ statement in the User class (and subclasses).
101
103
 
102
104
  Example: Use _Confirmable_ and _Validatable_ devise options/strategies
103
105
 
@@ -107,7 +109,7 @@ class User
107
109
  end
108
110
  </pre>
109
111
 
110
- Note: For Active Record your User table (via migration fx) must support the columns needed for the devise options you are using.
112
+ Note: For Active Record your User table (via migration fx) must support the columns needed for the devise options you are using (See Devise documentation).
111
113
 
112
114
  h3. Devise links
113
115
 
@@ -167,11 +169,26 @@ Then you can handle any user with regards to his/her role group relationship lik
167
169
 
168
170
  <pre>
169
171
  # do this only for users in the admin role group (user has either :admin or :super_admin role)
170
- current_user.is_in_group? :admin do
172
+ current_user.is_in_group? :admins do
173
+ ...
174
+ end
175
+ </pre>
176
+
177
+ In your views you can guard view code with Role Group conditions:
178
+
179
+ <pre>
180
+ # do this only for users in the admin role group (user has either :admin or :super_admin role)
181
+ for_user_in_group :customers do
182
+ ...
183
+ end
184
+
185
+ # Cream 0.8.9 (edge)
186
+ not_for_user_in_group :admins do
171
187
  ...
172
188
  end
173
189
  </pre>
174
190
 
191
+
175
192
  h2. ORMs
176
193
 
177
194
  In general, it should now finally be pretty easy to set up a Rails 3 app, with a full Authentication and an Authorization system linked to a Role system using one of the following supported Cream ORMs.
data/Rakefile CHANGED
@@ -20,14 +20,14 @@ begin
20
20
 
21
21
  gem.add_dependency "devise-links", ">= 0.2.1"
22
22
  gem.add_dependency "cancan-rest-links", ">= 0.2.1"
23
- gem.add_dependency "cancan-permits", ">= 0.3.7"
23
+ gem.add_dependency "cancan-permits", ">= 0.3.9"
24
24
 
25
25
  gem.add_dependency "devise", ">= 1.1.5"
26
- gem.add_dependency "cancan", ">= 1.4.0"
26
+ gem.add_dependency "cancan", ">= 1.4.1"
27
27
  gem.add_dependency "rails", ">= 3.0.1"
28
28
 
29
29
  gem.add_dependency "rails3_artifactor", "~> 0.3.2"
30
- gem.add_dependency 'logging_assist', ">= 0.1.6"
30
+ gem.add_dependency 'logging_assist', ">= 0.2.0"
31
31
 
32
32
  gem.add_dependency "r3_plugin_toolbox", ">= 0.4.0"
33
33
  gem.add_dependency "sugar-high", ">= 0.3.1"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.9
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cream}
8
- s.version = "0.8.8"
8
+ s.version = "0.8.9"
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{2011-01-09}
12
+ s.date = %q{2011-01-10}
13
13
  s.description = %q{An integrated Authentication, Authorization and Roles solution for your Rails 3 app with support for multiple ORMs}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -155,12 +155,12 @@ Gem::Specification.new do |s|
155
155
  s.add_runtime_dependency(%q<colorize>, [">= 0.5.8"])
156
156
  s.add_runtime_dependency(%q<devise-links>, [">= 0.2.1"])
157
157
  s.add_runtime_dependency(%q<cancan-rest-links>, [">= 0.2.1"])
158
- s.add_runtime_dependency(%q<cancan-permits>, [">= 0.3.7"])
158
+ s.add_runtime_dependency(%q<cancan-permits>, [">= 0.3.9"])
159
159
  s.add_runtime_dependency(%q<devise>, [">= 1.1.5"])
160
- s.add_runtime_dependency(%q<cancan>, [">= 1.4.0"])
160
+ s.add_runtime_dependency(%q<cancan>, [">= 1.4.1"])
161
161
  s.add_runtime_dependency(%q<rails>, [">= 3.0.1"])
162
162
  s.add_runtime_dependency(%q<rails3_artifactor>, ["~> 0.3.2"])
163
- s.add_runtime_dependency(%q<logging_assist>, [">= 0.1.6"])
163
+ s.add_runtime_dependency(%q<logging_assist>, [">= 0.2.0"])
164
164
  s.add_runtime_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
165
165
  s.add_runtime_dependency(%q<sugar-high>, [">= 0.3.1"])
166
166
  else
@@ -186,12 +186,12 @@ Gem::Specification.new do |s|
186
186
  s.add_dependency(%q<colorize>, [">= 0.5.8"])
187
187
  s.add_dependency(%q<devise-links>, [">= 0.2.1"])
188
188
  s.add_dependency(%q<cancan-rest-links>, [">= 0.2.1"])
189
- s.add_dependency(%q<cancan-permits>, [">= 0.3.7"])
189
+ s.add_dependency(%q<cancan-permits>, [">= 0.3.9"])
190
190
  s.add_dependency(%q<devise>, [">= 1.1.5"])
191
- s.add_dependency(%q<cancan>, [">= 1.4.0"])
191
+ s.add_dependency(%q<cancan>, [">= 1.4.1"])
192
192
  s.add_dependency(%q<rails>, [">= 3.0.1"])
193
193
  s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.2"])
194
- s.add_dependency(%q<logging_assist>, [">= 0.1.6"])
194
+ s.add_dependency(%q<logging_assist>, [">= 0.2.0"])
195
195
  s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
196
196
  s.add_dependency(%q<sugar-high>, [">= 0.3.1"])
197
197
  end
@@ -218,12 +218,12 @@ Gem::Specification.new do |s|
218
218
  s.add_dependency(%q<colorize>, [">= 0.5.8"])
219
219
  s.add_dependency(%q<devise-links>, [">= 0.2.1"])
220
220
  s.add_dependency(%q<cancan-rest-links>, [">= 0.2.1"])
221
- s.add_dependency(%q<cancan-permits>, [">= 0.3.7"])
221
+ s.add_dependency(%q<cancan-permits>, [">= 0.3.9"])
222
222
  s.add_dependency(%q<devise>, [">= 1.1.5"])
223
- s.add_dependency(%q<cancan>, [">= 1.4.0"])
223
+ s.add_dependency(%q<cancan>, [">= 1.4.1"])
224
224
  s.add_dependency(%q<rails>, [">= 3.0.1"])
225
225
  s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.2"])
226
- s.add_dependency(%q<logging_assist>, [">= 0.1.6"])
226
+ s.add_dependency(%q<logging_assist>, [">= 0.2.0"])
227
227
  s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
228
228
  s.add_dependency(%q<sugar-high>, [">= 0.3.1"])
229
229
  end
@@ -50,6 +50,19 @@ module Cream::Helper
50
50
  yield if current_user && current_user.is_in_any_groups?(names.flat_uniq)
51
51
  end
52
52
 
53
+ def not_for_user_in_group name, &block
54
+ yield if current_user && !current_user.is_in_group?(name)
55
+ end
56
+
57
+ def not_for_user_in_groups *names, &block
58
+ yield if current_user && !current_user.is_in_group?(names.flat_uniq)
59
+ end
60
+
61
+ def not_for_user_in_any_group *names, &block
62
+ yield if current_user && !current_user.is_in_any_groups?(names.flat_uniq)
63
+ end
64
+
65
+
53
66
  # returns true if the current user owns the object
54
67
  # tries default 'owner' relations if none given as an argument
55
68
  def owner? obj, relation=nil
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 8
9
- version: 0.8.8
8
+ - 9
9
+ version: 0.8.9
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: 2011-01-09 00:00:00 +01:00
17
+ date: 2011-01-10 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -357,8 +357,8 @@ dependencies:
357
357
  segments:
358
358
  - 0
359
359
  - 3
360
- - 7
361
- version: 0.3.7
360
+ - 9
361
+ version: 0.3.9
362
362
  type: :runtime
363
363
  prerelease: false
364
364
  version_requirements: *id023
@@ -387,8 +387,8 @@ dependencies:
387
387
  segments:
388
388
  - 1
389
389
  - 4
390
- - 0
391
- version: 1.4.0
390
+ - 1
391
+ version: 1.4.1
392
392
  type: :runtime
393
393
  prerelease: false
394
394
  version_requirements: *id025
@@ -431,9 +431,9 @@ dependencies:
431
431
  - !ruby/object:Gem::Version
432
432
  segments:
433
433
  - 0
434
- - 1
435
- - 6
436
- version: 0.1.6
434
+ - 2
435
+ - 0
436
+ version: 0.2.0
437
437
  type: :runtime
438
438
  prerelease: false
439
439
  version_requirements: *id028