lockdown 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +39 -0
- data/lib/lockdown/controller.rb +3 -3
- data/lib/lockdown/system.rb +1 -5
- data/lib/lockdown/version.rb +2 -2
- data/rails_generators/lockdown/USAGE +5 -0
- data/rails_generators/lockdown/lockdown_generator.rb +221 -0
- data/rails_generators/lockdown/templates/app/controllers/permissions_controller.rb +22 -0
- data/rails_generators/lockdown/templates/app/controllers/sessions_controller.rb +38 -0
- data/rails_generators/lockdown/templates/app/controllers/user_groups_controller.rb +113 -0
- data/rails_generators/lockdown/templates/app/controllers/users_controller.rb +124 -0
- data/rails_generators/lockdown/templates/app/helpers/permissions_helper.rb +13 -0
- data/rails_generators/lockdown/templates/app/helpers/user_groups_helper.rb +35 -0
- data/rails_generators/lockdown/templates/app/helpers/users_helper.rb +78 -0
- data/rails_generators/lockdown/templates/app/models/permission.rb +13 -0
- data/rails_generators/lockdown/templates/app/models/profile.rb +10 -0
- data/rails_generators/lockdown/templates/app/models/user.rb +72 -0
- data/rails_generators/lockdown/templates/app/models/user_group.rb +15 -0
- data/rails_generators/lockdown/templates/app/views/permissions/_data.html.erb +13 -0
- data/rails_generators/lockdown/templates/app/views/permissions/index.html.erb +16 -0
- data/rails_generators/lockdown/templates/app/views/permissions/show.html.erb +3 -0
- data/rails_generators/lockdown/templates/app/views/sessions/new.html.erb +12 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/_data.html.erb +44 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/_form.html.erb +11 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/edit.html.erb +6 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/index.html.erb +20 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/new.html.erb +5 -0
- data/rails_generators/lockdown/templates/app/views/user_groups/show.html.erb +6 -0
- data/rails_generators/lockdown/templates/app/views/users/_data.html.erb +62 -0
- data/rails_generators/lockdown/templates/app/views/users/_form.html.erb +18 -0
- data/rails_generators/lockdown/templates/app/views/users/_password.html.erb +5 -0
- data/rails_generators/lockdown/templates/app/views/users/edit.html.erb +6 -0
- data/rails_generators/lockdown/templates/app/views/users/index.html.erb +22 -0
- data/rails_generators/lockdown/templates/app/views/users/new.html.erb +5 -0
- data/rails_generators/lockdown/templates/app/views/users/show.html.erb +4 -0
- data/rails_generators/lockdown/templates/db/migrate/create_admin_user_and_user_group.rb +19 -0
- data/rails_generators/lockdown/templates/db/migrate/create_permissions.rb +19 -0
- data/rails_generators/lockdown/templates/db/migrate/create_profiles.rb +26 -0
- data/rails_generators/lockdown/templates/db/migrate/create_user_groups.rb +19 -0
- data/rails_generators/lockdown/templates/db/migrate/create_users.rb +17 -0
- data/rails_generators/lockdown_all/lockdown_all_generator.rb +0 -2
- data/test/test_generator_helper.rb +10 -1
- data/test/test_lockdown_generator.rb +11 -9
- data/website/generator.html +243 -0
- data/website/generator.txt +174 -0
- data/website/index.html +331 -0
- data/website/index.txt +62 -26
- data/website/model.jpg +0 -0
- metadata +42 -2
@@ -0,0 +1,243 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<title>
|
8
|
+
Lockdown
|
9
|
+
</title>
|
10
|
+
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
+
<style>
|
12
|
+
|
13
|
+
</style>
|
14
|
+
<script type="text/javascript">
|
15
|
+
window.onload = function() {
|
16
|
+
settings = {
|
17
|
+
tl: { radius: 10 },
|
18
|
+
tr: { radius: 10 },
|
19
|
+
bl: { radius: 10 },
|
20
|
+
br: { radius: 10 },
|
21
|
+
antiAlias: true,
|
22
|
+
autoPad: true,
|
23
|
+
validTags: ["div"]
|
24
|
+
}
|
25
|
+
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
+
versionBox.applyCornersToAll();
|
27
|
+
}
|
28
|
+
</script>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="main">
|
32
|
+
|
33
|
+
<h1>Lockdown</h1>
|
34
|
+
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/lockdown"; return false'>
|
35
|
+
<p>Get Version</p>
|
36
|
+
<a href="http://rubyforge.org/projects/lockdown" class="numbers">0.5.0</a>
|
37
|
+
</div>
|
38
|
+
<h2>What</h2>
|
39
|
+
|
40
|
+
|
41
|
+
<p>This page will describe how to get started with a new application.</p>
|
42
|
+
|
43
|
+
|
44
|
+
<p>There are now generator options to give you more control over which templates you want to mix-in to your application:</p>
|
45
|
+
|
46
|
+
|
47
|
+
<ul>
|
48
|
+
<li>—all
|
49
|
+
<p> Install all Lockdown templates </p>
|
50
|
+
</li>
|
51
|
+
<li>—models
|
52
|
+
<p> Install only models and migrations (skip migrations by—no_migrations) </p>
|
53
|
+
</li>
|
54
|
+
<li>—management
|
55
|
+
<p> Install management functionality. Which is—all minus—login. All models (migrations) included.</p>
|
56
|
+
</li>
|
57
|
+
<li>—login
|
58
|
+
<p>Install login functionality. Which is—all minus—management. All models (migrations) included.</p>
|
59
|
+
</li>
|
60
|
+
<li>—no_migrations
|
61
|
+
<p>Skip migrations installation</p>
|
62
|
+
</li>
|
63
|
+
</ul>
|
64
|
+
|
65
|
+
<h2>Creating a new application</h2>
|
66
|
+
|
67
|
+
|
68
|
+
<pre>
|
69
|
+
$ rails demo_app
|
70
|
+
<snip output>
|
71
|
+
$ cd demo_app
|
72
|
+
$ lockdown .
|
73
|
+
------------------------------------------------------------
|
74
|
+
Installing Lockdown
|
75
|
+
create lib/lockdown
|
76
|
+
create lib/lockdown/session.rb
|
77
|
+
create lib/lockdown/init.rb
|
78
|
+
------------------------------------------------------------
|
79
|
+
|
80
|
+
------------------------------------------------------------
|
81
|
+
Modified config/environment.rb by adding:
|
82
|
+
require "lockdown/init"
|
83
|
+
------------------------------------------------------------
|
84
|
+
|
85
|
+
------------------------------------------------------------
|
86
|
+
You are now locked down. To open up access to your application
|
87
|
+
please modify lib/lockdown/init.rb. This is where you'll
|
88
|
+
add permissions and create user groups.
|
89
|
+
|
90
|
+
To modify the contents of your session and to add access
|
91
|
+
methods, modify lib/lockdown/session.rb.
|
92
|
+
|
93
|
+
If you want to know more, please visit:
|
94
|
+
|
95
|
+
http://lockdown.rubyforge.org
|
96
|
+
|
97
|
+
If you have any suggestions, comments or issues
|
98
|
+
please visit the Lockdown Google group:
|
99
|
+
|
100
|
+
http://groups.google.com/group/stonean_lockdown?hl=en
|
101
|
+
------------------------------------------------------------
|
102
|
+
</pre>
|
103
|
+
|
104
|
+
<p>Now it’s time to get the template…</p>
|
105
|
+
|
106
|
+
|
107
|
+
<pre>
|
108
|
+
$ ./script/generate lockdown --all
|
109
|
+
exists app/helpers
|
110
|
+
exists app/models
|
111
|
+
exists app/views
|
112
|
+
create app/views/users
|
113
|
+
create app/views/user_groups
|
114
|
+
create app/views/permissions
|
115
|
+
create app/views/sessions
|
116
|
+
exists app/controllers
|
117
|
+
create app/controllers/permissions_controller.rb
|
118
|
+
create app/controllers/users_controller.rb
|
119
|
+
create app/controllers/user_groups_controller.rb
|
120
|
+
create app/controllers/sessions_controller.rb
|
121
|
+
create app/models/permission.rb
|
122
|
+
create app/models/user.rb
|
123
|
+
create app/models/user_group.rb
|
124
|
+
create app/models/profile.rb
|
125
|
+
route map.resources :permissions
|
126
|
+
route map.resources :user_groups
|
127
|
+
route map.resources :users
|
128
|
+
route map.resources :sessions
|
129
|
+
create app/helpers/permissions_helper.rb
|
130
|
+
create app/helpers/users_helper.rb
|
131
|
+
create app/helpers/user_groups_helper.rb
|
132
|
+
create app/views/users/_data.html.erb
|
133
|
+
create app/views/users/_form.html.erb
|
134
|
+
create app/views/users/index.html.erb
|
135
|
+
create app/views/users/show.html.erb
|
136
|
+
create app/views/users/edit.html.erb
|
137
|
+
create app/views/users/new.html.erb
|
138
|
+
create app/views/users/_password.html.erb
|
139
|
+
create app/views/user_groups/_data.html.erb
|
140
|
+
create app/views/user_groups/_form.html.erb
|
141
|
+
create app/views/user_groups/index.html.erb
|
142
|
+
create app/views/user_groups/show.html.erb
|
143
|
+
create app/views/user_groups/edit.html.erb
|
144
|
+
create app/views/user_groups/new.html.erb
|
145
|
+
create app/views/permissions/_data.html.erb
|
146
|
+
create app/views/permissions/index.html.erb
|
147
|
+
create app/views/permissions/show.html.erb
|
148
|
+
create app/views/sessions/new.html.erb
|
149
|
+
create db/migrate
|
150
|
+
create db/migrate/001_create_profiles.rb
|
151
|
+
exists db/migrate
|
152
|
+
create db/migrate/002_create_users.rb
|
153
|
+
exists db/migrate
|
154
|
+
create db/migrate/003_create_user_groups.rb
|
155
|
+
exists db/migrate
|
156
|
+
create db/migrate/004_create_permissions.rb
|
157
|
+
exists db/migrate
|
158
|
+
create db/migrate/005_create_admin_user_and_user_group.rb
|
159
|
+
</pre>
|
160
|
+
|
161
|
+
<p>Run your migrations:</p>
|
162
|
+
|
163
|
+
|
164
|
+
<pre>
|
165
|
+
$ rake db:migrate --trace
|
166
|
+
</pre>
|
167
|
+
|
168
|
+
<p>Remove index.html</p>
|
169
|
+
|
170
|
+
|
171
|
+
<pre>
|
172
|
+
$ rm public/index.html
|
173
|
+
</pre>
|
174
|
+
|
175
|
+
<p>Start the app and then open up your browser to http://localhost:3000</p>
|
176
|
+
|
177
|
+
|
178
|
+
<pre>
|
179
|
+
$ ./script/server
|
180
|
+
</pre>
|
181
|
+
|
182
|
+
<p>You’ll see that the “lockdown—all” generator has added a default route to the login page.</p>
|
183
|
+
|
184
|
+
|
185
|
+
<p>Login using the basic admin account with credentials: admin/password</p>
|
186
|
+
|
187
|
+
|
188
|
+
<p>After you login (you’ll still be on the login page), go one of the following pages:</p>
|
189
|
+
|
190
|
+
|
191
|
+
<p>http://localhost:3000/users</p>
|
192
|
+
|
193
|
+
|
194
|
+
<p>http://localhost:3000/user_groups</p>
|
195
|
+
|
196
|
+
|
197
|
+
<p>There is a permissiosn page also available, but you don’t have any with the basic install. And since permissions cannot be created via the admin screens, this doesn’t have much value for you now.</p>
|
198
|
+
|
199
|
+
|
200
|
+
<p>http://localhost:3000/permissions</p>
|
201
|
+
|
202
|
+
|
203
|
+
<h2>Permissions</h2>
|
204
|
+
|
205
|
+
|
206
|
+
<p>Alright, so there’s not a lot to see on these basic screens but that’s only because there’s isn’t a lot to the system at the moment.</p>
|
207
|
+
|
208
|
+
|
209
|
+
<p>Now it’s time to look at lib/lockdown/init.rb. Open it in your favorite editor.</p>
|
210
|
+
|
211
|
+
|
212
|
+
<p>There’s some documentation with examples that will hopefully server for more than a reminder. Please read that documentation before continuing here.</p>
|
213
|
+
|
214
|
+
|
215
|
+
<p>...</p>
|
216
|
+
|
217
|
+
|
218
|
+
<p>I guess that wasn’t sufficient? If you don’t understand how to use init.rb, please post a question on the forum and I’ll address the issue there and then update init.rb.</p>
|
219
|
+
|
220
|
+
|
221
|
+
<p>For simplicity sake, I would like the documentation for init.rb contained within that file.</p>
|
222
|
+
|
223
|
+
|
224
|
+
<h2>Contact</h2>
|
225
|
+
|
226
|
+
|
227
|
+
<p>Comments and suggestions are welcome via the <a href="http://groups.google.com/group/stonean_lockdown?hl=en">forum</a></p>
|
228
|
+
<p class="coda">
|
229
|
+
22nd May 2008<br/>
|
230
|
+
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
231
|
+
</p>
|
232
|
+
</div>
|
233
|
+
<script type="text/javascript">
|
234
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
235
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
236
|
+
</script>
|
237
|
+
<script type="text/javascript">
|
238
|
+
var pageTracker = _gat._getTracker("UA-4189092-1");
|
239
|
+
pageTracker._initData();
|
240
|
+
pageTracker._trackPageview();
|
241
|
+
</script>
|
242
|
+
</body>
|
243
|
+
</html>
|
@@ -0,0 +1,174 @@
|
|
1
|
+
h1. <a href="http://lockdown.rubyforge.org">Lockdown</a>
|
2
|
+
|
3
|
+
h2. What
|
4
|
+
|
5
|
+
This page will describe how to get started with a new application.
|
6
|
+
|
7
|
+
There are now generator options to give you more control over which templates you want to mix-in to your application:
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<li> --all
|
11
|
+
<p> Install all Lockdown templates </p>
|
12
|
+
</li>
|
13
|
+
<li> --models
|
14
|
+
<p> Install only models and migrations (skip migrations by --no_migrations) </p>
|
15
|
+
</li>
|
16
|
+
<li> --management
|
17
|
+
<p> Install management functionality. Which is --all minus --login. All models (migrations) included.</p>
|
18
|
+
</li>
|
19
|
+
<li> --login
|
20
|
+
<p>Install login functionality. Which is --all minus --management. All models (migrations) included.</p>
|
21
|
+
</li>
|
22
|
+
<li> --no_migrations
|
23
|
+
<p>Skip migrations installation</p>
|
24
|
+
</li>
|
25
|
+
</ul>
|
26
|
+
|
27
|
+
h2. Creating a new application
|
28
|
+
|
29
|
+
|
30
|
+
<pre>
|
31
|
+
$ rails demo_app
|
32
|
+
<snip output>
|
33
|
+
$ cd demo_app
|
34
|
+
$ lockdown .
|
35
|
+
------------------------------------------------------------
|
36
|
+
Installing Lockdown
|
37
|
+
create lib/lockdown
|
38
|
+
create lib/lockdown/session.rb
|
39
|
+
create lib/lockdown/init.rb
|
40
|
+
------------------------------------------------------------
|
41
|
+
|
42
|
+
|
43
|
+
------------------------------------------------------------
|
44
|
+
Modified config/environment.rb by adding:
|
45
|
+
require "lockdown/init"
|
46
|
+
------------------------------------------------------------
|
47
|
+
|
48
|
+
|
49
|
+
------------------------------------------------------------
|
50
|
+
You are now locked down. To open up access to your application
|
51
|
+
please modify lib/lockdown/init.rb. This is where you'll
|
52
|
+
add permissions and create user groups.
|
53
|
+
|
54
|
+
To modify the contents of your session and to add access
|
55
|
+
methods, modify lib/lockdown/session.rb.
|
56
|
+
|
57
|
+
If you want to know more, please visit:
|
58
|
+
|
59
|
+
http://lockdown.rubyforge.org
|
60
|
+
|
61
|
+
If you have any suggestions, comments or issues
|
62
|
+
please visit the Lockdown Google group:
|
63
|
+
|
64
|
+
http://groups.google.com/group/stonean_lockdown?hl=en
|
65
|
+
------------------------------------------------------------
|
66
|
+
</pre>
|
67
|
+
|
68
|
+
Now it's time to get the template...
|
69
|
+
|
70
|
+
<pre>
|
71
|
+
$ ./script/generate lockdown --all
|
72
|
+
exists app/helpers
|
73
|
+
exists app/models
|
74
|
+
exists app/views
|
75
|
+
create app/views/users
|
76
|
+
create app/views/user_groups
|
77
|
+
create app/views/permissions
|
78
|
+
create app/views/sessions
|
79
|
+
exists app/controllers
|
80
|
+
create app/controllers/permissions_controller.rb
|
81
|
+
create app/controllers/users_controller.rb
|
82
|
+
create app/controllers/user_groups_controller.rb
|
83
|
+
create app/controllers/sessions_controller.rb
|
84
|
+
create app/models/permission.rb
|
85
|
+
create app/models/user.rb
|
86
|
+
create app/models/user_group.rb
|
87
|
+
create app/models/profile.rb
|
88
|
+
route map.resources :permissions
|
89
|
+
route map.resources :user_groups
|
90
|
+
route map.resources :users
|
91
|
+
route map.resources :sessions
|
92
|
+
create app/helpers/permissions_helper.rb
|
93
|
+
create app/helpers/users_helper.rb
|
94
|
+
create app/helpers/user_groups_helper.rb
|
95
|
+
create app/views/users/_data.html.erb
|
96
|
+
create app/views/users/_form.html.erb
|
97
|
+
create app/views/users/index.html.erb
|
98
|
+
create app/views/users/show.html.erb
|
99
|
+
create app/views/users/edit.html.erb
|
100
|
+
create app/views/users/new.html.erb
|
101
|
+
create app/views/users/_password.html.erb
|
102
|
+
create app/views/user_groups/_data.html.erb
|
103
|
+
create app/views/user_groups/_form.html.erb
|
104
|
+
create app/views/user_groups/index.html.erb
|
105
|
+
create app/views/user_groups/show.html.erb
|
106
|
+
create app/views/user_groups/edit.html.erb
|
107
|
+
create app/views/user_groups/new.html.erb
|
108
|
+
create app/views/permissions/_data.html.erb
|
109
|
+
create app/views/permissions/index.html.erb
|
110
|
+
create app/views/permissions/show.html.erb
|
111
|
+
create app/views/sessions/new.html.erb
|
112
|
+
create db/migrate
|
113
|
+
create db/migrate/001_create_profiles.rb
|
114
|
+
exists db/migrate
|
115
|
+
create db/migrate/002_create_users.rb
|
116
|
+
exists db/migrate
|
117
|
+
create db/migrate/003_create_user_groups.rb
|
118
|
+
exists db/migrate
|
119
|
+
create db/migrate/004_create_permissions.rb
|
120
|
+
exists db/migrate
|
121
|
+
create db/migrate/005_create_admin_user_and_user_group.rb
|
122
|
+
</pre>
|
123
|
+
|
124
|
+
Run your migrations:
|
125
|
+
|
126
|
+
<pre>
|
127
|
+
$ rake db:migrate --trace
|
128
|
+
</pre>
|
129
|
+
|
130
|
+
Remove index.html
|
131
|
+
|
132
|
+
<pre>
|
133
|
+
$ rm public/index.html
|
134
|
+
</pre>
|
135
|
+
|
136
|
+
Start the app and then open up your browser to http://localhost:3000
|
137
|
+
|
138
|
+
<pre>
|
139
|
+
$ ./script/server
|
140
|
+
</pre>
|
141
|
+
|
142
|
+
You'll see that the "lockdown --all" generator has added a default route to the login page.
|
143
|
+
|
144
|
+
Login using the basic admin account with credentials: admin/password
|
145
|
+
|
146
|
+
After you login (you'll still be on the login page), go one of the following pages:
|
147
|
+
|
148
|
+
http://localhost:3000/users
|
149
|
+
|
150
|
+
http://localhost:3000/user_groups
|
151
|
+
|
152
|
+
There is a permissiosn page also available, but you don't have any with the basic install. And since permissions cannot be created via the admin screens, this doesn't have much value for you now.
|
153
|
+
|
154
|
+
http://localhost:3000/permissions
|
155
|
+
|
156
|
+
|
157
|
+
h2. Permissions
|
158
|
+
|
159
|
+
Alright, so there's not a lot to see on these basic screens but that's only because there's isn't a lot to the system at the moment.
|
160
|
+
|
161
|
+
Now it's time to look at lib/lockdown/init.rb. Open it in your favorite editor.
|
162
|
+
|
163
|
+
There's some documentation with examples that will hopefully server for more than a reminder. Please read that documentation before continuing here.
|
164
|
+
|
165
|
+
...
|
166
|
+
|
167
|
+
I guess that wasn't sufficient? If you don't understand how to use init.rb, please post a question on the forum and I'll address the issue there and then update init.rb.
|
168
|
+
|
169
|
+
For simplicity sake, I would like the documentation for init.rb contained within that file.
|
170
|
+
|
171
|
+
h2. Contact
|
172
|
+
|
173
|
+
Comments and suggestions are welcome via the "forum":http://groups.google.com/group/stonean_lockdown?hl=en
|
174
|
+
|