All pastes #26608 Raw Edit

Unnamed

public text v1 · immutable
#26608 ·published 2005-10-25 14:59 UTC
rendered paste body
== Module ==
# User authentication mixin for use with Rails controllers.
module UserAuthentication
  # Requires that a user is logged in.
  def authentication_required(options = {})
    before_filter :authentication_required_filter, options
  end
  
  # ...snip other methods.
end

== Controller ==
require_dependency "user_authentication"

class UsersController < ApplicationController
  include UserAuthentication

  authentication_required :except => "login"
  role_required :admin, :only => [ "edit", "update", "destroy" ]

  def index
    list
    render :action => 'list'
  end

  # ... snip other methods
end