simple_auth 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +31 -0
- data/VERSION +1 -1
- data/init.rb +4 -0
- data/lib/simple_auth/version.rb +1 -1
- data/simple_auth.gemspec +1 -1
- metadata +1 -1
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.
|
1
|
+
0.1.3
|
data/init.rb
CHANGED
data/lib/simple_auth/version.rb
CHANGED
data/simple_auth.gemspec
CHANGED