[openstreetmap/openstreetmap-website] Adding users via script (appending Configure.md#managing-users) (#3136)
notifications at github.com
Wed Mar 17 11:41:22 UTC 2021
I was trying to create script for setting up local copy of the website and noticed that tutorial's (configure.md) user management chapter needed manual actions to be made via website and ruby console. That got me wondering if there's way to automate it, but luckily there's pull request #3030 which covers populating database. I understand why such PR can't be merged due to cybersecurity concerns, but i believe some code snippets featured there, namely user creation, are worth mentioning or at least linking in tutorial.
Suggesting to add following bash command as automated alternative to adding dev-server admin/moderator:
bundle exec rails runner 'admin = User.find_or_initialize_by(:email => "superadmin at osm.dev")
:email => "superadmin at osm.dev",
:email_valid => true,
:display_name => "My New User Name",
:description => "User description",
:home_lat => "52.5170365",
:home_lon => "13.3888599",
:status => "confirmed",
:terms_seen => true,
:terms_agreed => Time.now.getutc,
:data_public => true,
:pass_crypt => "Str0ng_P4sSword",
:pass_crypt_confirmation => "Str0ng_P4sSword",
admin.roles.create(:role => "administrator", :granter_id => admin.id )
admin.roles.create(:role => "moderator", :granter_id => admin.id)
PS. As a person, who has never used Ruby before, I think at some point user should be informed, that in order to access webpage from other devices, `-b 0.0.0.0` needs to be added to regular `bundle exec rails server` command. Figuring it out myself took me several hours of reading repo's code and stackoverflow. This is useful in scenario when someone sets up website on server OS, not desktop Linux.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rails-dev