From 73cc7cf7a43f10d6bc187b86b9dfb4c8dd7b7a4a Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Thu, 31 Oct 2024 17:38:43 -0500 Subject: [PATCH 1/7] use developer strategy instead of identity strategy for development and test enviroinments, remove Data Curation Network portal --- .devcontainer/devcontainer.json | 2 +- Gemfile | 3 +- Gemfile.lock | 4 - app/controllers/application_controller.rb | 8 +- .../data_curation_network_controller.rb | 71 ---- app/controllers/datafiles_controller.rb | 20 +- app/controllers/datasets_controller.rb | 3 +- app/controllers/identities_controller.rb | 82 ----- app/controllers/invitees_controller.rb | 107 ------ app/controllers/sessions_controller.rb | 27 +- app/models/ability.rb | 6 +- app/models/datafile/downloadable.rb | 14 - app/models/dataset/authorable.rb | 4 +- app/models/dataset/stringable.rb | 2 +- app/models/identity.rb | 146 -------- app/models/invitee.rb | 38 -- app/models/user.rb | 326 ++++++++++-------- app/models/user/identity.rb | 97 ------ app/models/user/shibboleth.rb | 99 ------ app/models/user_ability.rb | 10 +- .../data_curation_network/_heading.html.haml | 16 - .../account/add.html.haml | 7 - .../account/edit.html.haml | 7 - .../data_curation_network/accounts.html.haml | 41 --- .../after_registration.html.haml | 7 - .../data_curation_network/datasets.html.haml | 27 -- .../data_curation_network/index.html.haml | 47 --- .../data_curation_network/login.html.haml | 5 - .../my_account.html.haml | 40 --- .../data_curation_network/register.html.haml | 5 - app/views/identities/_form.html.haml | 10 - app/views/identities/_heading.html.haml | 1 - app/views/identities/_login.html.haml | 22 -- app/views/identities/_register.html.haml | 32 -- app/views/identities/edit.html.haml | 7 - app/views/identities/index.html.haml | 23 -- app/views/identities/login.html.haml | 4 - app/views/identities/register.html.haml | 5 - app/views/identities/show.html.haml | 6 - app/views/invitees/_form.html.haml | 30 -- app/views/invitees/_invitee.json.jbuilder | 2 - app/views/invitees/edit.html.haml | 7 - app/views/invitees/index.html.haml | 38 -- app/views/invitees/index.json.jbuilder | 1 - app/views/invitees/new.html.haml | 5 - app/views/invitees/show.html.haml | 6 - app/views/invitees/show.json.jbuilder | 1 - app/views/sessions/new.html.haml | 8 + app/views/shared/_header_navbar.html.haml | 13 +- bin/setup_local | 46 +++ config/initializers/omniauth.rb | 27 +- config/routes.rb | 1 - config/routes/auth.rb | 1 + config/routes/data_curation_network.rb | 12 - docker-compose.local-test.yml | 2 +- features/step_definitions/dataset.rb | 2 +- lib/tasks/databank.rake | 23 +- lib/tasks/fix.rake | 2 +- lib/tasks/local_identity.rake | 63 ---- lib/tasks/pub.rake | 2 +- test/fixtures/identities.yml | 67 ---- test/fixtures/invitees.yml | 39 --- .../{user/identities.yml => users.yml} | 15 +- 63 files changed, 328 insertions(+), 1466 deletions(-) delete mode 100644 app/controllers/data_curation_network_controller.rb delete mode 100644 app/controllers/identities_controller.rb delete mode 100644 app/controllers/invitees_controller.rb delete mode 100644 app/models/identity.rb delete mode 100644 app/models/invitee.rb delete mode 100644 app/models/user/identity.rb delete mode 100644 app/models/user/shibboleth.rb delete mode 100644 app/views/data_curation_network/_heading.html.haml delete mode 100644 app/views/data_curation_network/account/add.html.haml delete mode 100644 app/views/data_curation_network/account/edit.html.haml delete mode 100644 app/views/data_curation_network/accounts.html.haml delete mode 100644 app/views/data_curation_network/after_registration.html.haml delete mode 100644 app/views/data_curation_network/datasets.html.haml delete mode 100644 app/views/data_curation_network/index.html.haml delete mode 100644 app/views/data_curation_network/login.html.haml delete mode 100644 app/views/data_curation_network/my_account.html.haml delete mode 100644 app/views/data_curation_network/register.html.haml delete mode 100644 app/views/identities/_form.html.haml delete mode 100644 app/views/identities/_heading.html.haml delete mode 100644 app/views/identities/_login.html.haml delete mode 100644 app/views/identities/_register.html.haml delete mode 100644 app/views/identities/edit.html.haml delete mode 100644 app/views/identities/index.html.haml delete mode 100644 app/views/identities/login.html.haml delete mode 100644 app/views/identities/register.html.haml delete mode 100644 app/views/identities/show.html.haml delete mode 100644 app/views/invitees/_form.html.haml delete mode 100644 app/views/invitees/_invitee.json.jbuilder delete mode 100644 app/views/invitees/edit.html.haml delete mode 100644 app/views/invitees/index.html.haml delete mode 100644 app/views/invitees/index.json.jbuilder delete mode 100644 app/views/invitees/new.html.haml delete mode 100644 app/views/invitees/show.html.haml delete mode 100644 app/views/invitees/show.json.jbuilder create mode 100644 app/views/sessions/new.html.haml create mode 100755 bin/setup_local delete mode 100644 config/routes/data_curation_network.rb delete mode 100644 lib/tasks/local_identity.rake delete mode 100644 test/fixtures/identities.yml delete mode 100644 test/fixtures/invitees.yml rename test/fixtures/{user/identities.yml => users.yml} (83%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 673c5c9..5f0424f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,5 +22,5 @@ // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "bin/setup" + "postCreateCommand": "bin/setup_local" } diff --git a/Gemfile b/Gemfile index 6ed269b..53775d1 100644 --- a/Gemfile +++ b/Gemfile @@ -130,8 +130,7 @@ gem "valid_email" # Use boostrap-datepicker-rails for selecting release date # gem 'bootstrap-datepicker-rails' -# Use identity strategy to create local accounts for testing -gem "omniauth-identity" +# Use shibboleth strategy for omniauth -- NetID login gem "omniauth-shibboleth" gem "omniauth-rails_csrf_protection" diff --git a/Gemfile.lock b/Gemfile.lock index e10bd54..d09b978 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1774,9 +1774,6 @@ GEM hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection - omniauth-identity (3.0.9) - bcrypt - omniauth omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) omniauth (~> 2.0) @@ -2061,7 +2058,6 @@ DEPENDENCIES net-ldap (~> 0.16.2) nokogiri nokogiri-diff - omniauth-identity omniauth-rails_csrf_protection omniauth-shibboleth open_uri_redirections diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbb0227..5fdf70e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -117,10 +117,10 @@ def record_not_found(exception) private - # @return [User::Shibboleth, User::Identity] the current user + # @return [User] the current user def current_user if session[:user_id] - @current_user = User::Shibboleth.find(session[:user_id]) || User::Identity.find(session[:user_id]) + @current_user = User.find(session[:user_id]) end rescue ActiveRecord::RecordNotFound session[:user_id] = nil @@ -128,8 +128,8 @@ def current_user ## # sets the current user - # @param [User::Shibboleth, User::Identity] user - # @return [User::Shibboleth, User::Identity] the current user + # @param [User] user + # @return [User] the current user def set_current_user(user) @current_user = user session[:current_user_id] = user.id diff --git a/app/controllers/data_curation_network_controller.rb b/app/controllers/data_curation_network_controller.rb deleted file mode 100644 index 9dc4504..0000000 --- a/app/controllers/data_curation_network_controller.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -class DataCurationNetworkController < ApplicationController - def index; end - - # Responds to `GET /data_curation_network/accounts` - def accounts - @accounts = Invitee.where(role: Databank::UserRole::NETWORK_REVIEWER) - authorize! :manage, Invitee - end - - # Responds to `GET /data_curation_network/my_account` - def my_account - unless current_user&.email - redirect_to("/data_curation_network", notice: "Log in to curate datasets or manage your account.") && return - end - @identity = Identity.find_by(email: current_user.email) - redirect_to("/data_curation_network", notice: "Unable to verify identity.") unless @identity - end - - # Responds to `GET /data_curation_network/accounts/add` - def add_account - authorize! :manage, Invitee - @invitee = Invitee.new - @invitee.expires_at = Time.current + 3.months - @invitee.role = Databank::UserRole::NETWORK_REVIEWER - @role_arr = [] - @role_arr.push(Databank::UserRole::NETWORK_REVIEWER) - render "data_curation_network/account/add" - end - - # Responds to `GET /data_curation_network/accounts/:id/edit` - def edit_account - set_invitee - unless @invitee - redirect_to("/data_curation_network", notice: "error: unable to validate account identifier") && return - end - authorize! :manage, @invitee - render "data_curation_network/account/edit" - end - - # Responds to `GET /data_curation_network/register` - def register; end - - # Responds to `GET /data_curation_network/login` - def login; end - - # Responds to `GET /data_curation_network/after_registration` - def after_registration; end - - # Responds to `GET /data_curation_network/datasets` - def datasets - nondraft_states = [Databank::PublicationState::RELEASED, - Databank::PublicationState::Embargo::FILE, - Databank::PublicationState::Embargo::METADATA] - @drafts = Dataset.where(data_curation_network: true).where(publication_state: Databank::PublicationState::DRAFT) - @nondrafts = Dataset.where(data_curation_network: true).where(publication_state: nondraft_states) - end - - private - - # Set the invitee instance variable - def set_invitee - @invitee = Invitee.find(params[:id]) - @invitee ||= Invitee.find(params[:invitee_id]) - if @invitee.nil? && current_user&.role == Databank::UserRole::NETWORK_REVIEWER - @invitee = Invitee.find_by(email: current_user.email) - end - nil unless @invitee - end -end diff --git a/app/controllers/datafiles_controller.rb b/app/controllers/datafiles_controller.rb index b865d37..ec007f0 100644 --- a/app/controllers/datafiles_controller.rb +++ b/app/controllers/datafiles_controller.rb @@ -196,8 +196,24 @@ def download # Called from download action or to download a file without recording the download for drafts/curators/testing def download_no_record - - if @datafile.current_root.root_type == :filesystem + if Rails.env == "development" || Rails.env == "test" + case @datafile.storage_root + when "draft" + root = StorageManager.instance.draft_root + when "medusa" + root = StorageManager.instance.medusa_root + else + raise "invalid storage root for datafile web_id: #{@datafile.web_id}, id: #{@datafile.id}" + end + expanded_key = "#{root.prefix}#{@datafile.storage_key}" + # DEBUG + Rails.logger.warn "expanded_key: #{expanded_key}" + Rails.logger.warn "binary_name: #{@datafile.binary_name}" + # Use the Application.aws_client to get the object from the bucket found at @datafile.storage_root and the expanded_key, then download it to the browser + object = Application.aws_client.get_object(bucket: root.bucket, key: expanded_key) + send_data object.body.read, filename: @datafile.binary_name, type: safe_content_type(@datafile) + return + elsif @datafile.current_root.root_type == :filesystem @datafile.with_input_file do |input_file| path = @datafile.current_root.path_to(@datafile.storage_key, check_path: true) send_file path, filename: @datafile.binary_name, type: safe_content_type(@datafile) diff --git a/app/controllers/datasets_controller.rb b/app/controllers/datasets_controller.rb index 04c6c5e..d952e7d 100644 --- a/app/controllers/datasets_controller.rb +++ b/app/controllers/datasets_controller.rb @@ -138,8 +138,7 @@ def import_from_globus def index if current_user user_role = current_user.role - user = User::Shibboleth.find_by(email: current_user&.email) - user ||= User::Identity.find_by(email: current_user&.email) + user = User.find_by(email: current_user&.email) else user_role = Databank::UserRole::GUEST user = nil diff --git a/app/controllers/identities_controller.rb b/app/controllers/identities_controller.rb deleted file mode 100644 index 07df4c2..0000000 --- a/app/controllers/identities_controller.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -class IdentitiesController < ApplicationController - load_and_authorize_resource - skip_authorize_resource only: %i[login register] - before_action :set_identity, only: %i[show edit update destroy] - - # Responds to `GET /identities` - # Responds to `GET /identities.json` - def index - @identities = Identity.all - end - - # Responds to `GET /identities/1` - # Responds to `GET /identities/1.json` - def show; end - - # Responds to `GET /identities/new` - def new - redirect_to action: "register" - end - - # Responds to `GET /identities/register` - def register; end - - # Responds to `GET /identities/login` - def login; end - - # Responds to `GET /identities/1/edit` - def edit; end - - # Responds to `POST /identities` - # Responds to `POST /identities.json` - def create - @identity = Identity.new(identity_params) - respond_to do |format| - if @identity.save - format.html { redirect_to @identity, notice: "Identity was successfully created." } - format.json { render :show, status: :created, location: @identity } - else - format.html { render :new } - format.json { render json: @identity.errors, status: :unprocessable_entity } - end - end - end - - # Responds to `PATCH/PUT /identities/1` - # Responds to `PATCH/PUT /identities/1.json` - def update - respond_to do |format| - if @identity.update(identity_params) - format.html { redirect_to @identity, notice: "Identity was successfully updated." } - format.json { render :show, status: :ok, location: @identity } - else - format.html { render :edit } - format.json { render json: @identity.errors, status: :unprocessable_entity } - end - end - end - - # Responds to `DELETE /identities/1` - # Responds to `DELETE /identities/1.json` - def destroy - @identity.destroy - respond_to do |format| - format.html { redirect_to identities_url, notice: "Identity was successfully destroyed." } - format.json { head :no_content } - end - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_identity - @identity = Identity.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def identity_params - params.fetch(:identity, {}) - end -end diff --git a/app/controllers/invitees_controller.rb b/app/controllers/invitees_controller.rb deleted file mode 100644 index 2834baf..0000000 --- a/app/controllers/invitees_controller.rb +++ /dev/null @@ -1,107 +0,0 @@ -# frozen_string_literal: true - -class InviteesController < ApplicationController - authorize_resource - before_action :set_invitee, only: %i[show edit update destroy] - - # Responds to `GET /invitees` - # Responds to `GET /invitees.json` - def index - @invitees = Invitee.all - end - - # Responds to `GET /invitees/1` - # Responds to `GET /invitees/1.json` - def show; end - - # Responds to `GET /invitees/new` - def new - @invitee = Invitee.new - @role_arr = Array.new - @role_arr.push(Databank::UserRole::NETWORK_REVIEWER) - @role_arr.push(Databank::UserRole::PUBLISHER_REVIEWER) - @role_arr.push(Databank::UserRole::CREATOR) - end - - # Responds to `GET /invitees/1/edit` - def edit - @role_arr = Array.new - @role_arr.push(Databank::UserRole::NETWORK_REVIEWER) - @role_arr.push(Databank::UserRole::PUBLISHER_REVIEWER) - @role_arr.push(Databank::UserRole::CREATOR) - end - - # Responds to `POST /invitees` - # Responds to `POST /invitees.json` - def create - @invitee = Invitee.new(invitee_params) - - authorize! :manage, @invitee - - respond_to do |format| - if @invitee.save - if @invitee.role == Databank::UserRole::NETWORK_REVIEWER - format.html { redirect_to "/data_curation_network/accounts", notice: "Invitee was successfully created." } - else - format.html { redirect_to @invitee, notice: "Invitee was successfully created." } - end - format.json { render :show, status: :created, location: @invitee } - else - if @invitee.role == Databank::UserRole::NETWORK_REVIEWER - format.html { redirect_to "/data_curation_network/accounts", notice: "Error attempting to create invitee." } - else - format.html { render :new } - end - format.json { render json: @invitee.errors, status: :unprocessable_entity } - end - end - end - - # Responds to `PATCH/PUT /invitees/1` - # Responds to `PATCH/PUT /invitees/1.json` - def update - authorize! :manage, @invitee - - respond_to do |format| - if @invitee.update - if @invitee.role == Databank::UserRole::NETWORK_REVIEWER - format.html { redirect_to "/data_curation_network/accounts", notice: "Invitee was successfully updated." } - else - format.html { redirect_to @invitee, notice: "Invitee was successfully updated." } - end - format.json { render :show, status: :ok, location: @invitee } - else - if @invitee.role == Databank::UserRole::NETWORK_REVIEWER - edit_path = "/data_curation_network/account/#{@invitee_id}/edit" - format.html { redirect_to(edit_path, notice: "Error attempting to update invitee.") } - else - format.html { render :edit } - end - format.json { render json: @invitee.errors, status: :unprocessable_entity } - end - end - end - - # Responds to `DELETE /invitees/1` - # Responds to `DELETE /invitees/1.json` - def destroy - authorize! :manage, @invitee - @invitee.destroy - respond_to do |format| - format.html { redirect_to "/data_curation_network/accounts", notice: "Account was successfully destroyed." } - format.json { head :no_content } - end - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_invitee - @invitee = Invitee.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def invitee_params - params.require(:invitee).permit(:email, :group, :role, :expires_at) - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d6c89c0..d9b7741 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -6,32 +6,35 @@ class SessionsController < ApplicationController # Responds to `GET /login` def new - session[:login_return_referer] = request.env['HTTP_REFERER'] - redirect_to(shibboleth_login_path(Databank::Application.shibboleth_host)) + if params[:provider] && params[:provider] == 'shibboleth' + session[:login_return_referer] = request.env['HTTP_REFERER'] + redirect_to(shibboleth_login_path(Databank::Application.shibboleth_host)) + end end + # Responds to `POST /auth/:provider/callback` def create auth = request.env["omniauth.auth"] - if auth[:provider] && auth[:provider] == 'shibboleth' - user = User::Shibboleth.from_omniauth(auth) - elsif auth[:provider] && auth[:provider] == 'identity' - user = User::Identity.from_omniauth(auth) - else + unless auth[:provider] && ['shibboleth', 'developer'].include?(auth[:provider]) unauthorized + return end + if auth[:provider] == 'developer' && !(Rails.env.test? || Rails.env.development?) + unauthorized + return + end + + user = User.from_omniauth(auth) + if user&.id session[:user_id] = user.id - if user.provider == 'identity' && user.role == Databank::UserRole::NETWORK_REVIEWER - redirect_to '/data_curation_network' - elsif user.role == 'no_deposit' + if user.role == 'no_deposit' redirect_to root_url, notice: "ACCOUNT NOT ELIGABLE TO DEPOSIT DATA.
Faculty, staff, and graduate students are eligable to deposit data in Illinois Data Bank.
Please contact the Research Data Service if this determination is in error, or if you have any questions." else redirect_to return_url end - elsif session[:previous_url] == '/data_curation_network/register' - redirect_to '/data_curation_network/after_registration' else redirect_to root_url end diff --git a/app/models/ability.rb b/app/models/ability.rb index abca6b5..01dd424 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -19,7 +19,7 @@ def initialize(user) # alias_action :new, :to => :create # alias_action :edit, :to => :update - user ||= User::Shibboleth.new # guest user (not logged in) + user ||= User.new # guest user (not logged in) can :manage, :all if user.is?(Databank::UserRole::ADMIN) @@ -73,10 +73,6 @@ def initialize(user) dataset.data_curation_network && user.is?(Databank::UserRole::NETWORK_REVIEWER) end - can [:read, :update], Identity do |identity| - identity.email == user.email - end - can :read, [Guide::Section, Guide::Item, Guide::Subitem], &:public? can :search_orcid, Creator, &:public? end diff --git a/app/models/datafile/downloadable.rb b/app/models/datafile/downloadable.rb index ab6773c..1fa86a9 100644 --- a/app/models/datafile/downloadable.rb +++ b/app/models/datafile/downloadable.rb @@ -6,20 +6,6 @@ # This module is included in the Datafile model to provide methods for handling the download of the datafile module Datafile::Downloadable extend ActiveSupport::Concern - ## - # @return [String] the datafile's download link - def download_link - case cfs_file.storage_root.root_type - when :filesystem - download_cfs_file_path(cfs_file) - when :s3 - cfs_file.storage_root.presigned_get_url(cfs_file.key, - response_content_disposition: disposition("attachment", cfs_file), - response_content_type: safe_content_type(cfs_file)) - else - raise "Unrecognized storage root type #{cfs_file.storage_root.type}" - end - end ## # @return [ActiveRecord::Relation] the FileDownloadTally records for this datafile diff --git a/app/models/dataset/authorable.rb b/app/models/dataset/authorable.rb index a5a8468..027e628 100644 --- a/app/models/dataset/authorable.rb +++ b/app/models/dataset/authorable.rb @@ -104,7 +104,7 @@ def depositor return "unknown|Unknown Depositor" unless depositor_email email = depositor_email - user = User::Shibboleth.find_by(email: email) + user = User.find_by(email: email) return "unknown|Unknown Depositor" unless user "#{depositor_netid}|#{user.name}" @@ -113,7 +113,7 @@ def depositor def depositor_netid return nil unless depositor_email - user = User::Shibboleth.find_by(email: depositor_email) + user = User.find_by(email: depositor_email) return nil unless user user.email.split("@").first diff --git a/app/models/dataset/stringable.rb b/app/models/dataset/stringable.rb index 944cfa3..e68de73 100644 --- a/app/models/dataset/stringable.rb +++ b/app/models/dataset/stringable.rb @@ -225,7 +225,7 @@ def full_changelog change_hash.delete("remote_address") change_hash.delete("request_uuid") user = nil - user = User::Shibboleth.find(Integer(change.user_id)) if change.user_id && change.user_id != "" + user = User.find(Integer(change.user_id)) if change.user_id && change.user_id != "" agent = if user user.serializable_hash else diff --git a/app/models/identity.rb b/app/models/identity.rb deleted file mode 100644 index dd78c68..0000000 --- a/app/models/identity.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true - -## -# Represents a local, non-Shibboleth user in the system -# This model is used to support the OmniAuth identity provider, -# which allows users to sign in with a username and password. -# Used to support the Data Curation System in production. -# Used to support development and testing in local environments. - -class Identity < OmniAuth::Identity::Models::ActiveRecord - attr_accessor :activation_token, :reset_token - before_create :set_invitee - before_create :create_activation_digest - after_create :send_activation_email - before_destroy :destroy_user - validates :name, presence: true - validates :email, presence: true, length: {maximum: 255}, - format: {with: VALID_EMAIL_REGEX}, - uniqueness: {case_sensitive: false} - has_secure_password - validates :password, presence: true, length: {minimum: 5} - validate :invited - - ## - # @return [Boolean] true if the given token matches the digest. - def authenticated?(attribute, token) - digest = send("#{attribute}_digest") - return false if digest.nil? - - BCrypt::Password.new(digest).is_password?(token) - end - - ## - # @param string [String] the string to be hashed - # @return [String] the hashed string - def self.digest(string) - cost = if ActiveModel::SecurePassword.min_cost - BCrypt::Engine::MIN_COST - else - BCrypt::Engine.cost - end - BCrypt::Password.create(string, cost: cost) - end - - ## - # @return [String] a random token - def self.new_token - SecureRandom.urlsafe_base64 - end - - ## - # @return [Boolean] true if the identity has an invitation, false otherwise - def invited - set_invitee - errors.add(:base, "Registered identity must have current invitation.") unless [nil, ""].exclude?(invitee_id) - end - - ## - # @return [String] the activation URL - def activation_url - "#{IDB_CONFIG[:root_url_text]}/account_activations/#{activation_token}/edit?email=#{CGI.escape(email)}" - end - - ## - # @return [String] the password reset URL - def password_reset_url - "#{IDB_CONFIG[:root_url_text]}/password_reset/#{reset_token}/edit?email=#{CGI.escape(email)}" - end - - ## - # sends the activation email for the identity - def send_activation_email - notification = DatabankMailer.account_activation(self) - notification.deliver_now - end - - ## - # sends password reset email - def send_password_reset_email - notification = DatabankMailer.password_reset(self) - notification.deliver_now - end - - ## - # creates and assigns the activation token and digest - def create_activation_digest - self.activation_token = Identity.new_token - self.activation_digest = Identity.digest(activation_token) - end - - ## - # creates and assigns the reset token and digest - def create_reset_digest - reset_token = Identity.new_token - update_attribute(:reset_digest, Identity.digest(reset_token)) - update_attribute(:reset_sent_at, Time.zone.now) - end - - ## - # @return [Boolean] true if the password reset has expired, false otherwise - def password_reset_expired? - reset_sent_at < 2.hours.ago - end - - ## - # creates a test account - def self.create_test_account(name:, email:, role:) - invitee = Invitee.find_or_create_by(email: email) - invitee.role = role - invitee.expires_at = Time.zone.now + 1.years - invitee.save! - identity = Identity.find_or_create_by(email: email) - salt = BCrypt::Engine.generate_salt - localpass = IDB_CONFIG[:admin][:localpass] - encrypted_password = BCrypt::Engine.hash_secret(localpass, salt) - identity.password_digest = encrypted_password - identity.update(password: localpass, password_confirmation: localpass) - identity.name = name - identity.activated = true - identity.activated_at = Time.zone.now - identity.save! - end - - private - - ## - # converts email to all lower-case (does not save to database) - # for use in case-insensitive email validation - def downcase_email - self.email = email.downcase - end - - ## - # destroys the user associated with the identity - def destroy_user - user = User::Identity.find_by(email: email) - user&.destroy! - end - - ## - # sets the invitee for the identity - def set_invitee - @invitee = Invitee.find_by(email: email) - self.invitee_id = @invitee.id if @invitee && @invitee.expires_at > Time.current - end -end diff --git a/app/models/invitee.rb b/app/models/invitee.rb deleted file mode 100644 index bb12235..0000000 --- a/app/models/invitee.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -## -# Represents an invitee -# Invitees are the users who are invited to use the Identity Omniauth provider. -# -# == Attributes -# -# * +email+ - (String) - the email of the invitee -# * +role+ - (String) - the role of the invitee -# * +expires_at+ - (DateTime) - the expiration date of the invitee - -class Invitee < ApplicationRecord - validates :email, presence: true, uniqueness: true - before_destroy :destroy_identity - before_destroy :destroy_user - - ## - # @return [String] the group of the invitee - # @note the group is always "reviewer", but additional logic could be added, and value is changed in object for tests. - def group - "reviewer" - end - - ## - # destroys the identity associated with this invitee - def destroy_identity - identity = Identity.find_by(email: email) - identity&.destroy! - end - - ## - # destroys the user associated with this invitee - def destroy_user - user = User::Identity.find_by(email: email) - user&.destroy! - end -end diff --git a/app/models/user.rb b/app/models/user.rb index 1cd8e1f..237f0e8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,169 +3,221 @@ require "open-uri" require "json" -module User - # This is an abstract class to represent a User. It is intended to be subclassed - - class User < ApplicationRecord - include ActiveModel::Serialization - - validates :uid, uniqueness: {allow_blank: false} - before_save :downcase_email - validates :name, presence: true - validates :email, presence: true, length: {maximum: 255}, - format: {with: VALID_EMAIL_REGEX}, - uniqueness: {case_sensitive: false} - # system user is a special user that is used to perform system tasks such as releasing embargoed datasets - class_attribute :system_user - - # @return [Boolean] true if the user is an admin - def admin? - role == Databank::UserRole::ADMIN - end +class User < ApplicationRecord + include ActiveModel::Serialization + + validates :uid, uniqueness: {allow_blank: false} + before_save :downcase_email + validates :name, presence: true + validates :email, presence: true, length: {maximum: 255}, + format: {with: VALID_EMAIL_REGEX}, + uniqueness: {case_sensitive: false} + # system user is a special user that is used to perform system tasks such as releasing embargoed datasets + class_attribute :system_user + + # @return [Boolean] true if the user is an admin + def admin? + role == Databank::UserRole::ADMIN + end - # @return [Boolean] true if the user is a depositor - def depositor? - role == Databank::UserRole::DEPOSITOR - end + # @return [Boolean] true if the user is a depositor + def depositor? + role == Databank::UserRole::DEPOSITOR + end - # @return [Boolean] true if the user is a guest - def guest? - role == Databank::UserRole::GUEST - end + # @return [Boolean] true if the user is a guest + def guest? + role == Databank::UserRole::GUEST + end + + # @return [Boolean] true if the user is a network reviewer + def network_reviewer? + role == Databank::UserRole::NETWORK_REVIEWER + end - # @return [Boolean] true if the user is a network reviewer - def network_reviewer? - role == Databank::UserRole::NETWORK_REVIEWER + # @param [User] user the user to check + # @return [Array] the datasets the user can view + def datasets_user_can_view(user:) + forbidden_hold_states = [Databank::PublicationState::TempSuppress::VERSION, + Databank::PublicationState::PermSuppress::METADATA] + case user.role + when Databank::UserRole::ADMIN + Dataset.all + when Databank::UserRole::DEPOSITOR + datasets = Dataset.select(&:metadata_public?) + datasets += Dataset.where(depositor_email: user.email) + ability_datasets = UserAbility.where(user_provider: user.provider, + user_uid: user.email, + resource_type: "Dataset", + ability: :read).pluck(:resource_id) + datasets += Dataset.where(id: ability_datasets) + datasets -= Dataset.where(hold_state: forbidden_hold_states) + datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) + datasets.uniq + when Databank::UserRole::NETWORK_REVIEWER + datasets = Dataset.select(&:metadata_public?) + datasets += Dataset.where(data_curation_network: true) + datasets -= Dataset.where(hold_state: forbidden_hold_states) + datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) + datasets.uniq + else + Dataset.select(&:metadata_public?) end + end - # @param [User] user the user to check - # @return [Array] the datasets the user can view - def datasets_user_can_view(user:) - forbidden_hold_states = [Databank::PublicationState::TempSuppress::VERSION, - Databank::PublicationState::PermSuppress::METADATA] - case user.role - when Databank::UserRole::ADMIN - Dataset.all - when Databank::UserRole::DEPOSITOR - datasets = Dataset.select(&:metadata_public?) - datasets += Dataset.where(depositor_email: user.email) - ability_datasets = UserAbility.where(user_provider: user.provider, - user_uid: user.email, - resource_type: "Dataset", - ability: :read).pluck(:resource_id) - datasets += Dataset.where(id: ability_datasets) - datasets -= Dataset.where(hold_state: forbidden_hold_states) - datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) - datasets.uniq - when Databank::UserRole::NETWORK_REVIEWER - datasets = Dataset.select(&:metadata_public?) - datasets += Dataset.where(data_curation_network: true) - datasets -= Dataset.where(hold_state: forbidden_hold_states) - datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) - datasets.uniq - else - Dataset.select(&:metadata_public?) - end + # @param [User] user the user to check + # @return [Array] the datasets the user can edit + def datasets_user_can_edit(user:) + forbidden_hold_states = [Databank::PublicationState::TempSuppress::VERSION, + Databank::PublicationState::PermSuppress::METADATA] + case user.role + when Databank::UserRole::ADMIN + Dataset.all + when Databank::UserRole::DEPOSITOR + datasets = Dataset.where(depositor_email: user.email) + ability_datasets = UserAbility.where(user_provider: user.provider, + user_uid: user.email, + resource_type: "Dataset", + ability: :update).pluck(:resource_id) + datasets += Dataset.where(id: ability_datasets) + datasets -= Dataset.where(hold_state: forbidden_hold_states) + datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) + datasets.uniq + else + [] end + end - # @param [User] user the user to check - # @return [Array] the datasets the user can edit - def datasets_user_can_edit(user:) - forbidden_hold_states = [Databank::PublicationState::TempSuppress::VERSION, - Databank::PublicationState::PermSuppress::METADATA] - case user.role - when Databank::UserRole::ADMIN - Dataset.all - when Databank::UserRole::DEPOSITOR - datasets = Dataset.where(depositor_email: user.email) - ability_datasets = UserAbility.where(user_provider: user.provider, - user_uid: user.email, - resource_type: "Dataset", - ability: :update).pluck(:resource_id) - datasets += Dataset.where(id: ability_datasets) - datasets -= Dataset.where(hold_state: forbidden_hold_states) - datasets -= Dataset.where(publication_state: Databank::PublicationState::PermSuppress::METADATA) - datasets.uniq + # @param [String] requested_role the role to check if this user is + def is?(requested_role) + role == requested_role.to_s + end + + # @return [User] the system user + def self.system_user + system_user = User.find_by(provider: "system", uid: IDB_CONFIG[:system_user_email]) + system_user ||= User.create_system_user + system_user + end + + # Converts email to all lower-case. + def downcase_email + self.email = email.downcase + end + +# This method is called by the omniauth callback controller + # to create or update a user based on the omniauth response + # It will return the user if it exists or create a new one if it does not + # @return [User] the user + def self.from_omniauth(auth) + if auth && auth[:uid] + user = User.find_by(provider: auth["provider"], uid: auth["uid"]) + if user + user.update_with_omniauth(auth) else - [] + user = User.create_with_omniauth(auth) end - end + user - # @param [String] requested_role the role to check if this user is - def is?(requested_role) - role == requested_role.to_s end + end - # @return [User] the system user - def self.system_user - system_user = User.find_by(provider: "system", uid: IDB_CONFIG[:system_user_email]) - system_user ||= User.create_system_user - system_user + # This method is called by the omniauth callback controller's from_omniauth method + # to create a new user based on the omniauth response + # @param auth [Hash] the omniauth response + # @return [User] the user + def self.create_with_omniauth(auth) + if auth["provider"] == "shibboleth" + auth["info"]["role"] = User.user_role(auth) + end + create! do |user| + user.provider = auth["provider"] + user.uid = auth["uid"] + user.email = auth["info"]["email"] + user.username = (auth["info"]["email"]).split("@").first + user.name = auth["info"]["name"] + user.role = auth["info"]["role"] end + end - # Converts email to all lower-case. - def downcase_email - self.email = email.downcase - end + # This method is called by the omniauth callback controller's from_omniauth method + # to update an existing user based on the omniauth response + # @param auth [Hash] the omniauth response + # @return [User] the user + def update_with_omniauth(auth) - # @return [String] the user's group, which is the provider for Shibboleth users and the group for Identity users - def group - case provider - when "shibboleth" - provider - when "identity" - invitee = Invitee.find_by(email: email) - return invitee.group if invitee + Rails.logger.warn(auth.to_yaml) - raise StandardError.new("no invitation found for identity: #{email}") - else - raise StandardError.new("unknown provider: #{provider}") - end + if auth["provider"] == "shibboleth" + auth["info"]["role"] = User.user_role(auth) end + update_attribute(:provider, auth["provider"]) + update_attribute(:uid, auth["uid"]) + update_attribute(:email, auth["info"]["email"]) + update_attribute(:username, email.split("@").first) + update_attribute(:name, auth["info"]["name"]) + update_attribute(:role, auth["info"]["role"]) + self + end - # @param [Hash] auth the omniauth hash - # @return [User] the user created from the omniauth hash - def self.from_omniauth(_auth) - raise "subclass responsibility" - end + # @return [String] the netid of the user + def netid + email.split("@")[0] + end - # @param [Hash] auth the omniauth hash - # @return [User] the user created from the omniauth hash - def self.create_with_omniauth(_auth) - raise "subclass responsibility" - end + # @return [String] the email of the user + # @param auth [Hash] the omniauth response + # @return [String] the email of the user + def self.user_role(auth) - # @param [Hash] auth the omniauth hash - # @return [User] the user updated from the omniauth hash - def update_with_omniauth(_auth) - raise "subclass responsibility" - end + admins = IDB_CONFIG[:admin][:netids].split(",").map {|x| x.strip || x } + net_id = auth["info"]["email"].split("@").first + return Databank::UserRole::ADMIN if admins.include?(net_id) - # @param [String] email the email to check - # @return [String] the role of the user - def self.user_role(_email) - raise "subclass responsibility" - end + user = User.find_by(provider: auth["provider"], uid: auth["uid"]) + return Databank::UserRole::DEPOSITOR if user && UserAbility.user_can?("Dataset", nil, "create", user) - # @param [String] email the email to check - # @return [String] the display name of the user - def self.display_name(_email) - raise "subclass responsibility" + unless auth["extra"]["raw_info"]["iTrustAffiliation"].respond_to?(:split) + raise StandardError.new("missing iTrustAffiliation") end - class << self - # creates the system user - # @return [User] the system user - def create_system_user - create! do |user| - user.provider = "system" - user.uid = IDB_CONFIG[:system_user_email] - user.name = IDB_CONFIG[:system_user_name] - user.email = IDB_CONFIG[:system_user_email] - user.username = IDB_CONFIG[:system_user_name] - user.role = "admin" + affiliations = auth["extra"]["raw_info"]["iTrustAffiliation"].split(";") + if affiliations.respond_to?(:length) && !affiliations.empty? + return Databank::UserRole::DEPOSITOR if affiliations.include?("staff") + + if affiliations.include?("student") + if auth["extra"]["raw_info"]["uiucEduStudentLevelCode"] == "1U" + Databank::UserRole::NO_DEPOSIT + else + Databank::UserRole::DEPOSITOR end end + else + Rails.logger.warn("unexpected auth: #{auth.to_yaml}") + notification = DatabankMailer.error("Unexpected auth response: #{auth.to_yaml}") + notification.deliver_now + Databank::UserRole::NO_DEPOSIT + end + rescue StandardError => e + Rails.logger.warn("error determining user role #{e.message} for #{auth.to_yaml}") + notification = DatabankMailer.error("error determining user role #{e.message} for #{auth.to_yaml}") + notification.deliver_now + Databank::UserRole::NO_DEPOSIT + end + + class << self + # creates the system user + # @return [User] the system user + def create_system_user + create! do |user| + user.provider = "system" + user.uid = IDB_CONFIG[:system_user_email] + user.name = IDB_CONFIG[:system_user_name] + user.email = IDB_CONFIG[:system_user_email] + user.username = IDB_CONFIG[:system_user_name] + user.role = "admin" + end end end end + diff --git a/app/models/user/identity.rb b/app/models/user/identity.rb deleted file mode 100644 index 437d1d3..0000000 --- a/app/models/user/identity.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -# This type of user comes from the identity authentication strategy - -class User::Identity < User::User - - validates :email, presence: true, uniqueness: true - validates :role, presence: true - - # This method is called by the omniauth callback controller - # to create or update a user based on the omniauth response - - # Return the user if it exists or create a new one if it does not - # @param auth [Hash] the omniauth response - # @return [User::Identity] the user - def self.from_omniauth(auth) - raise StandardError.new("missing or invalid auth") unless auth && auth[:uid] && auth["info"]["email"] - - email = auth["info"]["email"].strip - identity = Identity.find_by(email: email) - raise StandardError.new("identity does not exist or is not activated for #{auth}") unless identity&.activated - - user = User::Identity.find_by(provider: auth["provider"], email: email) - if user - user.update_with_omniauth(auth) - else - user = User::Identity.create_with_omniauth(auth) - end - user - end - - # This method is called by the omniauth callback controller's from_omniauth method - # to create a new user based on the omniauth response - # @param auth [Hash] the omniauth response - # @return [User::Identity] the user - def self.create_with_omniauth(auth) - invitee = Invitee.find_by(email: auth["info"]["email"]) - if invitee&.expires_at >= Time.current - create! do |user| - user.provider = auth["provider"] - user.uid = auth["info"]["email"] - user.email = auth["info"]["email"] - user.name = auth["info"]["name"] - user.username = user.email - user.role = user_role(user.email) - end - end - end - - # This method is called by the omniauth callback controller's from_omniauth method - # to update an existing user based on the omniauth response - # @param auth [Hash] the omniauth response - # @return [User::Identity] the user - def update_with_omniauth(auth) - update_attribute(:provider, auth["provider"]) - update_attribute(:uid, auth["info"]["email"]) - update_attribute(:email, auth["info"]["email"]) - update_attribute(:username, email.split("@").first) - update_attribute(:name, auth["info"]["name"]) - update_attribute(:role, User::Identity.user_role(email)) - self - end - - # This method is called by the user model to determine the role of a user - # based on the email address - # @param email [String] the email address - # @return [String] the role - def self.user_role(email) - invitee = Invitee.find_by(email: email) - if invitee - invitee.role - else - Databank::UserRole::GUEST - end - end - - # This method is called by the user model to determine the display name of a user - # based on the email address - # @param email [String] the email address - # @return [String] the display name - def self.display_name(email) - identity = find_by(email: email) - return email unless identity - - identity.name || email - end - - # This method is called by the user model to determine the netid of a user - # based on the email address - # @return [String] the netid if the environment is test or development, nil otherwise - # netid has no meaning for the identity provider in production, but is mocked for development and testing - def netid - return username if Rails.env.test? || Rails.env.development? - - nil - end -end diff --git a/app/models/user/shibboleth.rb b/app/models/user/shibboleth.rb deleted file mode 100644 index e0c173e..0000000 --- a/app/models/user/shibboleth.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -# This type of user comes from the shibboleth authentication strategy -class User::Shibboleth < User::User - - validates :email, presence: true, uniqueness: true - validates :role, presence: true - - # This method is called by the omniauth callback controller - # to create or update a user based on the omniauth response - # It will return the user if it exists or create a new one if it does not - # @return [User::Shibboleth] the user - def self.from_omniauth(auth) - if auth && auth[:uid] - user = User::Shibboleth.find_by(provider: auth["provider"], uid: auth["uid"]) - - if user - user.update_with_omniauth(auth) - else - user = User::Shibboleth.create_with_omniauth(auth) - end - user - - end - end - - # This method is called by the omniauth callback controller's from_omniauth method - # to create a new user based on the omniauth response - # @param auth [Hash] the omniauth response - # @return [User::Shibboleth] the user - def self.create_with_omniauth(auth) - create! do |user| - user.provider = auth["provider"] - user.uid = auth["uid"] - user.email = auth["info"]["email"] - user.username = (auth["info"]["email"]).split("@").first - user.name = auth["info"]["name"] - user.role = user_role(auth) - end - end - - # This method is called by the omniauth callback controller's from_omniauth method - # to update an existing user based on the omniauth response - # @param auth [Hash] the omniauth response - # @return [User::Shibboleth] the user - def update_with_omniauth(auth) - update_attribute(:provider, auth["provider"]) - update_attribute(:uid, auth["uid"]) - update_attribute(:email, auth["info"]["email"]) - update_attribute(:username, email.split("@").first) - update_attribute(:name, auth["info"]["name"]) - update_attribute(:role, User::Shibboleth.user_role(auth)) - self - end - - # @return [String] the netid of the user - def netid - email.split("@")[0] - end - - # @return [String] the email of the user - # @param auth [Hash] the omniauth response - # @return [String] the email of the user - def self.user_role(auth) - admins = IDB_CONFIG[:admin][:netids].split(",").map {|x| x.strip || x } - net_id = auth["info"]["email"].split("@").first - return Databank::UserRole::ADMIN if admins.include?(net_id) - - user = User::Shibboleth.find_by(provider: auth["provider"], uid: auth["uid"]) - return Databank::UserRole::DEPOSITOR if user && UserAbility.user_can?("Dataset", nil, "create", user) - - unless auth["extra"]["raw_info"]["iTrustAffiliation"].respond_to?(:split) - raise StandardError.new("missing iTrustAffiliation") - end - - affiliations = auth["extra"]["raw_info"]["iTrustAffiliation"].split(";") - if affiliations.respond_to?(:length) && !affiliations.empty? - return Databank::UserRole::DEPOSITOR if affiliations.include?("staff") - - if affiliations.include?("student") - if auth["extra"]["raw_info"]["uiucEduStudentLevelCode"] == "1U" - Databank::UserRole::NO_DEPOSIT - else - Databank::UserRole::DEPOSITOR - end - end - else - Rails.logger.warn("unexpected auth: #{auth.to_yaml}") - notification = DatabankMailer.error("Unexpected auth response: #{auth.to_yaml}") - notification.deliver_now - Databank::UserRole::NO_DEPOSIT - end - rescue StandardError => e - Rails.logger.warn("error determining user role #{e.message} for #{auth.to_yaml}") - notification = DatabankMailer.error("error determining user role #{e.message} for #{auth.to_yaml}") - notification.deliver_now - Databank::UserRole::NO_DEPOSIT - end -end diff --git a/app/models/user_ability.rb b/app/models/user_ability.rb index bf31a1a..f7cf215 100644 --- a/app/models/user_ability.rb +++ b/app/models/user_ability.rb @@ -128,8 +128,6 @@ def update_editors(dataset:, current_editors:, form_editors:) def add_to_editors(dataset:, email:) return true if dataset.editor_emails.include?(email) - return false if email[-12..] != "illinois.edu" && !User::Identity.find_by(email: email) - grant(dataset: dataset, email: email, ability: :read) grant(dataset: dataset, email: email, ability: :view_files) grant(dataset: dataset, email: email, ability: :update) @@ -138,8 +136,6 @@ def add_to_editors(dataset:, email:) def remove_from_editors(dataset:, email:) return true unless dataset.editor_emails.include?(email) - return false if email[-12..] != "illinois.edu" && !User::Identity.find_by(email: email) - revoke(dataset: dataset, email: email, ability: :read) revoke(dataset: dataset, email: email, ability: :view_files) revoke(dataset: dataset, email: email, ability: :update) @@ -152,7 +148,7 @@ def remove_from_editors(dataset:, email:) # @return [Boolean] Whether the user was successfully granted the ability def grant(dataset:, email:, ability:) email = email.strip.downcase - user = User::Identity.find_by(email: email) + user = User.find_by(email: email) return grant_external(dataset: dataset, user: user, ability: ability) if user return false unless email[-12..] == "illinois.edu" @@ -196,14 +192,14 @@ def grant_external(dataset:, user:, ability:) # @return [Boolean] Whether the user was successfully revoked the ability def revoke(dataset:, email:, ability:) email = email.strip.downcase - user = User::Identity.find_by(email: email) + user = User.find_by(email: email) return revoke_external(dataset: dataset, user: user, ability: ability) if user return false unless email[-12..] == "illinois.edu" existing_record = UserAbility.find_by(resource_type: "Dataset", resource_id: dataset.id, - user_provider: "Shibboleth", + user_provider: "shibboleth", user_uid: email, ability: ability) existing_record&.destroy diff --git a/app/views/data_curation_network/_heading.html.haml b/app/views/data_curation_network/_heading.html.haml deleted file mode 100644 index c98ca26..0000000 --- a/app/views/data_curation_network/_heading.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%hr -.row.text-center - .col-md-1 - .dcn-home - .fas.fa-home.fa-3x - %a(href="/data_curation_network") Home - .col-md-10 - %h2 - %a(href="https://datacurationnetwork.org/") Data Curation Network - Portal for - %a(href="/") Illinois Data Bank - .col-md-1 - .dcn-contact - .fas.fa-envelope.fa-3x - %a(href="mailto:researchdata@illinois.library.illinois.edu") Contact -%hr diff --git a/app/views/data_curation_network/account/add.html.haml b/app/views/data_curation_network/account/add.html.haml deleted file mode 100644 index 13b5c80..0000000 --- a/app/views/data_curation_network/account/add.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.container-fluid - - =render partial: 'heading' - %h3 Add Invitee - %em Register an email address as valid for registration, and define the permitted account's characteristics. - %hr - =render partial: 'invitees/form' \ No newline at end of file diff --git a/app/views/data_curation_network/account/edit.html.haml b/app/views/data_curation_network/account/edit.html.haml deleted file mode 100644 index 6c1f24b..0000000 --- a/app/views/data_curation_network/account/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - %h3 Edit Account - %em Manage characteristics of an invitee and associated identity. - =render partial: 'invitees/form' \ No newline at end of file diff --git a/app/views/data_curation_network/accounts.html.haml b/app/views/data_curation_network/accounts.html.haml deleted file mode 100644 index 3f1ef98..0000000 --- a/app/views/data_curation_network/accounts.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - -if(can? :manage, Invitee) - - %h3 Accounts - .pull-right - %button(type="button" id="add-account-btn" class="btn btn-primary" onclick='window.location = "/data_curation_network/account/add"' ) - %span(class="glyphicon glyphicon-plus" ) - Add New Account - -if @accounts && @accounts.count > 0 - %table.table.table-stripped - %thead - %tr.row - %th.col-md-4 - %strong Email - %th.col-md-4 - %strong Expires - %th.col-md-4(colspan="2" ) - %strong Actions - %tbody - -@accounts.each do |account| - %tr.row - %td.col-md-4 - =account.email - %td.col-md-4 - -if account.expires_at - =account.expires_at.iso8601 - -else - does not expire - %td.col-md-2 - %button(type="button" class="btn btn-success btn-block" onclick='window.location = "/data_curation_network/accounts/#{account.id}/edit"' ) - Edit - %td.col-md-2 - =button_to 'Delete', "/invitees/#{account.id}", class: "btn btn-danger btn-block idb", method: :delete, data: { confirm: 'Are you sure?' } - - - -else - .jumbotron - This page is for administration of the Data Curation Network Portal for Illinois Data Bank. If you are an administrator, log in to manage accounts. diff --git a/app/views/data_curation_network/after_registration.html.haml b/app/views/data_curation_network/after_registration.html.haml deleted file mode 100644 index 319c9f1..0000000 --- a/app/views/data_curation_network/after_registration.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.container-fluid - =render partial: 'heading' - - %p - An activation link has been sent to your email account. - %p - Please allow some time for the email to be delivered. Once you receive the email, please follow the link to log in to the Data Curation Network portal for the Illinois Data Bank. \ No newline at end of file diff --git a/app/views/data_curation_network/datasets.html.haml b/app/views/data_curation_network/datasets.html.haml deleted file mode 100644 index 641cb96..0000000 --- a/app/views/data_curation_network/datasets.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - -if current_user && [Databank::UserRole::NETWORK_REVIEWER, Databank::UserRole::ADMIN].include?(current_user.role) - - %h3 Draft datasets curated with the Data Curation Network - -if @drafts && @drafts.count > 0 - .indent - -@drafts.each do |dataset| - = render 'datasets/brief_record', dataset:dataset - -else - .jumbotron - No no draft datasets were found in Illinois Data Bank that are being curated with the Data Curation Network. - - %h3 Published datasets curated with the Data Curation Network - - -if @nondrafts && @nondrafts.count > 0 - .indent - -@nondrafts.each do |dataset| - = render 'datasets/brief_record', dataset:dataset - -else - .jumbotron - No published datasets were found in Illinois Data Bank that have been curated with the Data Curation Network. - -else - .jumbotron - This page is for use by the Data Curation Network Portal for Illinois Data Bank. If you are an Data Curation Network curator or Illinois Data Bank administrator, log in to list Data Curation Network datasets in Illinois Data Bank. \ No newline at end of file diff --git a/app/views/data_curation_network/index.html.haml b/app/views/data_curation_network/index.html.haml deleted file mode 100644 index f9ad793..0000000 --- a/app/views/data_curation_network/index.html.haml +++ /dev/null @@ -1,47 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - -if current_user && current_user.role == Databank::UserRole::NETWORK_REVIEWER - .row - .col-md-3.col-md-offset-3 - .text-center - .dcn-account - .fas.fa-user.fa-8x - %a(href="/data_curation_network/my_account") My Account - .col-md-3 - .text-center - .dcn-datasets - .fas.fa-server.fa-8x - %a(href="/data_curation_network/datasets") Datasets - - - -elsif current_user && current_user.role == Databank::UserRole::ADMIN - .row - .col-md-3.col-md-offset-3 - .text-center - .dcn-accounts - .fas.fa-users.fa-8x - %a(href="/data_curation_network/accounts") Accounts - .col-md-3 - .text-center - .dcn-datasets - .fas.fa-server.fa-8x - %a(href="/data_curation_network/datasets") Datasets - - - .jumbotron - =succeed ',' do - =current_user.name - you are logged in as an admin. If you want to try out your Data Curation Network persona, log out first. - - -elsif current_user - .jumbotron - =succeed '.' do - To find out more, check out the - %a(href="https://datacurationnetwork.org/") Data Curation Network site - - -else - =render partial: 'identities/login' - - diff --git a/app/views/data_curation_network/login.html.haml b/app/views/data_curation_network/login.html.haml deleted file mode 100644 index 9c6a8fd..0000000 --- a/app/views/data_curation_network/login.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.container-fluid - =render partial: 'heading' - .row - .col-md-10.col-md-offset-1 - =render partial: 'identities/login' diff --git a/app/views/data_curation_network/my_account.html.haml b/app/views/data_curation_network/my_account.html.haml deleted file mode 100644 index bffa908..0000000 --- a/app/views/data_curation_network/my_account.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -=render partial: 'heading' - --if @identity - =form_for @identity, url: "/data_curation_network/identity/#{@identity.id}/update" do |f| - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :name} - Name - .col-md-4 - =f.text_field :name, class: 'form-control' - - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :email} - Email - .col-md-4 - %strong - =@identity.email - - .form-group.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :password} - New Password - .col-md-4 - =password_field_tag :password, class: 'form-control' - - .form-group.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :password_confirmation} - New Password Confirmation - .col-md-4 - =password_field_tag :password_confirmation, class: 'form-control' - .row - .col-md-2.col-md-offset-7 - %button(type="submit" class="btn btn-primary btn-block") - Save Changes - --else - .jumbotron - Unable to confirm credentials. Contact the research data service for any needed assistance. \ No newline at end of file diff --git a/app/views/data_curation_network/register.html.haml b/app/views/data_curation_network/register.html.haml deleted file mode 100644 index fcc1c86..0000000 --- a/app/views/data_curation_network/register.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - =render partial: 'identities/register' \ No newline at end of file diff --git a/app/views/identities/_form.html.haml b/app/views/identities/_form.html.haml deleted file mode 100644 index 5310ff1..0000000 --- a/app/views/identities/_form.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= form_for @identity do |f| - - if @identity.errors.any? - #error_explanation - %h2= "#{pluralize(@identity.errors.count, "error")} prohibited this identity from being saved:" - %ul - - @identity.errors.full_messages.each do |message| - %li= message - - .actions - = f.submit 'Save' diff --git a/app/views/identities/_heading.html.haml b/app/views/identities/_heading.html.haml deleted file mode 100644 index 4642ac5..0000000 --- a/app/views/identities/_heading.html.haml +++ /dev/null @@ -1 +0,0 @@ -%h3 heading placeholder \ No newline at end of file diff --git a/app/views/identities/_login.html.haml b/app/views/identities/_login.html.haml deleted file mode 100644 index 282f1c4..0000000 --- a/app/views/identities/_login.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -= form_tag '/auth/identity/callback' do - - .form-group.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :auth_key} - Email - .col-md-4 - =email_field_tag :auth_key, nil, class: 'form-control' - - .form-group.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :password} - Password - .col-md-4 - =password_field_tag :password, nil, class: 'form-control' - %br - =link_to "(forgot password)", "/password_resets/new" - - .row - .col-md-2.col-md-offset-7.actions - %button(type="submit" id="login" class="btn btn-primary btn-block") - Log In \ No newline at end of file diff --git a/app/views/identities/_register.html.haml b/app/views/identities/_register.html.haml deleted file mode 100644 index c60f0e3..0000000 --- a/app/views/identities/_register.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -=form_tag('/auth/identity/register') do - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :name} - Name - .col-md-4 - =text_field_tag :name, nil, class: 'form-control' - - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :email} - Email - .col-md-4 - =text_field_tag :email, nil, class: 'form-control' - - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :password} - Password - .col-md-4 - =password_field_tag :password, nil, class: 'form-control' - - .form-group.required.row - .col-md-2.col-md-offset-3 - %label.control-label{for: :pasword_confirmation} - Password Confirmation - .col-md-4 - =password_field_tag :pasword_confirmation, nil, class: 'form-control' - .row - .col-md-2.col-md-offset-7 - %button(type="submit" class="btn btn-primary btn-block") - Register \ No newline at end of file diff --git a/app/views/identities/edit.html.haml b/app/views/identities/edit.html.haml deleted file mode 100644 index 35b3408..0000000 --- a/app/views/identities/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Editing identity - -= render 'form' - -= link_to 'Show', @identity -\| -= link_to 'Back', identities_path diff --git a/app/views/identities/index.html.haml b/app/views/identities/index.html.haml deleted file mode 100644 index c84ba14..0000000 --- a/app/views/identities/index.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h1 Listing identities - -%table - %thead - %tr - %th name - %th email - %th - %th - %th - - %tbody - - @identities.each do |identity| - %tr - %td= identity.name - %td= identity.email - %td= link_to 'Show', identity - %td= link_to 'Edit', edit_identity_path(identity) - %td= link_to 'Destroy', identity, method: :delete, data: { confirm: 'Are you sure?' } - -%br - -= link_to 'New Identity', new_identity_path diff --git a/app/views/identities/login.html.haml b/app/views/identities/login.html.haml deleted file mode 100644 index 76de330..0000000 --- a/app/views/identities/login.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.container-fluid - %br - %br - =render partial: 'login' \ No newline at end of file diff --git a/app/views/identities/register.html.haml b/app/views/identities/register.html.haml deleted file mode 100644 index f3948bc..0000000 --- a/app/views/identities/register.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.container-fluid - - =render partial: 'heading' - - =render partial: 'register' \ No newline at end of file diff --git a/app/views/identities/show.html.haml b/app/views/identities/show.html.haml deleted file mode 100644 index f2d9648..0000000 --- a/app/views/identities/show.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p#notice= notice - - -= link_to 'Edit', edit_identity_path(@identity) -\| -= link_to 'Back', identities_path diff --git a/app/views/invitees/_form.html.haml b/app/views/invitees/_form.html.haml deleted file mode 100644 index c614403..0000000 --- a/app/views/invitees/_form.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= form_for @invitee do |f| - - if @invitee.errors.any? - #error_explanation - %h2= "#{pluralize(@invitee.errors.count, "error")} prohibited this invitee from being saved:" - %ul - - @invitee.errors.full_messages.each do |message| - %li= message - = form_for @invitee do |f| - .row - .col-md-4 - .form-group - = f.label :email, "Email Address", :class => "control-label" - %br - = f.text_field :email, class: "form-control", placeholder: "[account@organization.org]" - .col-md-4 - .form-group - %div(id="expiration-date-picker") - .form-group - =f.label :expires_at, "Expiration Date", :class => "control-label" - =f.date_field :expires_at, class: "form-control" - .col-md-4 - .form-group - = f.label :role, "Role", :class => "control-label" - %br - = f.select(:role, @role_arr, {prompt: true}, {class: "form-control"}) - .row - .col-md-2.col-md-offset-10.actions - %button(type="submit" class="btn btn-primary btn-block") - Add - diff --git a/app/views/invitees/_invitee.json.jbuilder b/app/views/invitees/_invitee.json.jbuilder deleted file mode 100644 index eb77c86..0000000 --- a/app/views/invitees/_invitee.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! invitee, :id, :created_at, :updated_at -json.url invitee_url(invitee, format: :json) diff --git a/app/views/invitees/edit.html.haml b/app/views/invitees/edit.html.haml deleted file mode 100644 index 9ab56f5..0000000 --- a/app/views/invitees/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Editing invitee - -= render 'form' - -= link_to 'Show', @invitee -\| -= link_to 'Back', invitees_path diff --git a/app/views/invitees/index.html.haml b/app/views/invitees/index.html.haml deleted file mode 100644 index 2462567..0000000 --- a/app/views/invitees/index.html.haml +++ /dev/null @@ -1,38 +0,0 @@ -.container-fluid - - -if can? :manage, Invitee - - -if @invitees && @invitees.count > 0 - %h3 Invitees - .pull-right - = link_to 'Add new Invitee', new_invitee_path, class: "btn btn-primary idb" - %table.table.table-stripped - %thead - %tr.row - %th.col-md-3 - %strong Email - %th.col-md-3 - %strong Role - %th.col-md-2 - %strong Expires - %th.col-md-4(colspan="2" ) - %strong Actions - %tbody - -@invitees.each do |invitee| - %tr.row - %td.col-md-3 - =link_to invitee.email, invitee - %td.col-md-3 - =invitee.role - %td.col-md-2 - -if invitee.expires_at - =invitee.expires_at.strftime('%Y-%m-%d') - -else - does not expire - %td.col-md-2 - =link_to 'Edit', edit_invitee_path(invitee), class: "btn btn-block btn-success idb" - %td.col-md-2 - =link_to 'Delete', invitee, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-block btn-danger idb" - -else - .jumbotron - This page is for managing access to Illinois Data Bank without a NetID. If you are an administrator, log in to manage accounts. diff --git a/app/views/invitees/index.json.jbuilder b/app/views/invitees/index.json.jbuilder deleted file mode 100644 index 5c18b89..0000000 --- a/app/views/invitees/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @invitees, partial: 'invitees/invitee', as: :invitee diff --git a/app/views/invitees/new.html.haml b/app/views/invitees/new.html.haml deleted file mode 100644 index 244db8d..0000000 --- a/app/views/invitees/new.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1 New invitee - -= render 'form' - -= link_to 'Back', invitees_path diff --git a/app/views/invitees/show.html.haml b/app/views/invitees/show.html.haml deleted file mode 100644 index b94a8a6..0000000 --- a/app/views/invitees/show.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p#notice= notice - - -= link_to 'Edit', edit_invitee_path(@invitee) -\| -= link_to 'Back', invitees_path diff --git a/app/views/invitees/show.json.jbuilder b/app/views/invitees/show.json.jbuilder deleted file mode 100644 index 6befeb6..0000000 --- a/app/views/invitees/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "invitees/invitee", invitee: @invitee diff --git a/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml new file mode 100644 index 0000000..f137ebd --- /dev/null +++ b/app/views/sessions/new.html.haml @@ -0,0 +1,8 @@ +=form_tag('/auth/developer/callback', method: :post, no_validate: 'noValidate') do + = label_tag :email, 'Email:' + = text_field_tag :email + = label_tag :name, 'Name:' + = text_field_tag :name + = label_tag :role, 'Role:' + = text_field_tag :role + %button{type: 'submit'} Sign In \ No newline at end of file diff --git a/app/views/shared/_header_navbar.html.haml b/app/views/shared/_header_navbar.html.haml index 237b076..8d0a0e6 100644 --- a/app/views/shared/_header_navbar.html.haml +++ b/app/views/shared/_header_navbar.html.haml @@ -32,20 +32,15 @@ Contact Us %ul.nav.navbar-nav.navbar-right - if current_user - -if current_user.role == Databank::UserRole::NETWORK_REVIEWER - %li - %a{href: "/data_curation_network/my_account"} - =current_user.name - -else - %li - %a{href: "/datasets?editor=#{current_user.username}"} - =current_user.name + %li + %a{href: "/datasets?editor=#{current_user.username}"} + =current_user.name %li %a{href: "/logout"} Log out - elsif Rails.env.development? || Rails.env.test? %li - %a{href: "/identities/login"} + %a{href: "/login"} Log in Local - else %li diff --git a/bin/setup_local b/bin/setup_local new file mode 100755 index 0000000..9256a69 --- /dev/null +++ b/bin/setup_local @@ -0,0 +1,46 @@ +#!/usr/bin/env ruby +require 'fileutils' + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +FileUtils.chdir APP_ROOT do + # This script is a way to setup your test/development environment automatically. + # Add necessary setup steps to this file. + + puts '== Sleeping to wait for docker to compose dependencies ==' + sleep 40 + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Preparing database ==" + system! 'bin/rails db:prepare' + + puts "\n== Preparing solr cores ==" + system! 'curl "http://sunspot:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test"' + + puts "\n== Ensure local buckets ==" + system! 'bin/rails minio:ensure_local_buckets' + + puts "\n== Loading fixtures ==" + system! 'bin/rails db:fixtures:load' + + puts "\n== Storing seed datafiles ==" + system! 'bin/rails testing:store_seed_datafiles' + + puts "\n== Reindex solr ==" + system! 'bin/rails sunspot:reindex' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Start delayed jobs ==" + system! 'bin/delayed_job start' + +end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 1375c92..b7c212c 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -2,11 +2,30 @@ Rails.application.config.middleware.use OmniAuth::Builder do - provider :identity, - :fields => [:email, :name], - :on_failed_registration => WelcomeController.action(:on_failed_registration) + if Rails.env.development? || Rails.env.test? + provider :developer, :fields => [:email, :name, :role], :uid_field => :email - provider :shibboleth, shib_opts.symbolize_keys + # host: localhost + # uid_field: eppn + # extra_fields: + # - eppn + # - unscoped-affiliation + # - uid + # - sn + # - nickname + # - mail + # - givenName + # - displayName + # - iTrustAffiliation + # - uiucEduStudentLevelCode + # request_type: header + # info_fields: + # name: displayName + # email: mail + + else + provider :shibboleth, shib_opts.symbolize_keys + end end diff --git a/config/routes.rb b/config/routes.rb index 3c0409f..b1611b3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,6 @@ get '/contact', to: 'welcome#contact' resources :contributors draw :creator - draw :data_curation_network draw :datafile draw :dataset post '/ensure_local_buckets', to: 'welcome#ensure_local_buckets' diff --git a/config/routes/auth.rb b/config/routes/auth.rb index 892869f..1035898 100644 --- a/config/routes/auth.rb +++ b/config/routes/auth.rb @@ -6,6 +6,7 @@ match '/login', to: 'sessions#new', as: :login, via: [:get, :post] match '/logout', to: 'sessions#destroy', as: :logout, via: [:get, :post] get "/on_failed_registration", to: "welcome#on_failed_registration" +match '/auth/:provider', to: 'sessions#new', via: [:get, :post] resources :password_resets, only: [:new, :create, :edit, :update] resources :user_abilities get '/welcome/deposit_login_modal', to: 'welcome#deposit_login_modal' \ No newline at end of file diff --git a/config/routes/data_curation_network.rb b/config/routes/data_curation_network.rb deleted file mode 100644 index 9daaa7f..0000000 --- a/config/routes/data_curation_network.rb +++ /dev/null @@ -1,12 +0,0 @@ -resources :data_curation_network, only: [:index] do - collection do - get 'accounts' - get 'login' - get 'register' - get 'my_account' - get 'datasets' - get 'after_registration' - get 'accounts/add', to: 'data_curation_network#add_account' - get 'accounts/:id/edit', to: 'data_curation_network#edit_account' - end -end \ No newline at end of file diff --git a/docker-compose.local-test.yml b/docker-compose.local-test.yml index 041011f..f2ce519 100644 --- a/docker-compose.local-test.yml +++ b/docker-compose.local-test.yml @@ -17,4 +17,4 @@ services: - "3000:3000" volumes: - .:/app - command: bash -c 'sleep 40 && RAILS_ENV=test bundle exec rails db:drop db:create db:schema:load --trace && curl "http://sunspot:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test" && RAILS_ENV=test bundle exec rails minio:ensure_local_buckets && RAILS_ENV=test bundle exec rails db:fixtures:load && RAILS_ENV=test bundle exec rails testing:store_seed_datafiles && RAILS_ENV=test bundle exec rails local_identity:make_testers && RAILS_ENV=test bundle exec rails sunspot:reindex && bin/delayed_job start && RAILS_ENV=test bundle exec rails server -b 0.0.0.0' \ No newline at end of file + command: bash -c 'sleep 40 && RAILS_ENV=test bundle exec rails db:drop db:create db:schema:load --trace && curl "http://sunspot:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test" && RAILS_ENV=test bundle exec rails minio:ensure_local_buckets && RAILS_ENV=test bundle exec rails db:fixtures:load && RAILS_ENV=test bundle exec rails testing:store_seed_datafiles && RAILS_ENV=test bundle exec rails sunspot:reindex && bin/delayed_job start && RAILS_ENV=test bundle exec rails server -b 0.0.0.0' \ No newline at end of file diff --git a/features/step_definitions/dataset.rb b/features/step_definitions/dataset.rb index d2becd4..190adb3 100644 --- a/features/step_definitions/dataset.rb +++ b/features/step_definitions/dataset.rb @@ -4,5 +4,5 @@ datafile = FactoryBot.create(:datafile, {dataset_id: dataset.id}) StorageManager.instance.draft_root.write_string_to(datafile.storage_key, "test") dataset = Dataset.find_by(id: dataset.id) # to populate nested collections - dataset.publish(User::User.system_user) + dataset.publish(User.system_user) end diff --git a/lib/tasks/databank.rake b/lib/tasks/databank.rake index 7ec1c1f..30bb9de 100644 --- a/lib/tasks/databank.rake +++ b/lib/tasks/databank.rake @@ -145,7 +145,7 @@ namespace :databank do desc "Clear users" task clear_users: :environment do - User::User.all.each do |user| + User.all.each do |user| user.destroy end Identity.all.each do |identity| @@ -158,27 +158,6 @@ namespace :databank do Rails.cache.clear end - desc 'Create demo users' - task :create_users => :environment do - salt = BCrypt::Engine.generate_salt - encrypted_password = BCrypt::Engine.hash_secret("demo", salt) - - num_accounts = 10 - - (1..num_accounts).each do |i| - identity = Identity.find_or_create_by(email: "demo#{i}@example.edu") - identity.name = "Demo#{i} Depositor" - identity.password_digest = encrypted_password - identity.save! - end - - # create rspec test user -- not just identity - auth = OmniAuth.config.mock_auth[:identity] - user = User::Identity.create_with_omniauth(auth) - user.save! - - end - desc 'Retroactively set publication_state' task :update_state => :environment do Dataset.where.not(identifier: "").each do |dataset| diff --git a/lib/tasks/fix.rake b/lib/tasks/fix.rake index 64f56c3..0a1ee1e 100644 --- a/lib/tasks/fix.rake +++ b/lib/tasks/fix.rake @@ -85,7 +85,7 @@ namespace :fix do invitee.update_attribute("role", Databank::UserRole::NETWORK_REVIEWER) end - User::Identity.where(role: "reviewer").each do |user| + User.where(role: "reviewer").each do |user| user.update_attribute("role", Databank::UserRole::NETWORK_REVIEWER) end end diff --git a/lib/tasks/local_identity.rake b/lib/tasks/local_identity.rake deleted file mode 100644 index 6f335be..0000000 --- a/lib/tasks/local_identity.rake +++ /dev/null @@ -1,63 +0,0 @@ -namespace :local_identity do - desc 'generate dev local identities' - task :make_admins => :environment do - # create local identity accounts for admins - admins = IDB_CONFIG[:admin][:netids].split(",").collect {|x| x.strip || x} - admins.each do |netid| - email = "#{netid}@illinois.edu" - name = "admin #{netid}" - invitee = Invitee.find_or_create_by(email: email) - invitee.role = Databank::UserRole::ADMIN - invitee.expires_at = Time.zone.now + 1.years - invitee.save! - identity = Identity.find_or_create_by(email: email) - salt = BCrypt::Engine.generate_salt - localpass = IDB_CONFIG[:admin][:localpass] - encrypted_password = BCrypt::Engine.hash_secret(localpass, salt) - identity.password_digest = encrypted_password - identity.update(password: localpass, password_confirmation: localpass) - identity.name = name - identity.activated = true - identity.activated_at = Time.zone.now - identity.save! - end - end - - desc 'make tester accounts' - task :make_testers => :environment do - roles = [ - Databank::UserRole::ADMIN, - Databank::UserRole::DEPOSITOR, - Databank::UserRole::GUEST, - Databank::UserRole::NO_DEPOSIT, - Databank::UserRole::NETWORK_REVIEWER, - Databank::UserRole::PUBLISHER_REVIEWER, - Databank::UserRole::CREATOR - ] - roles.each do |role| - Identity.create_test_account(name: "#{role}1", email: "#{role}1@mailinator.com", role: role) - Identity.create_test_account(name: "#{role}2", email: "#{role}2@mailinator.com", role: role) - end - end - - desc 'make special character account(s)' - task :make_edge_case => :environment do - # with apostrophe in name - email = "idb_test@mailinator.com" - invitee = Invitee.find_or_create_by(email: email) - invitee.role = Databank::UserRole::DEPOSITOR - invitee.expires_at = Time.zone.now + 1.years - invitee.save! - identity = Identity.find_or_create_by(email: email) - salt = BCrypt::Engine.generate_salt - localpass = IDB_CONFIG[:admin][:localpass] - encrypted_password = BCrypt::Engine.hash_secret(localpass, salt) - identity.password_digest = encrypted_password - identity.update(password: localpass, password_confirmation: localpass) - identity.name = "Joy O'Keefe" - identity.activated = true - identity.activated_at = Time.zone.now - identity.save! - end - -end \ No newline at end of file diff --git a/lib/tasks/pub.rake b/lib/tasks/pub.rake index c75cfa7..4ee4f6a 100644 --- a/lib/tasks/pub.rake +++ b/lib/tasks/pub.rake @@ -4,7 +4,7 @@ namespace :pub do desc 'update publication state for datasets with current or past release date' task :update_state => :environment do - @current_user = User::User.system_user + @current_user = User.system_user Dataset.all.each do |dataset| diff --git a/test/fixtures/identities.yml b/test/fixtures/identities.yml deleted file mode 100644 index c768f50..0000000 --- a/test/fixtures/identities.yml +++ /dev/null @@ -1,67 +0,0 @@ -## -# Every identity in this file MUST have a corresponding User::Identity in -# `user/identities.yml`, AND an Invitee in invitees.yml. -# - -<% password_digest = BCrypt::Engine.hash_secret("password", BCrypt::Engine.generate_salt) %> - -curator1: - id: 1 - invitee_id: 1 - name: $LABEL - email: $LABEL@mailinator.com - password_digest: <%= password_digest %> - activation_digest: <%= password_digest %> - activated: true - activated_at: <%=Time.zone.now %> - created_at: <%= 5.day.ago.to_fs(:db) %> - updated_at: <%= 5.day.ago.to_fs(:db) %> - -curator2: - id: 2 - invitee_id: 2 - name: $LABEL - email: $LABEL@mailinator.com - password_digest: <%= password_digest %> - activation_digest: <%= password_digest %> - activated: true - activated_at: <%=Time.zone.now %> - created_at: <%= 5.day.ago.to_fs(:db) %> - updated_at: <%= 5.day.ago.to_fs(:db) %> - -researcher1: - id: 3 - invitee_id: 3 - name: $LABEL - email: $LABEL@mailinator.com - password_digest: <%= password_digest %> - activation_digest: <%= password_digest %> - activated: true - activated_at: <%=Time.zone.now %> - created_at: <%= 5.day.ago.to_fs(:db) %> - updated_at: <%= 5.day.ago.to_fs(:db) %> - -researcher2: - id: 4 - invitee_id: 4 - name: $LABEL - email: $LABEL@mailinator.com - password_digest: <%= password_digest %> - activation_digest: <%= password_digest %> - activated: true - activated_at: <%=Time.zone.now %> - created_at: <%= 5.day.ago.to_fs(:db) %> - updated_at: <%= 5.day.ago.to_fs(:db) %> - -researcher3: - id: 5 - invitee_id: 5 - name: $LABEL - email: $LABEL@mailinator.com - password_digest: <%= password_digest %> - activation_digest: <%= password_digest %> - activated: true - activated_at: <%=Time.zone.now %> - created_at: <%= 5.day.ago.to_fs(:db) %> - updated_at: <%= 5.day.ago.to_fs(:db) %> - diff --git a/test/fixtures/invitees.yml b/test/fixtures/invitees.yml deleted file mode 100644 index 6169713..0000000 --- a/test/fixtures/invitees.yml +++ /dev/null @@ -1,39 +0,0 @@ -curator1: - id: 1 - email: $LABEL@mailinator.com - role: admin - expires_at: <%= Time.zone.now + 1.years %> - created_at: <%= 6.day.ago.to_fs(:db) %> - updated_at: <%= 6.day.ago.to_fs(:db) %> - -curator2: - id: 2 - email: $LABEL@mailinator.com - role: admin - expires_at: <%= Time.zone.now + 1.years %> - created_at: <%= 6.day.ago.to_fs(:db) %> - updated_at: <%= 6.day.ago.to_fs(:db) %> - -researcher1: - id: 3 - email: $LABEL@mailinator.com - role: depositor - expires_at: <%= Time.zone.now + 1.years %> - created_at: <%= 6.day.ago.to_fs(:db) %> - updated_at: <%= 6.day.ago.to_fs(:db) %> - -researcher2: - id: 4 - email: $LABEL@mailinator.com - role: depositor - expires_at: <%= Time.zone.now + 1.years %> - created_at: <%= 6.day.ago.to_fs(:db) %> - updated_at: <%= 6.day.ago.to_fs(:db) %> - -researcher3: - id: 5 - email: $LABEL@mailinator.com - role: depositor - expires_at: <%= Time.zone.now + 1.years %> - created_at: <%= 6.day.ago.to_fs(:db) %> - updated_at: <%= 6.day.ago.to_fs(:db) %> diff --git a/test/fixtures/user/identities.yml b/test/fixtures/users.yml similarity index 83% rename from test/fixtures/user/identities.yml rename to test/fixtures/users.yml index 87b16ee..8017a00 100644 --- a/test/fixtures/user/identities.yml +++ b/test/fixtures/users.yml @@ -1,9 +1,5 @@ -## -# Every User::Identity in this file MUST have a corresponding -# Identity in `identities.yml`. -# curator1: - provider: identity + provider: developer uid: $LABEL@mailinator.com name: $LABEL email: $LABEL@mailinator.com @@ -13,7 +9,7 @@ curator1: updated_at: <%= 5.day.ago.to_fs(:db) %> curator2: - provider: identity + provider: developer uid: $LABEL@mailinator.com name: $LABEL email: $LABEL@mailinator.com @@ -23,7 +19,7 @@ curator2: updated_at: <%= 5.day.ago.to_fs(:db) %> researcher1: - provider: identity + provider: developer uid: $LABEL@mailinator.com name: $LABEL email: $LABEL@mailinator.com @@ -33,7 +29,7 @@ researcher1: updated_at: <%= 5.day.ago.to_fs(:db) %> researcher2: - provider: identity + provider: developer uid: $LABEL@mailinator.com name: $LABEL email: $LABEL@mailinator.com @@ -43,7 +39,7 @@ researcher2: updated_at: <%= 5.day.ago.to_fs(:db) %> researcher3: - provider: identity + provider: developer uid: $LABEL@mailinator.com name: $LABEL email: $LABEL@mailinator.com @@ -51,4 +47,3 @@ researcher3: username: $LABEL created_at: <%= 5.day.ago.to_fs(:db) %> updated_at: <%= 5.day.ago.to_fs(:db) %> - From 2812a0c12568a81567d36f45d2c789c347f8d488 Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Fri, 1 Nov 2024 09:43:20 -0500 Subject: [PATCH 2/7] update tests to use developer strategy not identity --- docker-compose.test.yml | 2 +- test/integration/dataset_search_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index fc40857..d3f9fa7 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -15,4 +15,4 @@ services: - minio ports: - "3000:3000" - command: bash -c 'sleep 40 && RAILS_ENV=test bundle exec rails db:drop db:create db:schema:load && curl "http://sunspot:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test" && RAILS_ENV=test bundle exec rails minio:ensure_local_buckets && RAILS_ENV=test bundle exec rails local_identity:make_testers && RAILS_ENV=test bundle exec rails sunspot:reindex && RAILS_ENV=test bin/delayed_job start && RAILS_ENV=test bundle exec rails test' \ No newline at end of file + command: bash -c 'sleep 40 && RAILS_ENV=test bundle exec rails db:drop db:create db:schema:load && curl "http://sunspot:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test" && RAILS_ENV=test bundle exec rails minio:ensure_local_buckets && RAILS_ENV=test bundle exec rails sunspot:reindex && RAILS_ENV=test bin/delayed_job start && RAILS_ENV=test bundle exec rails test' \ No newline at end of file diff --git a/test/integration/dataset_search_test.rb b/test/integration/dataset_search_test.rb index 676e392..1a574b4 100644 --- a/test/integration/dataset_search_test.rb +++ b/test/integration/dataset_search_test.rb @@ -20,7 +20,7 @@ class DatasetSearchTest < ActionDispatch::IntegrationTest test "default listing for depositor" do Dataset.all.each(&:ensure_creator_editors) - @user = user_identities :researcher1 + @user = user :researcher1 log_in_as(@user) get datasets_path assert_response :success @@ -34,7 +34,7 @@ class DatasetSearchTest < ActionDispatch::IntegrationTest test "default listing for curator" do Dataset.all.each(&:ensure_creator_editors) - @user = user_identities :curator1 + @user = user :curator1 log_in_as(@user) get datasets_path assert_response :success From c5c58430711dfc86614b5c1666b4464615d49478 Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Fri, 1 Nov 2024 09:55:51 -0500 Subject: [PATCH 3/7] add debug info for developer login screen --- app/controllers/sessions_controller.rb | 1 + app/views/sessions/new.html.haml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d9b7741..0be373d 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -9,6 +9,7 @@ def new if params[:provider] && params[:provider] == 'shibboleth' session[:login_return_referer] = request.env['HTTP_REFERER'] redirect_to(shibboleth_login_path(Databank::Application.shibboleth_host)) + return end end diff --git a/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml index f137ebd..adf8957 100644 --- a/app/views/sessions/new.html.haml +++ b/app/views/sessions/new.html.haml @@ -1,3 +1,4 @@ +=debug(params) =form_tag('/auth/developer/callback', method: :post, no_validate: 'noValidate') do = label_tag :email, 'Email:' = text_field_tag :email From a0b8c763493fd6f008a1d52ea26f03b97af4aa70 Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Fri, 1 Nov 2024 10:07:01 -0500 Subject: [PATCH 4/7] ensure Shibboleth login prompt unless test or dev --- app/controllers/sessions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 0be373d..2203b9c 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -6,7 +6,7 @@ class SessionsController < ApplicationController # Responds to `GET /login` def new - if params[:provider] && params[:provider] == 'shibboleth' + unless Rails.env.test? || Rails.env.development? session[:login_return_referer] = request.env['HTTP_REFERER'] redirect_to(shibboleth_login_path(Databank::Application.shibboleth_host)) return From fc6413ea89f89bfcb7eef07bc021fc8e26c5e44c Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Fri, 1 Nov 2024 16:34:51 -0500 Subject: [PATCH 5/7] update tests to work with developer strategy not identity --- test/integration/dataset_deposit_test.rb | 2 +- test/integration/dataset_search_test.rb | 4 ++-- test/integration/dataset_version_test.rb | 2 +- test/integration/orcid_api_test.rb | 2 +- test/test_helper.rb | 9 +++++---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/integration/dataset_deposit_test.rb b/test/integration/dataset_deposit_test.rb index efac39d..9701c75 100644 --- a/test/integration/dataset_deposit_test.rb +++ b/test/integration/dataset_deposit_test.rb @@ -8,7 +8,7 @@ class DatasetDepositTest < ActionDispatch::IntegrationTest setup do - @user = user_identities :researcher1 + @user = users :researcher1 log_in_as(@user) end diff --git a/test/integration/dataset_search_test.rb b/test/integration/dataset_search_test.rb index 1a574b4..9e93477 100644 --- a/test/integration/dataset_search_test.rb +++ b/test/integration/dataset_search_test.rb @@ -20,7 +20,7 @@ class DatasetSearchTest < ActionDispatch::IntegrationTest test "default listing for depositor" do Dataset.all.each(&:ensure_creator_editors) - @user = user :researcher1 + @user = users :researcher1 log_in_as(@user) get datasets_path assert_response :success @@ -34,7 +34,7 @@ class DatasetSearchTest < ActionDispatch::IntegrationTest test "default listing for curator" do Dataset.all.each(&:ensure_creator_editors) - @user = user :curator1 + @user = users :curator1 log_in_as(@user) get datasets_path assert_response :success diff --git a/test/integration/dataset_version_test.rb b/test/integration/dataset_version_test.rb index ffdd47c..df8ae28 100644 --- a/test/integration/dataset_version_test.rb +++ b/test/integration/dataset_version_test.rb @@ -8,7 +8,7 @@ class DatasetVersionTest < ActionDispatch::IntegrationTest setup do - @user = user_identities :researcher1 + @user = users :researcher1 log_in_as(@user) end diff --git a/test/integration/orcid_api_test.rb b/test/integration/orcid_api_test.rb index 97de036..f5953d1 100644 --- a/test/integration/orcid_api_test.rb +++ b/test/integration/orcid_api_test.rb @@ -8,7 +8,7 @@ class OrcidApiTest < ActionDispatch::IntegrationTest setup do - @user = user_identities :researcher1 + @user = users :researcher1 log_in_as(@user) end diff --git a/test/test_helper.rb b/test/test_helper.rb index ad4b5fb..04ca13e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -7,7 +7,7 @@ class ActiveSupport::TestCase # Setup fixtures in test/fixtures/*.yml - fixtures :invitees, :identities, "user/identities", :datasets, :datafiles, :creators, :related_materials + fixtures :users, :datasets, :datafiles, :creators, :related_materials def self.seeding? @@seeding @@ -18,9 +18,10 @@ def self.seeding? # (local, non-shibboleth) identity provider is assumed # def log_in_as(user) - post "/auth/identity/callback", params: { - auth_key: user.email, - password: "password" + post "/auth/developer/callback", params: { + email: user.email, + name: user.name, + role: user.role } end From b54f9c41e637c13c29a82c49978aeecbbfd0507e Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Thu, 7 Nov 2024 16:11:29 -0600 Subject: [PATCH 6/7] per issue#32 link to large transfer file form and remove at from University name --- README.md | 2 +- app/models/dataset/identifiable.rb | 6 +++--- app/views/databank_mailer/_sigblock_html.html.haml | 2 +- app/views/databank_mailer/_sigblock_txt.text.haml | 2 +- .../databank_mailer/account_activation.html.haml | 2 +- .../databank_mailer/account_activation.text.haml | 2 +- app/views/datasets/_form.html.haml | 6 +++--- app/views/datasets/_new_form.html.haml | 2 +- app/views/featured_researchers/preview.html.haml | 4 ++-- app/views/layouts/application.html.haml | 2 +- app/views/policies/_access_and_use.html.haml | 2 +- app/views/policies/_accession.html.haml | 2 +- .../policies/_framework_and_definitions.html.haml | 8 ++++---- app/views/policies/_preservation.html.haml | 6 +++--- app/views/shared/_library_header.html.haml | 2 +- app/views/welcome/_welcome.html.haml | 4 ++-- db/seeds/dataset_versions.rb | 2 +- lib/demosets.json | 8 ++++---- lib/devsets.json | 8 ++++---- public/datasets.tsv | 8 ++++---- test/fixtures/datasets.yml | 14 +++++++------- test/fixtures/related_materials.yml | 2 +- test/integration/dataset_deposit_test.rb | 2 +- test/integration/orcid_api_test.rb | 2 +- 24 files changed, 50 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index fda243a..bff9dcb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![DOI](https://zenodo.org/badge/12882/medusa-project/databank.svg)](https://zenodo.org/badge/latestdoi/12882/medusa-project/databank) # Databank -Databank is the Ruby on Rails web application component of Illinois Data Bank, which is a public access repository for research data from the University of Illinois at Urbana-Champaign. +Databank is the Ruby on Rails web application component of Illinois Data Bank, which is a public access repository for research data from the University of Illinois Urbana-Champaign. Application documentation is hosted in the [SCARS Wiki](https://wiki.illinois.edu/wiki/display/scrs/SCARS+Home). \ No newline at end of file diff --git a/app/models/dataset/identifiable.rb b/app/models/dataset/identifiable.rb index 48ca476..def3385 100644 --- a/app/models/dataset/identifiable.rb +++ b/app/models/dataset/identifiable.rb @@ -269,7 +269,7 @@ def embargoed_datacite_xml titles_node.parent = resource_node publisher_node = doc.create_element("publisher") - publisher_node.content = publisher || "University of Illinois at Urbana-Champaign" + publisher_node.content = publisher || "University of Illinois Urbana-Champaign" publisher_node.parent = resource_node publication_year_node = doc.create_element("publicationYear") @@ -334,7 +334,7 @@ def withdrawn_datacite_xml titles_node.parent = resource_node publisher_node = doc.create_element("publisher") - publisher_node.content = publisher || "University of Illinois at Urbana-Champaign" + publisher_node.content = publisher || "University of Illinois Urbana-Champaign" publisher_node.parent = resource_node publication_year_node = doc.create_element("publicationYear") @@ -514,7 +514,7 @@ def complete_datacite_xml end publisher_node = doc.create_element("publisher") - publisher_node.content = publisher || "University of Illinois at Urbana-Champaign" + publisher_node.content = publisher || "University of Illinois Urbana-Champaign" publisher_node.parent = resource_node publication_year_node = doc.create_element("publicationYear") diff --git a/app/views/databank_mailer/_sigblock_html.html.haml b/app/views/databank_mailer/_sigblock_html.html.haml index a285717..b477f6a 100644 --- a/app/views/databank_mailer/_sigblock_html.html.haml +++ b/app/views/databank_mailer/_sigblock_html.html.haml @@ -4,7 +4,7 @@ %p Research Data Service %br/ - University of Illinois at Urbana-Champaign + University of Illinois Urbana-Champaign %br/ databank@library.illinois.edu %br/ diff --git a/app/views/databank_mailer/_sigblock_txt.text.haml b/app/views/databank_mailer/_sigblock_txt.text.haml index 70eae49..e1e8c08 100644 --- a/app/views/databank_mailer/_sigblock_txt.text.haml +++ b/app/views/databank_mailer/_sigblock_txt.text.haml @@ -2,6 +2,6 @@ Thank you, Research Data Service Curators Research Data Service -University of Illinois at Urbana-Champaign +University of Illinois Urbana-Champaign databank@library.illinois.edu (217) 300-3513 diff --git a/app/views/databank_mailer/account_activation.html.haml b/app/views/databank_mailer/account_activation.html.haml index 7d36ce3..9d7d0c5 100644 --- a/app/views/databank_mailer/account_activation.html.haml +++ b/app/views/databank_mailer/account_activation.html.haml @@ -13,7 +13,7 @@ %p Research Data Service %br - University of Illinois at Urbana-Champaign + University of Illinois Urbana-Champaign %br databank@library.illinois.edu %br diff --git a/app/views/databank_mailer/account_activation.text.haml b/app/views/databank_mailer/account_activation.text.haml index 7b0c7a8..7652eee 100644 --- a/app/views/databank_mailer/account_activation.text.haml +++ b/app/views/databank_mailer/account_activation.text.haml @@ -7,6 +7,6 @@ Thank you, Research Data Service Team ="-----" Research Data Service -University of Illinois at Urbana-Champaign +University of Illinois Urbana-Champaign databank@library.illinois.edu (217) 300-3513 diff --git a/app/views/datasets/_form.html.haml b/app/views/datasets/_form.html.haml index 3094e5a..5517b98 100644 --- a/app/views/datasets/_form.html.haml +++ b/app/views/datasets/_form.html.haml @@ -23,7 +23,7 @@ = @dataset.publication_year && @dataset.publication_year != "" ? "(#{@dataset.publication_year})" : "(#{Time.now.year}):" %span( id="title-preview" ) = @dataset.title && @dataset.title != "" ? "#{@dataset.title}." : "[The Title]." - University of Illinois at Urbana-Champaign. + University of Illinois Urbana-Champaign. %span( id="doi-preview" ) = @dataset.identifier && @dataset.identifier != "" ? "#{@dataset.persistent_url}" : "" .panel-collapse.collapse.in(id="descriptionPanel" role="tabpanel" aria-labelledby="descriptionHeading" ) @@ -76,7 +76,7 @@ -else Switch to Organization Creators - = f.hidden_field :publisher, :value=>"University of Illinois at Urbana-Champaign" + = f.hidden_field :publisher, :value=>"University of Illinois Urbana-Champaign" .form-group = f.label :description, "Dataset Description", :class => "control-label" @@ -332,7 +332,7 @@ %tr.row %td - %button(type="button" id="portable-upload" class="btn btn-success fileinput-button" ) + =link_to("https://go.illinois.edu/databank_largefiletransfer", class: "btn btn-success fileinput-button idb", target: "_blank") do %span(class="large-text" ) 👟 Arrange physical pickup or Globus transfer diff --git a/app/views/datasets/_new_form.html.haml b/app/views/datasets/_new_form.html.haml index 3b50ce5..592c4c7 100644 --- a/app/views/datasets/_new_form.html.haml +++ b/app/views/datasets/_new_form.html.haml @@ -3,6 +3,6 @@ =f.hidden_field :removed_private =f.hidden_field :agree =f.hidden_field :previous_key, value: @previous_key - =f.hidden_field :publisher, value: "University of Illinois at Urbana-Champaign" + =f.hidden_field :publisher, value: "University of Illinois Urbana-Champaign" =f.hidden_field :depositor_email, class: "form-control", id: "depositor_email", :required => true =f.hidden_field :depositor_name, class: "form-control", id: "depositor_name" diff --git a/app/views/featured_researchers/preview.html.haml b/app/views/featured_researchers/preview.html.haml index 9aa21ed..d013101 100644 --- a/app/views/featured_researchers/preview.html.haml +++ b/app/views/featured_researchers/preview.html.haml @@ -6,7 +6,7 @@ %ul %li your data is in a final state and not expected to undergo revisions. %li you have removed any private, confidential, or other legally protected information from your data. - %li you are a faculty member, staff member, or graduate student at the University of Illinois at Urbana-Champaign. + %li you are a faculty member, staff member, or graduate student at the University of Illinois Urbana-Champaign. %li you have permission to publicly distribute data from all creator(s) and/or copyright owner(s). %h3 Published data: @@ -21,7 +21,7 @@ Learn how to publish your data %h3 Statement of Commitment .indent - %p The Illinois Data Bank's mission is to centralize, preserve, and provide persistent and reliable access to the research data created by affiliates of the University of Illinois at Urbana-Champaign, such as its faculty, academic staff, and graduate students. The Research Data Service at the University Library maintains and operates the Illinois Data Bank on behalf of the University of Illinois at Urbana-Champaign campus. The University Library has a long history of successfully supporting the preservation of and access to Illinois research outputs. The Illinois Data Bank operates within a robust policy framework that fully describes the University's commitment to providing persistent and reliable access to research data. + %p The Illinois Data Bank's mission is to centralize, preserve, and provide persistent and reliable access to the research data created by affiliates of the University of Illinois Urbana-Champaign, such as its faculty, academic staff, and graduate students. The Research Data Service at the University Library maintains and operates the Illinois Data Bank on behalf of the University of Illinois Urbana-Champaign campus. The University Library has a long history of successfully supporting the preservation of and access to Illinois research outputs. The Illinois Data Bank operates within a robust policy framework that fully describes the University's commitment to providing persistent and reliable access to research data. %button(type="button" class="btn btn-default" onclick="window.open('/policies')" ) Review our policies .col-md-4.featured-researcher diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ba0363c..1037325 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -55,7 +55,7 @@ - if current_page?(root_path) || ( request.original_fullpath.include?('featured_researchers') && request.original_fullpath.include?('preview') ) #welcome-image.hidden-xs #welcome-overlay - %p The Illinois Data Bank is a public access repository for publishing research data from the University of Illinois at Urbana-Champaign + %p The Illinois Data Bank is a public access repository for publishing research data from the University of Illinois Urbana-Champaign .container-fluid = yield = render partial: "shared/library_footer" diff --git a/app/views/policies/_access_and_use.html.haml b/app/views/policies/_access_and_use.html.haml index 1a9c5e2..be6da2b 100644 --- a/app/views/policies/_access_and_use.html.haml +++ b/app/views/policies/_access_and_use.html.haml @@ -13,7 +13,7 @@ %p The goal of ensuring dissemination of Datasets published in the Illinois Data Bank is fundamental to the Illinois Data Bank's mission. In order to uphold the Illinois Data Bank's commitment to facilitating access and use of - University of Illinois at Urbana-Champaign research data, the Illinois Data Bank disseminates its contents through + University of Illinois Urbana-Champaign research data, the Illinois Data Bank disseminates its contents through as many means as possible including: %ul %li diff --git a/app/views/policies/_accession.html.haml b/app/views/policies/_accession.html.haml index 8c6f7d9..10005a0 100644 --- a/app/views/policies/_accession.html.haml +++ b/app/views/policies/_accession.html.haml @@ -41,7 +41,7 @@ %p While Datasets need not be exclusively created at the University of Illinois at Urbana-Champaign, at - least one researcher from the University of Illinois at Urbana-Champaign campus with an active NetID must have + least one researcher from the University of Illinois Urbana-Champaign campus with an active NetID must have made, conceived, reduced to practice, authored or otherwise made a substantive intellectual contribution to the creation of the Dataset. %li diff --git a/app/views/policies/_framework_and_definitions.html.haml b/app/views/policies/_framework_and_definitions.html.haml index b3f1711..1a81161 100644 --- a/app/views/policies/_framework_and_definitions.html.haml +++ b/app/views/policies/_framework_and_definitions.html.haml @@ -7,11 +7,11 @@ responsibility for the operation and policies of the Illinois Data Bank. %p The Illinois Data Bank's mission is to centralize, preserve, and provide persistent and reliable access to the - research data created by affiliates of the University of Illinois at Urbana-Champaign, such as its faculty, + research data created by affiliates of the University of Illinois Urbana-Champaign, such as its faculty, academic staff, and graduate students. The Illinois Data Bank is intended to be responsive to the Illinois - research community, is supported by the University of Illinois at Urbana-Champaign, and endeavors to be both + research community, is supported by the University of Illinois Urbana-Champaign, and endeavors to be both durable and sustainable. The Illinois Data Bank is a platform for making Datasets created from research projects - by University of Illinois at Urbana-Champaign researchers publicly accessible by seeing that the research data + by University of Illinois Urbana-Champaign researchers publicly accessible by seeing that the research data is both widely discoverable and linked to associated works, such as journal articles, source code, or data deposited elsewhere. Depositing research data into the Illinois Data Bank is voluntary. %p @@ -21,7 +21,7 @@ advancement of scholarship and the public good in ways that are consistent with the U.S. President's Office of Science and Technology Policy %a{:href => "https://web.archive.org/web/20160304043850/https:/www.whitehouse.gov/sites/default/files/microsites/ostp/ostp_public_access_memo_2013.pdf"} ("OSTP") Public Access Memo - of 2013. The University of Illinois at Urbana-Champaign maintains its commitment + of 2013. The University of Illinois Urbana-Champaign maintains its commitment to seeing that restricted data are not inappropriately or inadvertently disclosed, consistent with all requirements pertaining to the collection, storage, access, use, transmission, and disposal of sensitive data. Researchers are obligated to be vigilant in seeing that such restricted data is not made publicly accessible diff --git a/app/views/policies/_preservation.html.haml b/app/views/policies/_preservation.html.haml index a8e0c2a..94af7e8 100644 --- a/app/views/policies/_preservation.html.haml +++ b/app/views/policies/_preservation.html.haml @@ -35,7 +35,7 @@ %li %p Provide or participate in a reliable preservation environment for published Datasets, where at least - one of the Creators is affiliated with the University of Illinois at Urbana-Champaign, such as its faculty, + one of the Creators is affiliated with the University of Illinois Urbana-Champaign, such as its faculty, academic staff, and graduate students. %li %p @@ -86,7 +86,7 @@ %h3 Preservation Strategies %p Datasets deposited in the Illinois Data Bank utilize the back-end storage and management services within Medusa, - the University of Illinois at Urbana-Champaign Library's digital preservation repository ( + the University of Illinois Urbana-Champaign Library's digital preservation repository ( %a{:href => "https://medusa.library.illinois.edu/"}> https://medusa.library.illinois.edu/ ). Medusa provides a common storage and management infrastructure for digital collections of enduring value to the University. At present, Medusa's collecting focus is on digitized and @@ -130,7 +130,7 @@ deposited and maintaining procedures and guidance based on these needs as necessary. %h3 Financial Sustainability %p - The University of Illinois at Urbana-Champaign makes a financial commitment toward the sustainable preservation + The University of Illinois Urbana-Champaign makes a financial commitment toward the sustainable preservation of published Datasets through funding of the Research Data Service. %h3 Technological Sustainability, Security, and Disaster Recovery %p diff --git a/app/views/shared/_library_header.html.haml b/app/views/shared/_library_header.html.haml index 57c1a7f..cedce90 100644 --- a/app/views/shared/_library_header.html.haml +++ b/app/views/shared/_library_header.html.haml @@ -1,4 +1,4 @@ %header(class="library-header img-responsive hidden-xs" ) .container-fluid %a(href="http://www.library.illinois.edu" target="_blank" ) - =image_tag("library_wordmark_orange_i.png", class: "img-responsive banner-image-library", alt: "University Library, University of Illinois at Urbana-Champaign") + =image_tag("library_wordmark_orange_i.png", class: "img-responsive banner-image-library", alt: "University Library, University of Illinois Urbana-Champaign") diff --git a/app/views/welcome/_welcome.html.haml b/app/views/welcome/_welcome.html.haml index 7773c51..17a8577 100644 --- a/app/views/welcome/_welcome.html.haml +++ b/app/views/welcome/_welcome.html.haml @@ -9,7 +9,7 @@ %ul %li your data is in a final state and not expected to undergo revisions. %li you have removed any private, confidential, or other legally protected information from your data. - %li you are a faculty member, staff member, or graduate student at the University of Illinois at Urbana-Champaign. + %li you are a faculty member, staff member, or graduate student at the University of Illinois Urbana-Champaign. %li you have permission to publicly distribute data from all creator(s) and/or copyright owner(s). %h2 Published data: @@ -24,7 +24,7 @@ Learn how to publish your data %h2 Statement of Commitment .indent - %p The Illinois Data Bank's mission is to centralize, preserve, and provide persistent and reliable access to the research data created by affiliates of the University of Illinois at Urbana-Champaign, such as its faculty, academic staff, and graduate students. The Research Data Service at the University Library maintains and operates the Illinois Data Bank on behalf of the University of Illinois at Urbana-Champaign campus. The University Library has a long history of successfully supporting the preservation of and access to Illinois research outputs. The Illinois Data Bank operates within a robust policy framework that fully describes the University's commitment to providing persistent and reliable access to research data. + %p The Illinois Data Bank's mission is to centralize, preserve, and provide persistent and reliable access to the research data created by affiliates of the University of Illinois Urbana-Champaign, such as its faculty, academic staff, and graduate students. The Research Data Service at the University Library maintains and operates the Illinois Data Bank on behalf of the University of Illinois Urbana-Champaign campus. The University Library has a long history of successfully supporting the preservation of and access to Illinois research outputs. The Illinois Data Bank operates within a robust policy framework that fully describes the University's commitment to providing persistent and reliable access to research data. %button(type="button" class="btn btn-default" onclick="window.open('/policies')" ) Review our policies -if @featured_researcher diff --git a/db/seeds/dataset_versions.rb b/db/seeds/dataset_versions.rb index 5beca39..ce1fb45 100644 --- a/db/seeds/dataset_versions.rb +++ b/db/seeds/dataset_versions.rb @@ -1,5 +1,5 @@ ds1 = Dataset.create!("title": "The Google Fonts: a preliminary analysis", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2023", "description": "This dataset was created to answer the following question: Is the Databank working properly as datasets and datafiles are propagated for testing.", "license": "CCBY4", diff --git a/lib/demosets.json b/lib/demosets.json index 1f5b845..4c82bcb 100644 --- a/lib/demosets.json +++ b/lib/demosets.json @@ -2,7 +2,7 @@ "demosets": [ { "title": "The Unicorn in LIS Literature: a preliminary analysis", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "This dataset was created to answer the following question: Does the word 'unicorn', occur in titles of Web of Science records in the 'INFORMATION SCIENCE LIBRARY SCIENCE' category? This question was asked because the Research Data Service is developing a data repository and we enjoy using unicorns in our example deposits. We also enjoy candy.", "license": "license.txt", @@ -29,7 +29,7 @@ }, { "title": "Characterization of enlO in the central metabolism of superfish", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "Superfish need to metabolize stuff.", "license": "CC01", @@ -65,7 +65,7 @@ }, { "title": "Phylogenic Analysis of Condensation Domains in the AMB Biosynthetic Pathway", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "The condensation domains in the NRPS biosynthetic gene clusters for production of antimetabolite L -2-amino-4-methoxy-trans-3-butenoic acid (AMB) in Pseudomonas aeruginosa have low homology to \"traditional\" condensation domains. This dataset contains the FASTA sequences for phylogenetic analysis of these unusual domains as well as the tree diagram representations. ", "license": "CCBY4", @@ -93,7 +93,7 @@ }, { "title": "Brain regions and molecular pathways responding to food reward type and value in honey bees.", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "This is the dataset corresponding to the article \"Brain regions and molecular pathways responding to food reward type and value in honey bees,\" published in Genes, Brain, and Behavior. PMID 26566901 DOI: 10.1111/gbb.12275 ", "license": "CCBY4", diff --git a/lib/devsets.json b/lib/devsets.json index 7b7497f..de21f60 100644 --- a/lib/devsets.json +++ b/lib/devsets.json @@ -2,7 +2,7 @@ "devsets": [ { "title": "The Google Fonts: a preliminary analysis", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "This dataset was created to answer the following question: Is the Databank working properly as datasets and datafiles are propagated for testing.", "license": "license.txt", @@ -55,7 +55,7 @@ }, { "title": "The Google Fonts: a secondary analysis", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "More files are needed for testing the Databank.", "license": "CC01", @@ -117,7 +117,7 @@ }, { "title": "The Google Fonts: a tertiary analysis", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "Even more files are needed for testing the Databank.", "license": "CCBY4", @@ -171,7 +171,7 @@ }, { "title": "Brain regions and molecular pathways responding to food reward type and value in honey bees.", - "publisher": "University of Illinois at Urbana-Champaign", + "publisher": "University of Illinois Urbana-Champaign", "publication_year": "2016", "description": "This is the dataset corresponding to the article \"Brain regions and molecular pathways responding to food reward type and value in honey bees,\" published in Genes, Brain, and Behavior. PMID 26566901 DOI: 10.1111/gbb.12275 ", "license": "CCBY4", diff --git a/public/datasets.tsv b/public/datasets.tsv index fcef883..c626a6b 100644 --- a/public/datasets.tsv +++ b/public/datasets.tsv @@ -1,5 +1,5 @@ doi ingest_date release_date num_files num_bytes total_downloads num_relationships num_creators subject citation_text -10.70114/TESTIDB-5920542_V1 2024-08-06 2002-03-10 2 149749 0 0 2 Example, Researcher1; Example, Researcher2 (2002): More Import Exploration. University of Illinois at Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-5920542_V1 -10.70114/TESTIDB-2153199_V1 2024-08-06 2002-06-10 2 22194 0 0 2 Example, Researcher1; Example, Researcher2 (2002): New to Us. University of Illinois at Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-2153199_V1 -10.70114/TESTIDB-5720850_V1 2024-08-06 2017-08-14 2 31193 0 0 1 Example, Researcher1 (2017): Example: File Embargo - File Only Publication Delay. University of Illinois at Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-5720850_V1 -10.70114/TESTIDB-J8PN93H8 2024-08-06 2016-05-19 1 718560 0 42 1 Technology and Engineering Example, Researcher1 (2016): New York City Taxi Trip Data (2010-2013). University of Illinois at Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-J8PN93H8 +10.70114/TESTIDB-5920542_V1 2024-08-06 2002-03-10 2 149749 0 0 2 Example, Researcher1; Example, Researcher2 (2002): More Import Exploration. University of Illinois Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-5920542_V1 +10.70114/TESTIDB-2153199_V1 2024-08-06 2002-06-10 2 22194 0 0 2 Example, Researcher1; Example, Researcher2 (2002): New to Us. University of Illinois Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-2153199_V1 +10.70114/TESTIDB-5720850_V1 2024-08-06 2017-08-14 2 31193 0 0 1 Example, Researcher1 (2017): Example: File Embargo - File Only Publication Delay. University of Illinois Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-5720850_V1 +10.70114/TESTIDB-J8PN93H8 2024-08-06 2016-05-19 1 718560 0 42 1 Technology and Engineering Example, Researcher1 (2016): New York City Taxi Trip Data (2010-2013). University of Illinois Urbana-Champaign. https://www.example.org/10.70114/TESTIDB-J8PN93H8 diff --git a/test/fixtures/datasets.yml b/test/fixtures/datasets.yml index a02246d..6583276 100644 --- a/test/fixtures/datasets.yml +++ b/test/fixtures/datasets.yml @@ -4,7 +4,7 @@ draft1: key: "TESTIDB-1423696" title: "Measurements" identifier: "" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "Heights, Weights, and Counts" license: "CC01" depositor_name: "researcher1" @@ -34,7 +34,7 @@ draft2: key: "TESTIDB-3569656" title: "Phenomenon" identifier: "10.70114/DEMOIDB-3569656_V1" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "Interesting Things that Happened" license: "CCBY4" depositor_name: "researcher2" @@ -64,7 +64,7 @@ released1: key: "TESTIDB-5920542" title: "More Import Exploration" identifier: "10.70114/TESTIDB-5920542_V1" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" license: "CC01" depositor_name: "researcher1" depositor_email: "researcher1@mailinator.com" @@ -93,7 +93,7 @@ released2: key: "TESTIDB-2153199" title: "New to Us" identifier: "10.70114/TESTIDB-2153199_V1" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "" license: "CC01" depositor_name: "researcher2" @@ -124,7 +124,7 @@ file_and_metadata_permanent_suppression: key: "TESTIDB-2239233" title: "Example: File and Metadata Permanent Suppression" identifier: "10.70114/TESTIDB-2239233_V1" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "Example of an Illinois Data Bank record with a File and Metadata Permanent Suppression." license: "CC01" depositor_name: "researcher1" @@ -155,7 +155,7 @@ file_embargo_file_only_publication_delay: key: "TESTIDB-5720850" title: "Example: File Embargo - File Only Publication Delay" identifier: "10.70114/TESTIDB-5720850_V1" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "This is the embargo dataset example - file only publication delay. One year delay. " license: "CC01" depositor_name: "researcher1" @@ -185,7 +185,7 @@ released3: key: "TESTIDB-9610843" title: "New York City Taxi Trip Data (2010-2013)" identifier: "10.70114/TESTIDB-J8PN93H8" - publisher: "University of Illinois at Urbana-Champaign" + publisher: "University of Illinois Urbana-Champaign" description: "This dataset contains records of four years of taxi operations in New York City and includes 697,622,444 trips. Each trip records the pickup and drop-off dates, times, and coordinates, as well as the metered distance reported by the taximeter. The trip data also includes fields such as the taxi medallion number, fare amount, and tip amount. The dataset was obtained through a Freedom of Information Law request from the New York City Taxi and Limousine Commission.\r\n\r\nThe files in this dataset are optimized for use with the ‘decompress.py’ script included in this dataset. This file has additional documentation and contact information that may be of help if you run into trouble accessing the content of the zip files." license: "CC01" depositor_name: "researcher1" diff --git a/test/fixtures/related_materials.yml b/test/fixtures/related_materials.yml index 90e83ce..1cc908c 100644 --- a/test/fixtures/related_materials.yml +++ b/test/fixtures/related_materials.yml @@ -20,7 +20,7 @@ dataset1: uri: "10.13012/B2IDB-4900670_V1" uri_type: "DOI" citation: - "Donovan Brian; Mori Alec; Agrawal Nimit; Meng Yalan; Lee Jong; Work Daniel (2016): New York City Hourly Traffic Estimates (2010-2013). University of Illinois at Urbana-Champaign. https://doi.org/10.13012/B2IDB-4900670_V1" + "Donovan Brian; Mori Alec; Agrawal Nimit; Meng Yalan; Lee Jong; Work Daniel (2016): New York City Hourly Traffic Estimates (2010-2013). University of Illinois Urbana-Champaign. https://doi.org/10.13012/B2IDB-4900670_V1" dataset_id: 13 created_at: Wed 29 Jun 2016 20:06:19.373154000 UTC +00:00 updated_at: Mon 12 Jun 2017 18:50:17.878883000 UTC +00:00 diff --git a/test/integration/dataset_deposit_test.rb b/test/integration/dataset_deposit_test.rb index 9701c75..b1eaaf9 100644 --- a/test/integration/dataset_deposit_test.rb +++ b/test/integration/dataset_deposit_test.rb @@ -21,7 +21,7 @@ class DatasetDepositTest < ActionDispatch::IntegrationTest def create_dataset assert_difference "Dataset.count" do - post datasets_path, params: { dataset: { publisher: "University of Illinois at Urbana-Champaign", + post datasets_path, params: { dataset: { publisher: "University of Illinois Urbana-Champaign", resource_type: "Dataset", license: "CC01", depositor_name: "researcher1", diff --git a/test/integration/orcid_api_test.rb b/test/integration/orcid_api_test.rb index f5953d1..8503fc3 100644 --- a/test/integration/orcid_api_test.rb +++ b/test/integration/orcid_api_test.rb @@ -23,7 +23,7 @@ class OrcidApiTest < ActionDispatch::IntegrationTest test "fetch orcid person" do expected_person_record = {family_name: "Fallaw", given_names: "Colleen", - affiliation: "University of Illinois at Urbana-Champaign"} + affiliation: "University of Illinois Urbana-Champaign"} person_search_result = Creator.orcid_person(orcid: "0000-0002-0339-9809") assert_equal(expected_person_record, person_search_result) end From 8ac01aae62ecce45c597133ceb847e9f122e5a1b Mon Sep 17 00:00:00 2001 From: Colleen Fallaw Date: Fri, 8 Nov 2024 14:02:22 -0600 Subject: [PATCH 7/7] update assertion for Orcid affiliation test --- test/integration/orcid_api_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/orcid_api_test.rb b/test/integration/orcid_api_test.rb index 8503fc3..f5953d1 100644 --- a/test/integration/orcid_api_test.rb +++ b/test/integration/orcid_api_test.rb @@ -23,7 +23,7 @@ class OrcidApiTest < ActionDispatch::IntegrationTest test "fetch orcid person" do expected_person_record = {family_name: "Fallaw", given_names: "Colleen", - affiliation: "University of Illinois Urbana-Champaign"} + affiliation: "University of Illinois at Urbana-Champaign"} person_search_result = Creator.orcid_person(orcid: "0000-0002-0339-9809") assert_equal(expected_person_record, person_search_result) end