simple_auth 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -84,6 +84,37 @@ After you set up the model, you can go the controller.
84
84
  end
85
85
  end
86
86
 
87
+ You can restrict access by using 2 macros:
88
+
89
+ class SignupController < ApplicationController
90
+ redirect_logged_user :to => "/"
91
+ end
92
+
93
+ Here's some usage examples:
94
+
95
+ redirect_logged_user :to => proc { login_path }
96
+ redirect_logged_user :to => {:controller => "dashboard"}
97
+ redirect_logged_user :only => [:index], :to => login_path
98
+ redirect_logged_user :except => [:public], :to => login_path
99
+
100
+ To require a logged user, use the `require_logged_user` macro:
101
+
102
+ class DashboardController < ApplicationController
103
+ require_logged_user :to => proc { login_path }
104
+ end
105
+
106
+ Here's some usage examples:
107
+
108
+ require_logged_user :to => proc { login_path }
109
+ require_logged_user :to => {:controller => "session", :action => "new"}
110
+ require_logged_user :only => [:index], :to => login_path
111
+ require_logged_user :except => [:public], :to => login_path
112
+
113
+ You can skip the `:to` option if you set it globally on your initializer:
114
+
115
+ SimpleAuth::Config.redirect_to = {:controller => "session", :action => "new"}
116
+ SimpleAuth::Config.redirect_to = proc { login_path }
117
+
87
118
  There are some helpers:
88
119
 
89
120
  logged_in? # controller & views
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/init.rb CHANGED
@@ -1 +1,5 @@
1
1
  require "simple_auth"
2
+
3
+ config.to_prepare do
4
+ ApplicationController.helper SimpleAuthHelper
5
+ end
@@ -2,7 +2,7 @@ module SimpleAuth
2
2
  module Version
3
3
  MAJOR = "0"
4
4
  MINOR = "1"
5
- PATCH = "2"
5
+ PATCH = "3"
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/simple_auth.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simple_auth}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nando Vieira"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira