blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

instructions for keeping proper temp bookmarks behavior in local app?

Open jrochkind opened this issue 11 years ago • 3 comments

In the Blacklight demo app, if I save some bookmarks without being logged in, and then later log in, my temporary bookmarks are properly merged into my persistent bookmarks associated with my account.

However, in my own local Blacklight app this isn't working, the temporary bookmarks get abandoned.

I suspect this may be because I don't use devise, but just a homegrown auth implementaiton using our local Shibboleth SSO, and I've probably overloaded some method where I need to call some 'move the bookmarks over' function or something.

But I'm not sure where to start looking, can anyone give me any hints? And is this maybe something that shoudl be documented at https://github.com/projectblacklight/blacklight/wiki/User-Authentication, what you need to do to make bookmarks work right?

jrochkind avatar Sep 19 '14 18:09 jrochkind

https://github.com/projectblacklight/blacklight/blob/1b0fd9f80efea73f5a4833e45092a5c10567a2b2/lib/blacklight/controller.rb#L31

cbeer avatar Sep 19 '14 23:09 cbeer

Thanks @cbeer! So I did a bit of reading on ActiveSupport::Callbacks, which is what's being used there.

Nowhere in BL calls the logging_in_user callback -- so this is something Devise does on it's own, a standard part of Devise?

And if you aren't using Devise, is the best way to get BL compatibility to simply run this callback yourself in your login method?

Which you'd do by simply calling run_callbacks :logging_in_user in your login method?

I see that there is after all some mention of the #transfer_guest_user_actions_to_current_user method in the wiki page, but it leaves me unsure of what to do with it, it doesn't actually mention callbacks.

Would it make sense for me to change the wiki page to simply instruct run_callbacks :logging_in_user to get transfer_guest_users as well as potentially any future BL behavior hung off of here?

Appreciate advice from anyone more familiar with BL's login system, Devise, and/or the intention of the BL architecture here. Thanks!

jrochkind avatar Sep 21 '14 16:09 jrochkind

Actually, the implementation of transfer_guest_user_actions_to_current_user requires there to be a #guest_user method as well as a #current_user method. Which I'm not sure if I have, even though temporary guest user bookmarks are working. So it may be that the method is being called in my app, but just not doing anything.

Definitely not clear to me what the intended design here is for integration of non-Devise Auth. I'll probably hack something out locally by copy-pasting-modifying the code from BL, to get guest bookmarks properly transferred again.

jrochkind avatar Sep 22 '14 15:09 jrochkind