Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dancastellon
Copy link
Contributor

@dancastellon dancastellon commented Nov 27, 2018

Resolves #4794
Impact: major
Type: bugfix

Issue Description

OAuth IDP login pages created by the Hydra plugin are not showing up in the latest release candidate 6. So /account/login returns Not Found. Going back a few commits (e.g d37e12b2ea92), the page shows up fine.

Solution

Calling Reaction.addRolesToGroups() to add the "account/login" permission to guest & customer groups was the first step. This was called in an afterCoreInit event callback in the hydra-oauth core plugin (see @impactmass's original PR - https://github.com/reactioncommerce/reaction/pull/4795/files)

Even with that, it was taking 2 server restarts before the account/login view was working (not returning a 404). I traced this down to Migration 5 - which was deleting and recreating all groups. Because we now have a core createGroups function that does this before the migrations run, this migration is no longer needed.

Breaking changes

None

Testing

  1. Run reaction reset -n
  2. Startup Reaction via the platform and confirm you can login and signup through clicking the buttons in the starterkit
  3. Confirm you can still login as admin in Reaction and have correct permissions (update shop info, enable payment & shipping methods, etc)
  4. Confirm you can still checkout in Starterkit & Reaction

@dancastellon dancastellon changed the title Fix 4794 dancastellon dancastellon login route not found Fix: 404 on Hydra Oauth page Nov 27, 2018
@aldeed
Copy link
Contributor

aldeed commented Nov 28, 2018

Generally we never want to change a migration after it's been created. This may be a rare case when it's ok, but I'll have to give it some thought. If there's any way to just fix the migration to still do the same thing it was originally needed for, but without interfering with new groups, that would be preferable.

@impactmass
Copy link
Contributor

I share the same concern about not removing the migration. Flashing back, I see that the migration was added as a path for Reaction apps that existed before the introduction of Groups. I'll take a look now at how we can still keep that without the side effect we are currently getting

@impactmass
Copy link
Contributor

I find that: Migration 5 needs to be smarter. It currently assumes that every install it gets called on is coming from a pre-Groups version of Reaction. That is not always true (e.g in the case of this issue).

It needs to confirm that there are no correctly setup Groups, before it tries to run. @dancastellon we can sync on this.

@aldeed
Copy link
Contributor

aldeed commented Nov 28, 2018

This is partly a flaw with the current migration system. It should be possible to mark the current DB version while seeding it, so that migrations that are unnecessary don't run. However, we're replacing the migration system soon so if we can work around this flaw for now, that's the best solution.

@dancastellon
Copy link
Contributor Author

@aldeed - @impactmass and I discussed what to do to keep the migration, and he just pushed a fix. Can you take another look? Thanks!

aldeed
aldeed previously requested changes Nov 28, 2018
Copy link
Contributor

@aldeed aldeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good solution. Just one suggestion

Copy link
Contributor

@impactmass impactmass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aldeed I addressed your comment in the migration file.

I'm approving since I was listed as reviewer when it was created. Good by you to merge?

@spencern spencern merged commit 6dace5e into release-2.0.0-rc.7 Nov 29, 2018
@spencern spencern deleted the fix-4794-dancastellon-dancastellon-login-route-not-found branch November 29, 2018 23:56
@spencern
Copy link
Contributor

Merging on @impactmass approval and @aldeed's review with a single suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants