Forum: Rails Engines Re: UserEngine Infinite Loop (Scott Walter)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2430658191284db51c0f9393fb9309e3?d=identicon&s=25 Rajesh GS (Guest)
on 2006-02-07 06:43
(Received via mailing list)
Hi

I also experienced the same issue yesterday. is it has anything to do
with store_location ?

Thanks
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-02-16 17:23
(Received via mailing list)
Things to do when you 'upgrade' from the login engine to the user
engine:

1. make SURE that you read the README properly. In particular, the
before_filter will change.
2. make sure that you've run the engine_migrate and bootstrap rake
tasks, so that you get the new tables and more importantly the
guest/default user permissions!
3. bear in mind that any users you have created will NOT automatically
be given roles, so they essentially will have no permissions at all.
You'll want to get creative solving that issue. A patch for the
UserEngine rakefile which 'upgrades' existing users by assigning them
all a particular Role will guarantee you a seat in Valhalla!
4. remove all sessions, just to be really clean about things.

In general, if you are finding that you get constantly redirected to
the login page in an infinite loop, it means that you don't have
permission to get to it. This is either because:

a) the Guest role that the UserEngine assumes for all non-logged-in
users doesn't exist or doesn't have the right permissions (there's a
handy UserEngine.check_system_roles method that can help you there)
b) the user that you are logged in as doesn't have any role which has
permission for the login action.

Either way, it basically means your Roles setup is s-k-rewed and you
need to check that you've followed all the steps. Again, a simple rake
task (rake upgrade_to_user_engine ??) might easily be written to take
care of all these issues. The Norse Gods will welcome anyone brave
enough to write this (or even create the Trac ticket such that I might
get around to it).

james

On 2/7/06, Rajesh GS <sabkaraja@hotmail.com> wrote:
>
>
> > trying to redirect to /user/login until Firefox decides to stop trying.
> > - -> /user/login
> _______________________________________________
> engine-users mailing list
> engine-users@lists.rails-engines.org
> http://lists.rails-engines.org/listinfo.cgi/engine...
>
>
>


--
* J *
  ~
A6cd05d51f0a40a56a1c235620ebdfec?d=identicon&s=25 Bart Masschelein (Guest)
on 2006-02-16 21:22
(Received via mailing list)
Hello,

I also had the same problem half an hour ago, when trying to add the
UserEngine to the RikiEngine. And I was quite confident that I did
everything correctly according to the README, as I saw the database
populated as it was supposed to. Here is what my problem was, and how I
solved it:

So, the problem was the same: The Infinite UserEngine Loop. When I
looked in the log file (they are quite useful, sometimes), I saw the
following:

Processing PagesController#login (for 127.0.0.1 at 2006-02-16 21:03:13)
[GET]
  Parameters: {"action"=>"login", "controller"=>"pages",
"book_url_name"=>"user"}
required_perm is pages/login
  Permission Load (0.000000)   SELECT DISTINCT permissions.*
FROM permissions, roles,
 permissions_roles
WHERE roles.name = 'Guest'
AND roles.id = permissions_roles.role_id
AND permissions_roles.permission_id = permissions.id
AND permissions.controller = 'pages'
AND permissions.action = 'login'

so the routing gets completely messed up, taking url/user/login, as the
name of a book. So by just adding the following:

map.connect  'user/login', :controller => 'user', :action => "login"

in the beginning of my routes.rb, I solved my problem.

Hope this is helpful,

Bart
A6cd05d51f0a40a56a1c235620ebdfec?d=identicon&s=25 Bart Masschelein (Guest)
on 2006-02-16 21:22
(Received via mailing list)
Hello again,

In fact, you will have to do this for all the user related routes, like
user/show/#, and user/edit_user/# etc, or it will get confused with the
other routes you might have. Maybe James could sum a list of all
possible routes for the UserEngine, and put it as an EXAMPLE_Routes.rb
in the distribution. Just like with the WikiEngine, and RikiEngine...

have fun,

Bart
A6cd05d51f0a40a56a1c235620ebdfec?d=identicon&s=25 Bart Masschelein (Guest)
on 2006-02-16 21:34
(Received via mailing list)
Oops, me again, sorry

Or what you also could write in routes.rb, to cover most (if not all?)
cases is \

  map.connect  'user/:action/:id', :controller => 'user'

Won't bother again ;-)

Bart
0d92743c7e40d526a804f2bac4ddb877?d=identicon&s=25 Ryan Tate (Guest)
on 2006-02-16 23:35
(Received via mailing list)
This infinite loop happened to me too. It's clearly a bug in the
engine. If you want to wall off people from /login by default, that's
fine, if strange. But then don't redirect them there if they don't
have permissions.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-02-17 01:00
(Received via mailing list)
In Bart's case it was because his routes were grabbing the url
parameters and not passing them to the appopriate controller, and his
last post describes an adequate fix. Engine or not, every controller
would have to be explicitly 'noted' in the routes file to avoid being
interprettetd as a 'book_url_name' parameter.

So - it's not really a bug in the engine. It's the fact that you have
a set of routes which supercedes the typical :controller/:action/:id
default in such a complete way that ANY controller needs to be handled
as a special case. Perhaps the Riki/Wiki engine route documentation
might be clearer about this, and I'm sure that patches to such
documentation will be greatly appreciated.

- james

On 2/16/06, Ryan Tate <lists@ryantate.com> wrote:
> This infinite loop happened to me too. It's clearly a bug in the
> engine. If you want to wall off people from /login by default, that's
> fine, if strange. But then don't redirect them there if they don't
> have permissions.
> _______________________________________________
> engine-users mailing list
> engine-users@lists.rails-engines.org
> http://lists.rails-engines.org/listinfo.cgi/engine...
>


--
* J *
  ~
This topic is locked and can not be replied to.