This plugin/engine provides:
-
Authentication based on restful_authentication (github.com/technoweenie/restful-authentication)
-
Very simple authorization by role
-
Management of shared lab groups and users in the parent application’s database.
It is an alternative to SLIMcore Authorizer (github.com/systemsbiology/slimcore_authorizer), which allows for single sign-on capabilities between applications via RubyCAS-server, and shared users and lab groups using SLIMcore (github.com/systemsbiology/slimcore).
Note: This was built for Rails 2.3.2 apps, so other versions may require some tinkering.
Install Rails Engines, by running this in your app root:
script/plugin install git://github.com/lazyatom/engines.git
Then add this to your config/environment.rb as directed by the Engines instructions:
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
Install SLIMsolo Authorizer:
script/plugin install git://github.com/systemsbiology/slimsolo_authorizer.git script/generate slimsolo_authorizer . rake db:migrate
Then add this to your app/controllers/application_controller.rb:
include AuthenticatedSystem include Authorization
Copy config/application.yml.example to application.yml, but it’s not necessary to configure the rubycas and slimcore settings since these won’t be used with slimsolo_authorizer.
Edit your application layout (typically app/views/layout/application.html.erb) to include the following in the <head></head> section:
<%= stylesheet_link_tag 'tinytable.css' %> <%= javascript_include_tag 'tinytable-packed' %>
Run:
script/server
And you should be able to navigate to localhost:3000/users and localhost:3000/lab_groups to manage users and lab groups.
Authenticate on your own controllers by adding:
before_filter :login_required
Check authorization in controllers using:
before_filter :staff_or_admin_required # staff or admin access
or
before_filter :admin_required # admin-only
Link to the user and lab group management interfaces from your app like:
<%= link_to 'Users', users_path %> <%= link_to 'Lab Groups', lab_groups_path %>
Add the following link wherever it would be appropriate to have a link to log out:
<%= link_to "logout", :controller => 'sessions', :action => 'destroy' %>
In order to allow application-specific user and lab group data, SLIMsolo Authorizer adds two models to your application, UserProfile and LabGroupProfile. Each UserProfile and LabGroupProfile references a User or LabGroup, respectively.
Copyright © 2009 Institute for Systems Biology