[Rails] Re: acl_system help is needed

Josh Kieschnick
Sun, 16 Jul 2006 18:29:55 -0000

the users controller is just a scaffold i threw up to test the acl
plugin.

i added the following code to the controller:

before_filter :authorize

  access_control [ :index, :list, :show, :new, :create, :edit, :update,
:destroy ] => ''CSR''

and here is the authorize method in my applicatin.rb file:

  private
  def authorize
    unless User.find_by_id(session[:user_id])
      session[:original_uri] = request.request_uri
      flash[:notice] = ''Please log in''
      redirect_to :controller => ''login''
    end
  end


James Ludlow wrote:
> On 7/16/06, Josh Kieschnick <jjkiesch@gmail.com> wrote:
>>
>> i am pretty new to rails and still have trouble figuring out where
>> things go, so i''m pretty sure that my problem is that i
don''t have the
>> current_user method in the right place. or i might have just done
>> something else wrong too. i''m not sure, but if anyone can help
that
>> would be great.
>
> What is UsersController#index supposed to be doing?  Since acl_system
> doesn''t handle authentication, you need to give us some more info
on
> how you''re handling login/logout of users.
>
> -- James