challah 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
+ ## Challah 0.3.3
2
+
3
+ * Added User#valid_session? method to check to see if this user is valid on each page load.
4
+
1
5
  ## Challah 0.3.2
2
6
 
3
7
  * Moving translations to accommodate for new namespace.
4
8
 
5
9
  ## Challah 0.3.1
6
10
 
7
- * Removed namespacing of controllers and default routes.
11
+ * Removed name spacing of controllers and default routes.
8
12
  * Added option to not include default routes
9
13
 
10
14
  ## Challah 0.3.0
data/README.md CHANGED
@@ -77,6 +77,11 @@ Roles should only be used within your app to consolidate various permissions int
77
77
 
78
78
  The default Challah installation creates two roles by default: 'Administrator' and 'Default'. Administrators have all permissions, now and in the future. Default users have no permissions other than being able to log in.
79
79
 
80
+ To add a permission to a role, add it to the `permission_keys` array:
81
+
82
+ role.permission_keys << "new_role"
83
+ role.save
84
+
80
85
  ## Restricted access
81
86
 
82
87
  One of the main reasons to use a user- and permission-based system is to restrict access to certain portions of your application. Challah provides basic restriction methods for your controllers, views and directly from any User instance.
@@ -193,7 +198,15 @@ If you'd prefer to set up your own login/logout actions, you can skip the inclus
193
198
 
194
199
  Documentation is available at: [http://rubydoc.info/gems/challah](http://rubydoc.info/gems/challah/frames)
195
200
 
196
- ## Testing
201
+ ## Contributing to Challah
202
+
203
+ Contributions and pull requests are welcome.
204
+
205
+ ### Issues
206
+
207
+ If you have any issues or find bugs running Challah, please [report them on Github](https://github.com/jdtornow/challah/issues). While most functions should be stable, Challah is still in its infancy and certain issues may be present.
208
+
209
+ ### Testing
197
210
 
198
211
  Challah is fully tested using Test Unit, Shoulda and Mocha. To run the test suite, `bundle install` then run:
199
212
 
@@ -203,4 +216,4 @@ Challah is fully tested using Test Unit, Shoulda and Mocha. To run the test suit
203
216
 
204
217
  Challah is released under the [MIT license](http://www.opensource.org/licenses/MIT)
205
218
 
206
- Contributions and pull-requests are more than welcome.
219
+ Contributions and pull-requests are more than welcome.
@@ -180,6 +180,13 @@ module Challah
180
180
  def user_permission_keys
181
181
  self.permissions(true).collect(&:key)
182
182
  end
183
+
184
+ # Is this user valid and ready for a user session?
185
+ #
186
+ # Override this method if you need to check for a particular configuration on each page request.
187
+ def valid_session?
188
+ true
189
+ end
183
190
 
184
191
  # Allow dynamic checking for permissions
185
192
  #
@@ -38,9 +38,11 @@ module Challah
38
38
 
39
39
  store_user = ::User.find_by_id(user_id)
40
40
 
41
- if store_user and store_user.active? and store_user.persistence_token == persistence_token
42
- self.user = store_user
43
- @valid = true
41
+ if store_user and store_user.active? and store_user.persistence_token == persistence_token
42
+ if store_user.valid_session?
43
+ self.user = store_user
44
+ @valid = true
45
+ end
44
46
  end
45
47
 
46
48
  self
@@ -115,7 +117,7 @@ module Challah
115
117
  # Load any existing session from the session store
116
118
  def find(*args)
117
119
  session = Session.new(*args)
118
- session.read
120
+ session.read
119
121
  session
120
122
  end
121
123
  end
@@ -1,3 +1,3 @@
1
1
  module Challah
2
- VERSION = "0.3.2" unless defined?(::Challah::VERSION)
2
+ VERSION = "0.3.3" unless defined?(::Challah::VERSION)
3
3
  end
@@ -135,7 +135,7 @@ checked program was:
135
135
  "/usr/bin/gcc-4.2 -o conftest -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib -L. -L'/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib' -lsqlite3 -lruby-static -lsqlite3 -lpthread -ldl -lobjc "
136
136
  Undefined symbols for architecture x86_64:
137
137
  "_sqlite3_column_database_name", referenced from:
138
- _t in ccLzi5SM.o
138
+ _t in ccEK9yVc.o
139
139
  ld: symbol(s) not found for architecture x86_64
140
140
  collect2: ld returned 1 exit status
141
141
  checked program was:
@@ -168,7 +168,7 @@ checked program was:
168
168
  "/usr/bin/gcc-4.2 -o conftest -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib -L. -L'/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib' -lsqlite3 -lruby-static -lsqlite3 -lpthread -ldl -lobjc "
169
169
  Undefined symbols for architecture x86_64:
170
170
  "_sqlite3_enable_load_extension", referenced from:
171
- _t in ccF1GDNv.o
171
+ _t in ccqeYNHU.o
172
172
  ld: symbol(s) not found for architecture x86_64
173
173
  collect2: ld returned 1 exit status
174
174
  checked program was:
@@ -201,7 +201,7 @@ checked program was:
201
201
  "/usr/bin/gcc-4.2 -o conftest -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/jdtornow/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/jdtornow/.rbenv/versions/1.9.2-p290/include' -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib -L. -L'/Users/jdtornow/.rbenv/versions/1.9.2-p290/lib' -lsqlite3 -lruby-static -lsqlite3 -lpthread -ldl -lobjc "
202
202
  Undefined symbols for architecture x86_64:
203
203
  "_sqlite3_load_extension", referenced from:
204
- _t in ccWwmhGq.o
204
+ _t in ccy9bPfh.o
205
205
  ld: symbol(s) not found for architecture x86_64
206
206
  collect2: ld returned 1 exit status
207
207
  checked program was:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: challah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70284138631180 !ruby/object:Gem::Requirement
16
+ requirement: &70290451108860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70284138631180
24
+ version_requirements: *70290451108860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70284138630680 !ruby/object:Gem::Requirement
27
+ requirement: &70290451108360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70284138630680
35
+ version_requirements: *70290451108360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bcrypt-ruby
38
- requirement: &70284138670660 !ruby/object:Gem::Requirement
38
+ requirement: &70290451107900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70284138670660
46
+ version_requirements: *70290451107900
47
47
  description: A simple ruby gem for authentication, users, roles and permissions.
48
48
  email:
49
49
  - john@johntornow.com