lockdown 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +1 -2
- data/bin/lockdown +3 -1
- data/config/hoe.rb +1 -1
- data/lib/lockdown/classy-inheritance.rb +153 -0
- data/lib/lockdown/version.rb +1 -1
- data/rails_generators/lockdown/lockdown_generator.rb +12 -12
- data/rails_generators/lockdown/templates/app/controllers/user_groups_controller.rb +1 -1
- data/rails_generators/lockdown/templates/app/controllers/users_controller.rb +0 -5
- data/rails_generators/lockdown/templates/app/helpers/user_groups_helper.rb +3 -3
- data/rails_generators/lockdown/templates/app/helpers/users_helper.rb +12 -12
- data/rails_generators/lockdown/templates/app/models/user.rb +8 -11
- data/rails_generators/lockdown/templates/app/views/permissions/_data.html.erb +3 -3
- data/rails_generators/lockdown/templates/app/views/permissions/index.html.erb +4 -4
- data/rails_generators/lockdown/templates/app/views/permissions/show.html.erb +2 -2
- data/rails_generators/lockdown/templates/app/views/user_groups/_data.html.erb +29 -5
- data/rails_generators/lockdown/templates/app/views/user_groups/_form.html.erb +6 -6
- data/rails_generators/lockdown/templates/app/views/user_groups/edit.html.erb +3 -3
- data/rails_generators/lockdown/templates/app/views/user_groups/index.html.erb +7 -7
- data/rails_generators/lockdown/templates/app/views/user_groups/new.html.erb +2 -2
- data/rails_generators/lockdown/templates/app/views/user_groups/show.html.erb +5 -5
- data/rails_generators/lockdown/templates/app/views/users/_data.html.erb +34 -10
- data/rails_generators/lockdown/templates/app/views/users/_form.html.erb +7 -7
- data/rails_generators/lockdown/templates/app/views/users/edit.html.erb +3 -3
- data/rails_generators/lockdown/templates/app/views/users/index.html.erb +8 -8
- data/rails_generators/lockdown/templates/app/views/users/new.html.erb +2 -2
- data/rails_generators/lockdown/templates/app/views/users/show.html.erb +3 -3
- data/rails_generators/lockdown/templates/db/migrate/create_admin_user.rb +6 -8
- data/website/index.html +8 -264
- data/website/index.txt +6 -244
- metadata +5 -7
- data/website/generator.html +0 -264
- data/website/generator.txt +0 -188
data/website/index.txt
CHANGED
@@ -4,255 +4,17 @@ h2. What
|
|
4
4
|
|
5
5
|
Lockdown is a authentication/authorization system for RubyOnRails (ver 2.x). While Merb functionality is in place, it is not complete. There will be a release solely focused on getting the Merb functionality up to par with Rails.
|
6
6
|
|
7
|
-
h2.
|
7
|
+
h2. New Home
|
8
8
|
|
9
9
|
Maintaining this page, the wiki at GitHub, the Google Group and no issue tracker is not an ideal setup. So, everything is moving to "stonean.com":http://stonean.com where I'm giving "Redmine":http://redmine.org a shot a running everything for me. I'll be posting release announcements to the news feed for each project and keeping the docs up-to-date. Hopefully this will be better for everyone.
|
10
10
|
|
11
|
-
|
12
|
-
-andy
|
13
|
-
|
14
|
-
h2. Installing
|
15
|
-
|
16
|
-
<pre>
|
17
|
-
$ sudo gem install lockdown
|
18
|
-
$ cd <your_project_directory>
|
19
|
-
$ lockdown .
|
20
|
-
</pre>
|
21
|
-
|
22
|
-
This will create a "lockdown" directory in the lib dir add two files: init.rb and session.rb.
|
23
|
-
Modify init.rb to set configuration options and define the permissions and user groups that apply to your system.
|
24
|
-
|
25
|
-
<strong> Please keep the following in mind:</strong>
|
26
|
-
<ul>
|
27
|
-
<li><strong>All Permissions are defined in init.rb, they cannot be defined via the administration screens.</strong></li>
|
28
|
-
<li><strong>All User Groups should be defined in init.rb. The administration screens can be used to create user groups, but doing so should be reserved for the unexpected. Creating User Groups via the administration screens will only add more work for you if you want to run tests using those groups.</strong></li>
|
29
|
-
<li><strong>Lockdown will sync up the rules (Permissions and User Groups) defined in init.rb with your database. You can turn off this feature.</strong></li>
|
30
|
-
</ul>
|
31
|
-
|
32
|
-
To help you with your new application, Lockdown comes with a generator called lockdown that has various options for you to pick which templates you desire.
|
33
|
-
|
34
|
-
<pre>
|
35
|
-
$ cd <your_project_directory>
|
36
|
-
$ ./script/generate lockdown --all
|
37
|
-
</pre>
|
38
|
-
|
39
|
-
This will install resources such as:
|
40
|
-
<ul>
|
41
|
-
<li>Models</li>
|
42
|
-
<li>Controllers</li>
|
43
|
-
<li>Views</li>
|
44
|
-
<li>Helpers</li>
|
45
|
-
<li>Migrations</li>
|
46
|
-
<li>Routes</li>
|
47
|
-
</ul>
|
48
|
-
|
49
|
-
Please refer to the <a href="generator.html">generator page</a> for more detail.
|
50
|
-
|
51
|
-
h2. How it works
|
52
|
-
|
53
|
-
When Lockdown is installed, it adds the following line to your environment.rb (init.rb for Merb):
|
54
|
-
<pre>
|
55
|
-
require "lockdown/init"
|
56
|
-
</pre>
|
57
|
-
This is the default init.rb included with Lockdown:
|
58
|
-
<pre syntax="ruby">
|
59
|
-
require "lockdown"
|
60
|
-
require File.join(File.dirname(__FILE__), "session")
|
61
|
-
|
62
|
-
Lockdown::System.configure do
|
63
|
-
|
64
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
65
|
-
# Configuration Options
|
66
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
67
|
-
# Options with defaults:
|
68
|
-
#
|
69
|
-
# Set timeout to 1 hour:
|
70
|
-
# options[:session_timeout] = (60 * 60)
|
71
|
-
#
|
72
|
-
# Set system to logout if unauthorized access is attempted:
|
73
|
-
# options[:logout_on_access_violation] = false
|
74
|
-
#
|
75
|
-
# Set redirect to path on unauthorized access attempt:
|
76
|
-
# options[:access_denied_path] = "/"
|
77
|
-
#
|
78
|
-
# Set redirect to path on successful login:
|
79
|
-
# options[:successful_login_path] = "/"
|
80
|
-
#
|
81
|
-
# Set the system to sync the Permissions and UserGroups defined here
|
82
|
-
# with the database.
|
83
|
-
# options[:sync_init_rb_with_db] = true
|
84
|
-
#
|
85
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
86
|
-
# Define permissions
|
87
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
88
|
-
#
|
89
|
-
# set_permission(:product_management, all_methods(:products))
|
90
|
-
#
|
91
|
-
# :product_management is the name of the permission which is later
|
92
|
-
# referenced by the set_user_group method
|
93
|
-
#
|
94
|
-
# :all_methods(:products) will return an array of all controller actions
|
95
|
-
# for the products controller
|
96
|
-
#
|
97
|
-
# if products is your standard RESTful resource you'll get:
|
98
|
-
# ["products/index , "products/show",
|
99
|
-
# "products/new", "products/edit",
|
100
|
-
# "products/create", "products/update",
|
101
|
-
# "products/destroy"]
|
102
|
-
#
|
103
|
-
# You can pass multiple parameters to concat permissions such as:
|
104
|
-
#
|
105
|
-
# set_permission(:security_management,all_methods(:users),
|
106
|
-
# all_methods(:user_groups),
|
107
|
-
# all_methods(:permissions) )
|
108
|
-
#
|
109
|
-
# In addition to all_methods(:controller) there are:
|
110
|
-
#
|
111
|
-
# only_methods(:controller, :only_method_1, :only_method_2)
|
112
|
-
#
|
113
|
-
# all_except_methods(:controller, :except_method_1, :except_method_2)
|
114
|
-
#
|
115
|
-
# Some other sample permissions:
|
116
|
-
#
|
117
|
-
# set_permission(:sessions, all_methods(:sessions))
|
118
|
-
# set_permission(:my_account, only_methods(:users, :edit, :update, :show))
|
119
|
-
#
|
120
|
-
# Define your permissions here:
|
121
|
-
|
122
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
123
|
-
# Built-in user groups
|
124
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
125
|
-
# You can assign the above permission to one of the built-in user groups
|
126
|
-
# by using the following:
|
127
|
-
#
|
128
|
-
# To allow public access on the permissions :sessions and :home:
|
129
|
-
# set_public_access :sessions, :home
|
130
|
-
#
|
131
|
-
# Restrict :my_account access to only authenticated users:
|
132
|
-
# set_protected_access :my_account
|
133
|
-
#
|
134
|
-
# Define the built-in user groups here:
|
135
|
-
|
136
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
137
|
-
# Define user groups
|
138
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
139
|
-
#
|
140
|
-
# set_user_group(:catalog_management, :category_management,
|
141
|
-
# :product_management)
|
142
|
-
#
|
143
|
-
# :catalog_management is the name of the user group
|
144
|
-
# :category_management and :product_management refer to permission names
|
145
|
-
#
|
146
|
-
#
|
147
|
-
# Define your user groups here:
|
148
|
-
|
149
|
-
end
|
150
|
-
</pre>
|
151
|
-
|
152
|
-
As you can see, the first line requires lockdown. This will load the Lockdown system which consists of various parts:
|
153
|
-
<ul>
|
154
|
-
<li>
|
155
|
-
Controller<br/>
|
156
|
-
<p>The controller functionality will add before filters to test each request agains the defined access_rights for the current user. If the current request is not in the access_rights list, access right is denied.</p>
|
157
|
-
</li>
|
158
|
-
<li>
|
159
|
-
Model<br/>
|
160
|
-
<p>The model functionality will automatically set the updated_by/created_by fields of your model to the current_profile_id.</p>
|
161
|
-
</li>
|
162
|
-
<li>
|
163
|
-
View<br/>
|
164
|
-
<p>The view functionality intercepts the link_to method (aliases it). If the current user does not have rights to the link, the link will not show.<br/>There is also a link_to_or_show method (same params as link_to) that will print out just the name of the link (no anchor tag) if the current user does not have access. </p>
|
165
|
-
</li>
|
166
|
-
</ul>
|
11
|
+
h2. Quick links
|
167
12
|
|
168
|
-
|
169
|
-
<pre>
|
170
|
-
users/index
|
171
|
-
users/show
|
172
|
-
users/edit
|
173
|
-
users/update
|
174
|
-
users/new
|
175
|
-
users/create
|
176
|
-
users/destroy (delete for Merb)
|
177
|
-
</pre>
|
13
|
+
"Wiki":http://stonean.com/wiki/lockdown
|
178
14
|
|
15
|
+
"Forum":http://stonean.com/projects/lockdown/boards
|
179
16
|
|
180
|
-
h2. The internals
|
181
17
|
|
182
|
-
|
183
|
-
|
184
|
-
Lockdown doesn't have a concept of Roles. Instead, Lockdown users can be associated to one or many User Groups to allow for flexibility. In addition, you can use the admin screens to add new User Groups to the database. User groups are nothing more than a grouping mechanism for Permissions to ease management.
|
185
|
-
|
186
|
-
Here are the parts to Lockdown:
|
187
|
-
|
188
|
-
<div style="text-align:center">
|
189
|
-
!model.jpg!
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<ul>
|
193
|
-
<li><strong>Profiles</strong><br/>
|
194
|
-
<p>The profile model contains all non-user information related to person. Lockdown uses the profile record as the reference for updated_by and created_by. This allows you to remove the user record completely when you want to revoke access, but you still retain the foreign key for history.<br/>Here are the fields you have to start with:</p>
|
195
|
-
<ul>
|
196
|
-
<li>first_name : string</li>
|
197
|
-
<li>last_name : string</li>
|
198
|
-
<li>email : string</li>
|
199
|
-
</ul>
|
200
|
-
<br/>
|
201
|
-
</li>
|
202
|
-
<li><strong>Users</strong><br/>
|
203
|
-
<p>The user model contains all user information related to person.<br/>Here are the fields you have to start with:</p>
|
204
|
-
<ul>
|
205
|
-
<li>login : string</li>
|
206
|
-
<li>crypted_password : string</li>
|
207
|
-
<li>salt : string</li>
|
208
|
-
<li>profile_id : integer</li>
|
209
|
-
</ul>
|
210
|
-
<br/>
|
211
|
-
</li>
|
212
|
-
<li><strong>User Groups</strong><br/>
|
213
|
-
<p>User Groups exist only to group Permissions. All functionality for your site should be covered by the user groups you define in init.rb. You can use the admin screen to create new user groups if the need arises. The database model only has one field: </p>
|
214
|
-
<ul>
|
215
|
-
<li>name : string</li>
|
216
|
-
</ul>
|
217
|
-
<br/>
|
218
|
-
</li>
|
219
|
-
<li><strong>Permissions</strong><br/>
|
220
|
-
<p>Permissions are the security building blocks of your system and are defined in init.rb. A permission maps to controller(s)/action(s) in your system. Please refer back to the documenation in init.rb on how to create permissions.
|
221
|
-
As permissions relate to system functionality, they cannot be created via the admin screen. The database model only has one field: </p>
|
222
|
-
<ul>
|
223
|
-
<li>name : string</li>
|
224
|
-
</ul>
|
225
|
-
</li>
|
226
|
-
</ul>
|
227
|
-
|
228
|
-
h2. Roadmap to 1.0
|
229
|
-
|
230
|
-
<strong>**this is tentative and the feature order may change</strong>
|
231
|
-
|
232
|
-
<ul>
|
233
|
-
<li><strong>0.5.0: </strong>More generators to ease installation into existing projects</li>
|
234
|
-
<li><strong>0.6.0: </strong>Password reset/reminder, Registration page template generators</li>
|
235
|
-
<li><strong>0.7.0: </strong>OpenId support</li>
|
236
|
-
<li><strong>0.8.0: </strong>RSpec tests and helper methods for your application</li>
|
237
|
-
<li><strong>0.9.0: </strong>Merb Support</li>
|
238
|
-
<li><strong>1.0.0: </strong>Model level security</li>
|
239
|
-
</ul>
|
240
|
-
|
241
|
-
h2. Github
|
242
|
-
|
243
|
-
The Clone URL: git://github.com/stonean/lockdown.git
|
244
|
-
|
245
|
-
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
246
|
-
|
247
|
-
I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
|
248
|
-
|
249
|
-
h2. Contact
|
250
|
-
|
251
|
-
Please use the "forum":http://stonean.com/projects/lockdown/boards to ask questions and the "issue tracker":http://stonean.com/projects/lockdown/issues to report problems or submit a pull request.
|
252
|
-
|
253
|
-
h2. License
|
254
|
-
|
255
|
-
This code is free to use under the terms of the MIT license.
|
256
|
-
|
257
|
-
Copyright (c) 2008 Andrew Stone
|
18
|
+
Thanks for your interest in Lockdown,<br/>
|
19
|
+
-andy
|
258
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-24 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.2.4
|
23
23
|
version:
|
24
|
-
description: Authorization/Authentication system for RubyOnRails
|
24
|
+
description: Authorization/Authentication system for RubyOnRails
|
25
25
|
email:
|
26
26
|
- andrew.n.stone@gmail.com
|
27
27
|
executables:
|
@@ -34,7 +34,6 @@ extra_rdoc_files:
|
|
34
34
|
- Manifest.txt
|
35
35
|
- PostInstall.txt
|
36
36
|
- README.txt
|
37
|
-
- website/generator.txt
|
38
37
|
- website/index.txt
|
39
38
|
files:
|
40
39
|
- History.txt
|
@@ -52,6 +51,7 @@ files:
|
|
52
51
|
- config/hoe.rb
|
53
52
|
- config/requirements.rb
|
54
53
|
- lib/lockdown.rb
|
54
|
+
- lib/lockdown/classy-inheritance.rb
|
55
55
|
- lib/lockdown/controller.rb
|
56
56
|
- lib/lockdown/controller_inspector.rb
|
57
57
|
- lib/lockdown/helper.rb
|
@@ -107,8 +107,6 @@ files:
|
|
107
107
|
- test/test_lockdown_all_generator.rb
|
108
108
|
- test/test_lockdown_generator.rb
|
109
109
|
- test/test_lockdown_models_generator.rb
|
110
|
-
- website/generator.html
|
111
|
-
- website/generator.txt
|
112
110
|
- website/index.html
|
113
111
|
- website/index.txt
|
114
112
|
- website/javascripts/rounded_corners_lite.inc.js
|
@@ -144,7 +142,7 @@ rubyforge_project: lockdown
|
|
144
142
|
rubygems_version: 1.1.1
|
145
143
|
signing_key:
|
146
144
|
specification_version: 2
|
147
|
-
summary: Authorization/Authentication system for RubyOnRails
|
145
|
+
summary: Authorization/Authentication system for RubyOnRails
|
148
146
|
test_files:
|
149
147
|
- test/test_generator_helper.rb
|
150
148
|
- test/test_helper.rb
|
data/website/generator.html
DELETED
@@ -1,264 +0,0 @@
|
|
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.9</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>Github</h2>
|
225
|
-
|
226
|
-
|
227
|
-
<p>The Clone <span class="caps">URL</span>: git://github.com/stonean/lockdown.git</p>
|
228
|
-
|
229
|
-
|
230
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.</p>
|
231
|
-
|
232
|
-
|
233
|
-
<p>I’m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
|
234
|
-
|
235
|
-
|
236
|
-
<h2>Contact</h2>
|
237
|
-
|
238
|
-
|
239
|
-
<p>Please use the <a href="http://stonean.com/projects/lockdown/boards">forum</a> to ask questions and the <a href="http://stonean.com/projects/lockdown/issues">issue tracker</a> to report problems or submit a pull request.</p>
|
240
|
-
|
241
|
-
|
242
|
-
<h2>License</h2>
|
243
|
-
|
244
|
-
|
245
|
-
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
246
|
-
|
247
|
-
|
248
|
-
<p>Copyright© 2008 Andrew Stone</p>
|
249
|
-
<p class="coda">
|
250
|
-
11th June 2008<br/>
|
251
|
-
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
252
|
-
</p>
|
253
|
-
</div>
|
254
|
-
<script type="text/javascript">
|
255
|
-
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
256
|
-
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
257
|
-
</script>
|
258
|
-
<script type="text/javascript">
|
259
|
-
var pageTracker = _gat._getTracker("UA-4189092-1");
|
260
|
-
pageTracker._initData();
|
261
|
-
pageTracker._trackPageview();
|
262
|
-
</script>
|
263
|
-
</body>
|
264
|
-
</html>
|