chowder 0.2.0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/chowder/rails.rb +24 -0
  2. metadata +4 -3
@@ -0,0 +1,24 @@
1
+ module Chowder
2
+ module Rails
3
+ def current_user
4
+ session[:current_user]
5
+ end
6
+
7
+ def authorized?
8
+ session[:current_user]
9
+ end
10
+
11
+ def login
12
+ session[:redirect_to] = request.path_info
13
+ redirect_to '/login'
14
+ end
15
+
16
+ def logout
17
+ session[:current_user] = nil
18
+ end
19
+
20
+ def require_user
21
+ login unless authorized?
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chowder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Vangberg
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-23 00:00:00 +01:00
13
+ date: 2009-01-19 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,7 @@ extra_rdoc_files: []
44
44
  files:
45
45
  - lib/chowder.rb
46
46
  - lib/sinatra/chowder.rb
47
+ - lib/chowder/rails.rb
47
48
  has_rdoc: true
48
49
  homepage: http://github.com/ichverstehe/chowder
49
50
  licenses: []
@@ -68,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  requirements: []
69
70
 
70
71
  rubyforge_project:
71
- rubygems_version: 1.3.5
72
+ rubygems_version: 1.3.3
72
73
  signing_key:
73
74
  specification_version: 3
74
75
  summary: rack middleware providing session based authentication