Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move method for setting location provider from controller to api #10828

Merged
merged 3 commits into from Nov 8, 2016

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 2, 2016

Setting the used location provider is currently done in a controller action, which is called from the admin page.

Moving that method to the API has the advantage that the provider could be set without using the UI. And it will be possible to hook into the API call using the default API events like API.UserCountry.setLocationProvider.end to handle something that should be done after the location provider has changed. Might be useful for some plugins.

@sgiehl sgiehl added the Needs Review PRs that need a code review label Nov 2, 2016
@sgiehl sgiehl added this to the 3.0.0-b3 milestone Nov 2, 2016
LocationProvider::getAllProviders();
}

public function test_setLocationProvider()
Copy link
Member

Choose a reason for hiding this comment

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

I guess we need tests for:

  • user is not super user -> exception
  • provider is invalid -> exception
  • dieIfGeolocationAdminIsDisabled was removed but is needed -> when !UserCountry::isGeoLocationAdminEnabled() then we should not allow even super user to modify the provider (to maintain the config setting enable_geolocation_admin = 1 working as expected)

@mattab
Copy link
Member

mattab commented Nov 3, 2016

Good idea, just need to restore the dieIfGeolocationAdminIsDisabled feature and maybe few tests

@sgiehl
Copy link
Member Author

sgiehl commented Nov 3, 2016

Added the check for configuration and some more tests. Is it good to merge then?

@sgiehl sgiehl merged commit 9811cd1 into 3.x-dev Nov 8, 2016
@sgiehl sgiehl deleted the locationproviderapi branch November 8, 2016 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants