Lockdown

Get Version

0.5.9

What

This page will describe how to get started with a new application.

There are now generator options to give you more control over which templates you want to mix-in to your application:

Creating a new application

$ rails demo_app
<snip output>
$ cd demo_app
$ lockdown .
------------------------------------------------------------
Installing Lockdown
      create  lib/lockdown
      create  lib/lockdown/session.rb
      create  lib/lockdown/init.rb
------------------------------------------------------------

------------------------------------------------------------
Modified config/environment.rb by adding:
    require "lockdown/init" 
------------------------------------------------------------

------------------------------------------------------------
You are now locked down.  To open up access to your application 
please modify lib/lockdown/init.rb.  This is where you'll 
add permissions and create user groups.

To modify the contents of your session and to add access 
methods, modify lib/lockdown/session.rb.

If you want to know more, please visit:

http://lockdown.rubyforge.org

If you have any suggestions, comments or issues 
please visit the Lockdown Google group:

http://groups.google.com/group/stonean_lockdown?hl=en
------------------------------------------------------------

Now it’s time to get the template…

$ ./script/generate lockdown --all
      exists  app/helpers
      exists  app/models
      exists  app/views
      create  app/views/users
      create  app/views/user_groups
      create  app/views/permissions
      create  app/views/sessions
      exists  app/controllers
      create  app/controllers/permissions_controller.rb
      create  app/controllers/users_controller.rb
      create  app/controllers/user_groups_controller.rb
      create  app/controllers/sessions_controller.rb
      create  app/models/permission.rb
      create  app/models/user.rb
      create  app/models/user_group.rb
      create  app/models/profile.rb
       route  map.resources :permissions
       route  map.resources :user_groups
       route  map.resources :users
       route  map.resources :sessions
      create  app/helpers/permissions_helper.rb
      create  app/helpers/users_helper.rb
      create  app/helpers/user_groups_helper.rb
      create  app/views/users/_data.html.erb
      create  app/views/users/_form.html.erb
      create  app/views/users/index.html.erb
      create  app/views/users/show.html.erb
      create  app/views/users/edit.html.erb
      create  app/views/users/new.html.erb
      create  app/views/users/_password.html.erb
      create  app/views/user_groups/_data.html.erb
      create  app/views/user_groups/_form.html.erb
      create  app/views/user_groups/index.html.erb
      create  app/views/user_groups/show.html.erb
      create  app/views/user_groups/edit.html.erb
      create  app/views/user_groups/new.html.erb
      create  app/views/permissions/_data.html.erb
      create  app/views/permissions/index.html.erb
      create  app/views/permissions/show.html.erb
      create  app/views/sessions/new.html.erb
      create  db/migrate
      create  db/migrate/001_create_profiles.rb
      exists  db/migrate
      create  db/migrate/002_create_users.rb
      exists  db/migrate
      create  db/migrate/003_create_user_groups.rb
      exists  db/migrate
      create  db/migrate/004_create_permissions.rb
      exists  db/migrate
      create  db/migrate/005_create_admin_user_and_user_group.rb

Run your migrations:

$ rake db:migrate --trace

Remove index.html

$ rm public/index.html

Start the app and then open up your browser to http://localhost:3000

$ ./script/server

You’ll see that the “lockdown—all” generator has added a default route to the login page.

Login using the basic admin account with credentials: admin/password

After you login (you’ll still be on the login page), go one of the following pages:

http://localhost:3000/users

http://localhost:3000/user_groups

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.

http://localhost:3000/permissions

Permissions

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.

Now it’s time to look at lib/lockdown/init.rb. Open it in your favorite editor.

There’s some documentation with examples that will hopefully server for more than a reminder. Please read that documentation before continuing here.

...

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.

For simplicity sake, I would like the documentation for init.rb contained within that file.

Github

The Clone URL: git://github.com/stonean/lockdown.git

Read the 8 steps for fixing other people’s code.

I’m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.

Contact

Please use the forum to ask questions and the issue tracker to report problems or submit a pull request.

License

This code is free to use under the terms of the MIT license.

Copyright© 2008 Andrew Stone

11th June 2008
Theme extended from Paul Battley