diff --git a/README.md b/README.md index 597ae17..e47a09f 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ > > cp config/database_example.yml config/database.yml > > cp config/secrets_example.yml config/secrets.yml +* Make copies of the example gem initializer files and update the values for your installation + +> > cp config/initializers/devise.rb.example config/initializers/devise.rb +> > cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb +> > cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb + * Create an environment variable for your instance's secret (as defined in config/secrets.yml). You should use the following command to generate secrets for each of your environments, storing the production one in the environment variable: > > rake secret @@ -58,11 +64,7 @@ > > rake db:migrate -> > rake db:seed - -* Setup the devise authentication gem - -> > rails generate devise:install (Is this really necessary?) +> > rake db:seed (Unless you are migrating data from an old DMPOnline system) * Start the application @@ -71,6 +73,10 @@ * Verify that the site is running properly by going to http://localhost:3000 * Login as the default administrator: 'super_admin@example.com' - 'password1' +#### Migrating data from a running instance of DMPOnline_v4 into DMPRoadmap + +TODO: Add instructions on exporting data from the old DB and migrating it into the Roadmap DB + #### Troubleshooting ##### Installation - OSX: @@ -88,6 +94,12 @@ > > bundle install +##### Post Installation Issues + +I installed the system and migrated my legacy DMPOnline data into the database but none of my users are able to login! + +This happens when the 'pepper' key defined in config/initializers/devise.rb does not match the one on your old server. Simply update the pepper and restart the application. + #### Support Issues should be reported here on [Github Issues](https://github.com/DMPRoadmap/roadmap/issues) Please be advised though that we can only provide limited support for your local installations. diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 27ebbd2..8f88c81 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -6,6 +6,26 @@ @identifier_schemes = IdentifierScheme.order(:name) end + # GET /resource + def new + oauth = session["devise.#{scheme.name.downcase}_data"] + @user = User.new + + unless oauth.nil? + # The OAuth provider could not be determined or there was no unique UID! + if oauth.provider.nil? || oauth.uid.nil? + flash[:notice] = t('new_login_failure') + + else + # Connect the new user with the identifier sent back by the OAuth provider + flash[:notice] = t('new_login_success') + UserIdentifier.create(identifier_scheme: oauth.provider.upcase, + identifier: oauth.uid, + user: @user) + end + end + end + # POST /resource def create logger.debug "#{sign_up_params}" diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 74a9b8c..03c5f13 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -24,10 +24,9 @@ # If the user isn't logged in if current_user.nil? - session["devise.#{scheme.name.downcase}_data"] = request.env["omniauth.auth"] - # If the uid didn't have a match in the system send them to register - if user.email.nil? + if user.nil? + session["devise.#{scheme.name.downcase}_data"] = request.env["omniauth.auth"] redirect_to new_user_registration_url # Otherwise sign them in @@ -36,10 +35,10 @@ set_flash_message(:notice, :success, kind: scheme.name) if is_navigational_format? end - # The user is just registering the uid with us + # The user is already logged in and just registering the uid with us else # If the user could not be found by that uid then attach it to their record - if user.email.nil? || user.email.empty? + if user.nil? if UserIdentifier.create(identifier_scheme: scheme, identifier: request.env["omniauth.auth"].uid, user: current_user) @@ -50,6 +49,7 @@ end end + # Redirect to the User Profile page redirect_to edit_user_registration_path end end diff --git a/app/models/user.rb b/app/models/user.rb index 9a76d53..d95f629 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,8 +2,15 @@ include GlobalHelpers # Collect all the available Omniauth Schemes - omniauth_schemes = IdentifierScheme.all.collect{ |scheme| scheme.name.downcase.to_sym } - + # First check for existence of IdentifierSchemes underlying table. Rake will + # attempt to compile this code during the DB migrations because it is a scope + # used by devise in the config/routes.rb file + if ActiveRecord::Base.connection.table_exists?('identifier_schemes') + omniauth_schemes = IdentifierScheme.all.collect{ |scheme| scheme.name.downcase.to_sym } + else + omniauth_schemes = [] + end + # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable @@ -286,7 +293,7 @@ throw Exception.new('Unknown OAuth provider: ' + auth.provider) else joins(:user_identifiers).where('user_identifiers.identifier': auth.uid, - 'user_identifiers.identifier_scheme_id': scheme.id).first_or_create + 'user_identifiers.identifier_scheme_id': scheme.id).first end end diff --git a/app/views/devise/registrations/_external_identifier.html.erb b/app/views/devise/registrations/_external_identifier.html.erb index 38533d4..199f4f8 100644 --- a/app/views/devise/registrations/_external_identifier.html.erb +++ b/app/views/devise/registrations/_external_identifier.html.erb @@ -9,15 +9,16 @@ Rails.application.routes.url_helpers.send( "user_#{scheme.name.downcase}_omniauth_authorize_path" ), - title: t("identifier_schemes.#{scheme.name}.tooltip") %> + title: t("identifier_schemes.#{scheme.name}.connect_tooltip") %> <% else %> <% uri = "#{scheme.landing_page_uri.gsub(/\{id\}/, id.identifier)}" %> <%= link_to uri, uri, target: '_blank', - title: t("identifier_schemes.#{scheme.name}.tooltip") %> + title: t("identifier_schemes.#{scheme.name}.connect_tooltip") %> - <%= link_to '', destroy_user_identifier_path(id), method: :delete, - title: t("identifier_schemes.#{scheme.name}.disconnect"), - class: 'remove' %> + <%= link_to image_tag('remove.png', height: '16px', width: '16px'), + destroy_user_identifier_path(id), method: :delete, + title: t("identifier_schemes.#{scheme.name}.disconnect_tooltip"), + data: {confirm: t("identifier_schemes.#{scheme.name}.disconnect_confirmation")} %> <% end %> diff --git a/config/locales/de.yml b/config/locales/de.yml index 1a6e157..9d3f9fe 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -865,11 +865,14 @@ connect_failure: 'Wir konnten nicht auf Ihr Konto %{scheme} verbinden' disconnect_success: 'Ihr Konto wurde von %{scheme} getrennt' disconnect_failure: 'Wir waren nicht in der Lage, Ihr Konto zu trennen von %{scheme}' + new_login_success: 'Sie haben nicht Setup ein Konto bei uns. Bitte füllen Sie das folgende Informationen, um Ihre Registrierung abzuschließen.' + new_login_failure: 'Wir waren nicht in der Lage, Ihr Konto zu überprüfen. Bitte benutzen Sie das folgende Formular ein neues Konto zu erstellen. Sie können danach Ihr neues Konto zu verknüpfen.' ORCID: logo: 'http://orcid.org/sites/default/files/images/orcid_16x16.png' connect: 'Erstellen oder Verbinden Sie Ihren ORCID ID' - disconnect: 'Trennen Sie Ihren ORCID ID' - tooltip: 'ORCID bietet eine persistente digitale Kennung, die Sie von anderen Forschern unterscheidet. Erfahren Sie mehr unter orcid.org' + connect_tooltip: 'ORCID bietet eine persistente digitale Kennung, die Sie von anderen Forschern unterscheidet. Erfahren Sie mehr unter orcid.org' + disconnect_tooltip: 'Trennen Sie Ihren ORCID ID' + disconnect_confirmation: 'Sind Sie sicher, dass Sie Ihre ORCID ID trennen möchten?' magic_strings: organisation_types: diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml index c04a9ec..08abb7d 100644 --- a/config/locales/en-UK.yml +++ b/config/locales/en-UK.yml @@ -961,11 +961,14 @@ connect_failure: 'We could not connect your account to %{scheme}' disconnect_success: 'Your account has been disconnected from %{scheme}' disconnect_failure: 'We were unable to disconnect your account from %{scheme}' + new_login_success: 'It does not look like you have setup an account with us yet. Please fill in the following information to complete your registration.' + new_login_failure: 'We were unable to verify your account. Please use the following form to create a new account. You will be able to link your new account afterward.' ORCID: logo: 'http://orcid.org/sites/default/files/images/orcid_16x16.png' connect: 'Create or Connect your ORCID ID' - disconnect: 'Disconnect your ORCID ID' - tooltip: 'ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org' + connect_tooltip: 'ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org' + disconnect_tooltip: 'Disconnect your ORCID ID' + disconnect_confirmation: 'Are you sure you want to disconnect your ORCID ID?' magic_strings: organisation_types: diff --git a/config/locales/en-US.yml b/config/locales/en-US.yml index 0b6cda4..5d3d8ea 100644 --- a/config/locales/en-US.yml +++ b/config/locales/en-US.yml @@ -951,11 +951,14 @@ connect_failure: 'We could not connect your account to %{scheme}' disconnect_success: 'Your account has been disconnected from %{scheme}' disconnect_failure: 'We were unable to disconnect your account from %{scheme}' + new_login_success: 'It does not look like you have setup an account with us yet. Please fill in the following information to complete your registration.' + new_login_failure: 'We were unable to verify your account. Please use the following form to create a new account. You will be able to link your new account afterward.' ORCID: logo: 'http://orcid.org/sites/default/files/images/orcid_16x16.png' connect: 'Create or Connect your ORCID ID' - disconnect: 'Disconnect your ORCID ID' - tooltip: 'ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org' + connect_tooltip: 'ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org' + disconnect_tooltip: 'Disconnect your ORCID ID' + disconnect_confirmation: 'Are you sure you want to disconnect your ORCID ID?' magic_strings: organisation_types: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e9e108c..d6f49e3 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -849,12 +849,14 @@ connect_failure: 'Nous ne pouvions pas connecter votre compte %{scheme}' disconnect_success: 'Votre compte a été déconnecté de %{scheme}' disconnect_failure: 'Nous avons été incapables de déconnecter votre compte %{scheme}' + new_login_success: 'Vous ne l'avez pas configurer un compte avec nous. S'il vous plaît remplir les informations ci-dessous pour terminer votre inscription.' + new_login_failure: 'Nous avons été en mesure de vérifier votre compte. S'il vous plaît utiliser le formulaire ci-dessous pour créer un nouveau compte. Vous serez en mesure de lier votre nouveau compte par la suite.' ORCID: logo: 'http://orcid.org/sites/default/files/images/orcid_16x16.png' - tooltip: 'ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org' connect: 'Créer ou Connectez votre ID ORCID' - disconnect: 'Déconnectez votre ID ORCID' - tooltip: 'ORCID fournit un identifiant numérique persistant qui vous distingue des autres chercheurs. En savoir plus sur orcid.org' + connect_tooltip: 'ORCID fournit un identifiant numérique persistant qui vous distingue des autres chercheurs. En savoir plus sur orcid.org' + disconnect_tooltip: 'Déconnectez votre ID ORCID' + disconnect_confirmation: 'Etes-vous sûr que vous voulez déconnecter votre ID ORCID?' magic_strings: organisation_types: diff --git a/db/migrate/20161104161345_remove_logo_from_identifier_schemes.rb b/db/migrate/20161104161345_remove_logo_from_identifier_schemes.rb new file mode 100644 index 0000000..f7b27bf --- /dev/null +++ b/db/migrate/20161104161345_remove_logo_from_identifier_schemes.rb @@ -0,0 +1,5 @@ +class RemoveLogoFromIdentifierSchemes < ActiveRecord::Migration + def change + remove_column :identifier_schemes, :logo + end +end diff --git a/db/schema.rb b/db/schema.rb index e275c51..d0c8124 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,95 +11,95 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161102221313) do +ActiveRecord::Schema.define(version: 20161104161345) do create_table "answers", force: :cascade do |t| - t.text "text" - t.integer "plan_id" - t.integer "user_id" - t.integer "question_id" + t.text "text", limit: 65535 + t.integer "plan_id", limit: 4 + t.integer "user_id", limit: 4 + t.integer "question_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end create_table "answers_options", id: false, force: :cascade do |t| - t.integer "answer_id", null: false - t.integer "option_id", null: false + t.integer "answer_id", limit: 4, null: false + t.integer "option_id", limit: 4, null: false end - add_index "answers_options", ["answer_id", "option_id"], name: "index_answers_options_on_answer_id_and_option_id" + add_index "answers_options", ["answer_id", "option_id"], name: "index_answers_options_on_answer_id_and_option_id", using: :btree create_table "comments", force: :cascade do |t| - t.integer "user_id" - t.integer "question_id" - t.text "text" + t.integer "user_id", limit: 4 + t.integer "question_id", limit: 4 + t.text "text", limit: 65535 t.datetime "created_at" t.datetime "updated_at" t.boolean "archived" - t.integer "plan_id" - t.integer "archived_by" + t.integer "plan_id", limit: 4 + t.integer "archived_by", limit: 4 end create_table "dmptemplates", force: :cascade do |t| - t.string "title" - t.text "description" + t.string "title", limit: 255 + t.text "description", limit: 65535 t.boolean "published" - t.integer "user_id" - t.integer "organisation_id" + t.integer "user_id", limit: 4 + t.integer "organisation_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "locale" + t.string "locale", limit: 255 t.boolean "is_default" end create_table "dmptemplates_guidance_groups", id: false, force: :cascade do |t| - t.integer "dmptemplate_id" - t.integer "guidance_group_id" + t.integer "dmptemplate_id", limit: 4 + t.integer "guidance_group_id", limit: 4 end create_table "exported_plans", force: :cascade do |t| - t.integer "plan_id" - t.integer "user_id" - t.string "format" + t.integer "plan_id", limit: 4 + t.integer "user_id", limit: 4 + t.string "format", limit: 255 t.datetime "created_at" t.datetime "updated_at" end create_table "file_types", force: :cascade do |t| - t.string "name" - t.string "icon_name" - t.integer "icon_size" - t.string "icon_location" + t.string "name", limit: 255 + t.string "icon_name", limit: 255 + t.integer "icon_size", limit: 4 + t.string "icon_location", limit: 255 t.datetime "created_at" t.datetime "updated_at" end create_table "file_uploads", force: :cascade do |t| - t.string "name" - t.string "title" - t.text "description" - t.integer "size" + t.string "name", limit: 255 + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "size", limit: 4 t.boolean "published" - t.string "location" - t.integer "file_type_id" + t.string "location", limit: 255 + t.integer "file_type_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false + t.string "slug", limit: 191, null: false + t.integer "sluggable_id", limit: 4, null: false t.string "sluggable_type", limit: 40 t.datetime "created_at" end - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true, using: :btree + add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree + add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree create_table "guidance_groups", force: :cascade do |t| - t.string "name" - t.integer "organisation_id" + t.string "name", limit: 255 + t.integer "organisation_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.boolean "optional_subset" @@ -107,111 +107,108 @@ end create_table "guidance_in_group", id: false, force: :cascade do |t| - t.integer "guidance_id", null: false - t.integer "guidance_group_id", null: false + t.integer "guidance_id", limit: 4, null: false + t.integer "guidance_group_id", limit: 4, null: false end - add_index "guidance_in_group", ["guidance_id", "guidance_group_id"], name: "index_guidance_in_group_on_guidance_id_and_guidance_group_id" + add_index "guidance_in_group", ["guidance_id", "guidance_group_id"], name: "index_guidance_in_group_on_guidance_id_and_guidance_group_id", using: :btree create_table "guidances", force: :cascade do |t| t.text "text", limit: 65535 t.integer "guidance_group_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "question_id", limit: 4 t.boolean "published" end create_table "identifier_schemes", force: :cascade do |t| - t.string "name", limit: 255 - t.string "logo", limit: 255 - t.string "api_key", limit: 255 - t.string "api_secret", limit: 255 - t.string "authorization_uri", limit: 255 - t.string "landing_page_uri", limit: 255 - t.string "params", limit: 255 + t.string "name", limit: 255 + t.string "api_key", limit: 255 + t.string "api_secret", limit: 255 + t.string "landing_page_uri", limit: 255 + t.string "params", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.integer "question_id" - t.boolean "published" end create_table "languages", force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" + t.string "abbreviation", limit: 255 + t.string "description", limit: 255 + t.string "name", limit: 255 t.boolean "default_language" end create_table "option_warnings", force: :cascade do |t| - t.integer "organisation_id" - t.integer "option_id" - t.text "text" + t.integer "organisation_id", limit: 4 + t.integer "option_id", limit: 4 + t.text "text", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "options", force: :cascade do |t| - t.integer "question_id" - t.string "text" - t.integer "number" + t.integer "question_id", limit: 4 + t.string "text", limit: 255 + t.integer "number", limit: 4 t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" end create_table "org_token_permissions", force: :cascade do |t| - t.integer "organisation_id" - t.integer "token_permission_type_id" + t.integer "organisation_id", limit: 4 + t.integer "token_permission_type_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end create_table "organisation_types", force: :cascade do |t| - t.string "name" - t.text "description" + t.string "name", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "organisations", force: :cascade do |t| - t.string "name" - t.string "abbreviation" - t.string "target_url" - t.integer "organisation_type_id" - t.string "domain" - t.string "wayfless_entity" - t.integer "stylesheet_file_id" + t.string "name", limit: 255 + t.string "abbreviation", limit: 255 + t.string "target_url", limit: 255 + t.integer "organisation_type_id", limit: 4 + t.string "domain", limit: 255 + t.string "wayfless_entity", limit: 255 + t.integer "stylesheet_file_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "parent_id" + t.integer "parent_id", limit: 4 t.boolean "is_other" - t.string "sort_name" - t.text "banner_text" - t.integer "region_id" - t.integer "language_id" - t.string "logo_uid" - t.string "logo_name" - t.string "contact_email" + t.string "sort_name", limit: 255 + t.text "banner_text", limit: 65535 + t.string "logo_file_name", limit: 255 + t.integer "region_id", limit: 4 + t.integer "language_id", limit: 4 + t.string "logo_uid", limit: 255 + t.string "logo_name", limit: 255 + t.string "contact_email", limit: 255 end create_table "phases", force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" - t.integer "dmptemplate_id" + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "number", limit: 4 + t.integer "dmptemplate_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "slug" + t.string "slug", limit: 191 end - add_index "phases", ["dmptemplate_id"], name: "index_phases_on_dmptemplate_id" - add_index "phases", ["slug"], name: "index_phases_on_slug", unique: true + add_index "phases", ["dmptemplate_id"], name: "index_phases_on_dmptemplate_id", using: :btree + add_index "phases", ["slug"], name: "index_phases_on_slug", unique: true, using: :btree create_table "plan_sections", force: :cascade do |t| - t.integer "user_id" - t.integer "section_id" - t.integer "plan_id" + t.integer "user_id", limit: 4 + t.integer "section_id", limit: 4 + t.integer "plan_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.datetime "release_time" @@ -219,8 +216,8 @@ create_table "plans", force: :cascade do |t| t.boolean "locked" - t.integer "project_id" - t.integer "version_id" + t.integer "project_id", limit: 4 + t.integer "version_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end @@ -228,219 +225,239 @@ create_table "project_groups", force: :cascade do |t| t.boolean "project_creator" t.boolean "project_editor" - t.integer "user_id" - t.integer "project_id" + t.integer "user_id", limit: 4 + t.integer "project_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.boolean "project_administrator" end create_table "project_guidance", id: false, force: :cascade do |t| - t.integer "project_id", null: false - t.integer "guidance_group_id", null: false + t.integer "project_id", limit: 4, null: false + t.integer "guidance_group_id", limit: 4, null: false end - add_index "project_guidance", ["project_id", "guidance_group_id"], name: "index_project_guidance_on_project_id_and_guidance_group_id" + add_index "project_guidance", ["project_id", "guidance_group_id"], name: "index_project_guidance_on_project_id_and_guidance_group_id", using: :btree create_table "projects", force: :cascade do |t| - t.string "title" - t.integer "dmptemplate_id" + t.string "title", limit: 255 + t.integer "dmptemplate_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "slug" - t.integer "organisation_id" - t.string "grant_number" - t.string "identifier" - t.text "description" - t.string "principal_investigator" - t.string "principal_investigator_identifier" - t.string "data_contact" - t.string "funder_name" + t.string "slug", limit: 191 + t.integer "organisation_id", limit: 4 + t.string "grant_number", limit: 255 + t.string "identifier", limit: 255 + t.text "description", limit: 65535 + t.string "principal_investigator", limit: 255 + t.string "principal_investigator_identifier", limit: 255 + t.string "data_contact", limit: 255 + t.string "funder_name", limit: 255 end - add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true + add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree create_table "question_formats", force: :cascade do |t| - t.string "title" - t.text "description" + t.string "title", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "questions", force: :cascade do |t| - t.text "text" - t.text "default_value" - t.text "guidance" - t.integer "number" - t.integer "parent_id" - t.integer "dependency_id" - t.text "dependency_text" - t.integer "section_id" + t.text "text", limit: 65535 + t.text "default_value", limit: 65535 + t.text "guidance", limit: 65535 + t.integer "number", limit: 4 + t.integer "parent_id", limit: 4 + t.integer "dependency_id", limit: 4 + t.text "dependency_text", limit: 65535 + t.integer "section_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "question_format_id" - t.boolean "option_comment_display", default: true + t.integer "question_format_id", limit: 4 + t.boolean "option_comment_display", default: true end create_table "questions_themes", id: false, force: :cascade do |t| - t.integer "question_id", null: false - t.integer "theme_id", null: false + t.integer "question_id", limit: 4, null: false + t.integer "theme_id", limit: 4, null: false end - add_index "questions_themes", ["question_id", "theme_id"], name: "index_questions_themes_on_question_id_and_theme_id" + add_index "questions_themes", ["question_id", "theme_id"], name: "index_questions_themes_on_question_id_and_theme_id", using: :btree create_table "region_groups", force: :cascade do |t| - t.integer "super_region_id" - t.integer "region_id" + t.integer "super_region_id", limit: 4 + t.integer "region_id", limit: 4 end create_table "regions", force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" + t.string "abbreviation", limit: 255 + t.string "description", limit: 255 + t.string "name", limit: 255 end create_table "roles", force: :cascade do |t| - t.string "name" + t.string "name", limit: 191 t.datetime "created_at" t.datetime "updated_at" t.boolean "role_in_plans" - t.integer "resource_id" - t.string "resource_type" + t.integer "resource_id", limit: 4 + t.string "resource_type", limit: 255 end - add_index "roles", ["name"], name: "index_roles_on_name" - add_index "roles", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id" + add_index "roles", ["name"], name: "index_roles_on_name", using: :btree + add_index "roles", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree create_table "sections", force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" - t.integer "version_id" - t.integer "organisation_id" + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "number", limit: 4 + t.integer "version_id", limit: 4 + t.integer "organisation_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.boolean "published" end create_table "settings", force: :cascade do |t| - t.string "var", null: false - t.text "value" - t.integer "target_id", null: false - t.string "target_type", null: false + t.string "var", limit: 191, null: false + t.text "value", limit: 65535 + t.integer "target_id", limit: 4, null: false + t.string "target_type", limit: 191, null: false t.datetime "created_at" t.datetime "updated_at" end - add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true + add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree create_table "splash_logs", force: :cascade do |t| - t.string "destination" + t.string "destination", limit: 255 t.datetime "created_at" t.datetime "updated_at" end create_table "suggested_answers", force: :cascade do |t| - t.integer "question_id" - t.integer "organisation_id" - t.text "text" + t.integer "question_id", limit: 4 + t.integer "organisation_id", limit: 4 + t.text "text", limit: 65535 t.datetime "created_at" t.datetime "updated_at" t.boolean "is_example" end create_table "themes", force: :cascade do |t| - t.string "title" - t.text "description" + t.string "title", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" - t.string "locale" + t.string "locale", limit: 255 end create_table "themes_in_guidance", id: false, force: :cascade do |t| - t.integer "theme_id" - t.integer "guidance_id" + t.integer "theme_id", limit: 4 + t.integer "guidance_id", limit: 4 end create_table "token_permission_types", force: :cascade do |t| - t.string "token_type" - t.text "text_description" + t.string "token_type", limit: 255 + t.text "text_description", limit: 65535 + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "user_identifiers", force: :cascade do |t| + t.string "identifier", limit: 255 + t.datetime "created_at" + t.datetime "updated_at" + t.integer "user_id", limit: 4 + t.integer "identifier_scheme_id", limit: 4 + end + + add_index "user_identifiers", ["identifier_scheme_id"], name: "fk_rails_fe95df7db0", using: :btree + add_index "user_identifiers", ["user_id"], name: "fk_rails_65c9a98cdb", using: :btree + + create_table "user_role_types", force: :cascade do |t| + t.string "name", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "user_statuses", force: :cascade do |t| - t.string "name" - t.text "description" + t.string "name", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "user_types", force: :cascade do |t| - t.string "name" - t.text "description" + t.string "name", limit: 255 + t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end create_table "users", force: :cascade do |t| - t.string "firstname" - t.string "surname" - t.string "email", default: "", null: false - t.string "orcid_id" - t.string "shibboleth_id" - t.integer "user_type_id" - t.integer "user_status_id" + t.string "firstname", limit: 255 + t.string "surname", limit: 255 + t.string "email", limit: 191, default: "", null: false + t.string "orcid_id", limit: 255 + t.string "shibboleth_id", limit: 255 + t.integer "user_type_id", limit: 4 + t.integer "user_status_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.string "encrypted_password", default: "" - t.string "reset_password_token" + t.string "encrypted_password", limit: 255, default: "" + t.string "reset_password_token", limit: 191 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 + t.integer "sign_in_count", limit: 4, default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "confirmation_token" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 + t.string "confirmation_token", limit: 191 t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "invitation_token" + t.string "invitation_token", limit: 191 t.datetime "invitation_created_at" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" - t.string "other_organisation" + t.string "other_organisation", limit: 255 t.boolean "dmponline3" t.boolean "accept_terms" - t.integer "organisation_id" - t.string "api_token" - t.integer "invited_by_id" - t.string "invited_by_type" - t.integer "language_id" + t.integer "organisation_id", limit: 4 + t.string "api_token", limit: 255 + t.integer "invited_by_id", limit: 4 + t.string "invited_by_type", limit: 255 + t.integer "language_id", limit: 4 end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true, using: :btree + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree create_table "users_roles", id: false, force: :cascade do |t| - t.integer "user_id" - t.integer "role_id" + t.integer "user_id", limit: 4 + t.integer "role_id", limit: 4 end - add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" + add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree create_table "versions", force: :cascade do |t| - t.string "title" - t.text "description" + t.string "title", limit: 255 + t.text "description", limit: 65535 t.boolean "published" - t.integer "number" - t.integer "phase_id" + t.integer "number", limit: 4 + t.integer "phase_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end - add_index "versions", ["phase_id"], name: "index_versions_on_phase_id" + add_index "versions", ["phase_id"], name: "index_versions_on_phase_id", using: :btree + add_foreign_key "user_identifiers", "identifier_schemes" + add_foreign_key "user_identifiers", "users" end diff --git a/db/seeds.rb b/db/seeds.rb index 47ddf00..55845dc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -90,7 +90,6 @@ 'orcid' => { name: 'ORCID', landing_page_uri: 'https://orcid.org/{id}', - logo: '/assets/orcid.png', api_key: 'ABCD1234', api_secret: 'secret', params: '{"scope": "/authenticate"}'