razy
2007-Apr-02 07:50 UTC
acts_as_authenticated + authorization plugin = Can only render or redirect once per action ?
Hi all,
I''ve got a strange trouble with those plugins in subject.
Im new in rails and just trying to get some basic things working
before proceeding to something more complicated.
So here is the step-by-step descirption of what i did:
$ mysqladmin create auth_development
$ rails auth
$ ./script/plugin install
http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
$ ./script/plugin install http://svn.writertopia.com/svn/plugins/authorization
$ ./script/generate authenticated user account
$ ./script/generate role_model role
$ rake db:migrate
added following to my environment.rb:
AUTHORIZATION_MIXIN = "object roles"
DEFAULT_REDIRECTION_HASH = { :controller => ''account'',
:action =>
''login'' }
added those to my user model:
acts_as_authorized_user
acts_as_authorizable
and this to my account controller
def secure_info
permit "admin"
render :text => "you''re admin if you can read this."
end
def for_testers
permit "admin or tester"
render :text => "you''re admin or tester if you can read
this."
end
def for_noone
permit "noone"
render :text => "you shouldnt be able to read this."
end
def add_sample_roles
current_user.has_role "tester"
current_user.has_role "admin"
current_user.save!
redirect_to :index
end
$ ./script/server
(signed up as a new user, login, go to add_sample_roles)
now i can visit secure_info and for_testers okay, but when i try to
visit for_noone i didnt get the right error message like permission
denied but this one:
Can only render or redirect once per action
with this session dump:
---
:return_to:
:user: 1
flash: !map:ActionController::Flash::FlashHash
:notice: Permission denied. Your account cannot access the requested
page.
so how do i fix that?
hope i gave enough details on it
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
razy
2007-Apr-02 08:27 UTC
Re: acts_as_authenticated + authorization plugin = Can only render or redirect once per action ?
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:708:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/layout.rb:256:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:50:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:50:in `render'' app/controllers/account_controller.rb:56:in `for_someone'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:632:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:638:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:438:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:637:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:619:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/rescue.rb:83:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 78:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 76:in `synchronize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 76:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:271:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails: 127:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb: 211:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ mongrel.rb:60 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb: 39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---