Coder Social home page Coder Social logo

Comments (12)

lipis avatar lipis commented on July 25, 2024

@topless, @gmist, @mdxs, @joernhees

I pushed the first approach for merging user accounts, any feedback or suggestions would be much appreciated!

There are not many comments or anything but I think it's pretty straight forward..

Some heads up:

  • The main goal was to simply merge the external auths so the same user would be able to sign in with multiple accounts
  • The reason that I'm not allowing to change the username is to keep things a bit simpler and not overcomplicate stuff, because it has to be unique.
  • At the moment you're not able to delete any external auth entity (but it will come as part of the user update and not merge)
  • There is no logic for merging more entities than the User because there are none in the core project, but there is a TODO that points it out
  • The user entities that are merged, at the moment being deleted forever.. (maybe they should be deactivated instead?!?)

from gae-init.

joernhees avatar joernhees commented on July 25, 2024

man, you're on fire ^^

if i get it correctly there's no way to specify "which" of the users remain...
I encountered this issue in my own code where after merging one needs to rewrite the possibly 1000s of posts/whatever referring to the deprecated user keys, so it might be useful to specify the remaining ("primary") user somehow. The choice of merged_user_db = user_dbs[0] is non deterministic. One could at least specify the older user, but then users might come along who want the exact opposite.

-- edit:
left a couple comments inline, might be that you can pass in the remaining user's user_key

from gae-init.

lipis avatar lipis commented on July 25, 2024

You can actually specify which user you want to remain.. That was one of my main requirements to do it nice and easy and finally I think I found a nice and easy way :) here is a screenshot of how it looks like..

You just have to choose which account you want to keep and the rest well be deleted (or maybe I'll change it to inactive in the future..)

screen shot 2014-01-19 at 22 44 12

from gae-init.

lipis avatar lipis commented on July 25, 2024

@joernhees I would suggest you just simply clone this project as is and run it locally yo see the merge in action :D It's quite nice actually..

from gae-init.

mdxs avatar mdxs commented on July 25, 2024

Thanks, I will have a look one of the next days.

Upfront I will say that I would prefer inactivating merged users. Ideally with some date/time stamp and reference to the "merged into" account, allowing additional processes to look for stuff and clean up. Thus might help address the issue @joernhees described above; for those actions that could take some time and/or would be better coded in another loop, perhaps triggered by some add-to-queue for merged accounts. Just a thought though.

from gae-init.

lipis avatar lipis commented on July 25, 2024

First of all, nobody should use the merge unless they went through the merge_user_dbs() function

@ndb.transactional(xg=True)

Which most likely if you have lots of data connected to a user this might a task queue either you want to actually delete them or simply deactivate..

There are some cons when deactivating the user as well though:

  • Do something about the username so it won' produce any conflict in the future (adding possibly an illegal character in the end)
  • Possibly the same thing with the email field as in normal apps you might want to implement custom login or verified emails and it makes sense to have them unique
  • Delete all the auth_ids entries

In both cases you'll have to deal with references to the deprecated users, so like I said in the beginning every developer should take care of that function before using it..

from gae-init.

topless avatar topless commented on July 25, 2024

+1 for inactive flag. Delete is irreversible, If the project is quite big, then there might be old dependencies or things that other people did which you cannot really predict. Inactive will save us some sweat if something goes the usually the fucked up way.

@joernhees, indeed but I think he is on crack not on fire :)

from gae-init.

lipis avatar lipis commented on July 25, 2024

So at the moment when merging the deprecated users they are becoming inactive, their auth_ids are deleted and added an illegal character to their username so it won't affect newly created users.

from gae-init.

lipis avatar lipis commented on July 25, 2024

With the release 0.11.0 I'm closing this one and from now on any comments regarding merge users could be created as separate issues..

https://github.com/gae-init/gae-init/releases

from gae-init.

mdxs avatar mdxs commented on July 25, 2024

Bit late, and only after a few runs; but I like the current flow a lot (that is: merging, and if happy deleting the inactive users). So thanks a lot!

from gae-init.

lipis avatar lipis commented on July 25, 2024

If you have dependencies while merging one approach is demonstrated in the gae-init-upload and more specifically just look for delete_user_task & move_resources_task in the https://github.com/gae-init/gae-init-upload/blob/master/main/user.py

from gae-init.

mdxs avatar mdxs commented on July 25, 2024

Excellent, will need to have a look at that later!

from gae-init.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.