Forums » General Forum »
locked out entirelly
Added by macario ortega 172 days ago
Hi, I am very keen about lockdown, thanks!!.
Well, thing is I've added it to an application I am working with but I can't even login because no page is public, not even from sessions controller or index controller so I get a nasty loop: Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
I've added this to the init file so I would think sessions, noticias and index controllers are public.
set_permission :public_access, all_methods( :noticias ), all_methods( :index )
set_public_access :sessions_management, :public_access
Thanks again.
Replies
RE: locked out entirelly - Added by Andrew Stone 172 days ago
Hello marcario,
Can you post your entire init.rb file?
thanks,
andy
RE: locked out entirelly - Added by macario ortega 171 days ago
Yeah this is it I've added a permission and made it public (I think)
set_permission :sessions_management, all_methods(:sessions)
set_permission :users_management, all_methods(:admin__users)
set_permission :user_groups_management, all_methods(:admin__user_groups)
set_permission :permissions_management, all_methods(:admin__permissions)
set_permission :my_account, only_methods(:admin__users, :edit, :update, :show)
set_permission :public_access, all_methods( :noticias ), all_methods( :index )
set_public_access :sessions_management, :public_access
set_protected_access :my_account
With a new app works just fine but with the one I am working with it doesn't. I suspect it may have to do with my routes but my app was working prior to locking it down. I don't have the app at home so I'll have to wait until monday to try anything.
Thanks!
RE: locked out entirelly - Added by Andrew Stone 171 days ago
Please post your routes on Monday and I'll take a look as soon as possible.
Thanks,
andy
RE: locked out entirelly - Added by macario ortega 169 days ago
Hi Andrew. The problem got fixed I am not shure what did I do but now I don't get that loop.
I used the lockdown generator with a namespace called admin. I had two admin namespace mapping, one for lockdown and the other for the other stuff I under the admin namespace and the only thing I did today was to put all admin stuff on a single namespace mapping (do I make myself clear?), well perharps that worked. I can't say I have lockdown fully working with my app I have another problem I will post in another thread.
RE: locked out entirelly - Added by Srdjan Pejic 161 days ago
Hi Andrew,
I have the same problem, only I've generated lockdown in the default namespace. Here are my init.rb and routes.rb files:
Init.rboptions[:session_timeout] = (60 * 60) options[:logout_on_access_violation] = false options[:access_denied_path] = "/" options[:successful_login_path] = "/bugs" set_permission :sessions, all_methods(:sessions) #set_permission :sessions_management, all_methods(:sessions) set_permission :users_management, all_methods(:users) set_permission :user_groups_management, all_methods(:user_groups) set_permission :permissions_management, all_methods(:permissions) set_permission :my_account, only_methods(:users, :edit, :update, :show) set_permission :bugs, all_methods(:bugs) set_permission :projects, all_methods(:projects) set_public_access :sessions set_protected_access :my_account, :bugs, :projectsRoutes.rb:
map.resources :sessions
map.home '', :controller => 'sessions', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.resources :permissions
map.resources :user_groups
map.resources :users
map.resources :statuses
map.resources :companies
map.resources :projects do |project|
project.resources :bugs
end
map.resources :bugs
Thanks for any help
RE: locked out entirelly - Added by Andrew Stone 160 days ago
I don't see anything wrong with your config. So, before I drive myself crazy, lets try something. Start your app and go to http://localhost:3000/logout (assuming your using port 3000 and running it locally). Then try again.
If you had started your app and then modified your rules you need to logout to reset the cached access permissions in your session. Restarting your application doesn't do this for you.
Let me know if that works.
Thanks!,
andy
RE: locked out entirelly - Added by Srdjan Pejic 160 days ago
Thanks for that response, Andy, but it didn't work. I'm going to try re-migrating all of the lockdown-generated migrations and see if that helps. I'll let you know how it went.
RE: locked out entirelly - Added by Andrew Stone 160 days ago
Srdjan,
I'm sorry to hear that. If you get it figured out, please let me know what was wrong. I would like to see if there is something I could do to prevent this in the future.
If you can't get it figured out soon, could you post/attach your entire init.rb and routes.rb (for completeness sake)? I'll do what I can to help out.
thanks,
andy
RE: locked out entirelly - Added by Srdjan Pejic 160 days ago
Hi Andy,
I solved it. Unfortunately, I solved it by completely removing lockdown from my project and then re-installing it. I believe the problem in my case was that I started using an early version of lockdown (0.5.3, I think) and then kept updating it as it progressed through the development. There could have been too many mismatches in the application. So, re-installing it from scratch solved it.
BTW, I've noticed that the latest version is making edge Rails generate all kinds of Deprecation warnings. Also, rake RAILS_ENV=production db:migrate throws an exception. I'm posting the rake --trace below.
srdjan@loki-s2:/var/www/rails_apps/sarracenia/app$ rake RAILS_ENV=production db:migrate --trace (in /var/www/rails_apps/sarracenia/app) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! undefined method `depends_on' for #<Class:0xb709b9a8> /var/www/rails_apps/sarracenia/app/vendor/rails/activerecord/lib/active_record/base.rb:1695:in `method_missing' /var/www/rails_apps/sarracenia/app/app/models/user.rb:8 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:250:in `require_or_load' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:209:in `depend_on' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:129:in `require_dependency' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:353:in `load_application_classes' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:352:in `each' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:352:in `load_application_classes' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:351:in `each' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:351:in `load_application_classes' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:175:in `process' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:105:in `send' /var/www/rails_apps/sarracenia/app/config/../vendor/rails/railties/lib/initializer.rb:105:in `run' /var/www/rails_apps/sarracenia/app/config/environment.rb:13 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `new_constants_in' /var/www/rails_apps/sarracenia/app/vendor/rails/activesupport/lib/active_support/dependencies.rb:144:in `require' /var/www/rails_apps/sarracenia/app/vendor/rails/railties/lib/tasks/misc.rake:3 /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `send' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19
Hope this helps. Thank you for a wonderful system so far
RE: locked out entirelly - Added by Andrew Stone 157 days ago
Hey, just wanted to note that the depends_on call comes from the lockdown/classy-inheritance require. So if that's not in environment.rb you'll get this error.
RE: locked out entirelly - Added by Srdjan Pejic 153 days ago
Hey Andrew,
lockdown/classy-inheritance is in environment.rb, but the deprecation warnings still show up. I saw today that you've updated the gem. Could this solve the issue?
RE: locked out entirelly - Added by Andrew Stone 153 days ago
Hey Srdjan,
Sorry for the obvious questions here, but is the production environment you are testing on another machine? If so, have you installed the lockdown gem on that machine?
thanks,
andy
RE: locked out entirelly - Added by Srdjan Pejic 153 days ago
Actually, it throws the deprecation notices in the development environment on my machine. I haven't deployed it to production, yet. And, please, ask obvious questions as I may have left out important details.
RE: locked out entirelly - Added by Andrew Stone 153 days ago
Which version of rails are you using?
RE: locked out entirelly - Added by Srdjan Pejic 153 days ago
I'm using edge Rails, straight off of github.
RE: locked out entirelly - Added by Andrew Stone 153 days ago
I'm sorry Srdjan, I don't have the time to keep up with the changing features in edge. I recommend using 2.1. If there is an issue with Lockdown when the next release comes out (and it sounds like there will be) I will address that at release time.
thanks,
andy
RE: locked out entirelly - Added by Srdjan Pejic 153 days ago
No problem, man. Thanks for the help. Will let you know if there are problems and what they are.