Class: ProjectImportData

Inherits:
ApplicationRecord show all
Includes:
Gitlab::EncryptedAttribute
Defined in:
app/models/project_import_data.rb

Constant Summary collapse

OPTIMISTIC_TIMEOUT =

Timeout strategy can only be changed via API, currently only with GitHub and BitBucket Server

"optimistic"
PESSIMISTIC_TIMEOUT =
"pessimistic"
TIMEOUT_STRATEGIES =
[OPTIMISTIC_TIMEOUT, PESSIMISTIC_TIMEOUT].freeze

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Instance Method Details

#merge_credentials(hash) ⇒ Object



44
45
46
# File 'app/models/project_import_data.rb', line 44

def merge_credentials(hash)
  self.credentials = credentials.to_h.merge(hash) unless hash.empty?
end

#merge_data(hash) ⇒ Object



40
41
42
# File 'app/models/project_import_data.rb', line 40

def merge_data(hash)
  self.data = data.to_h.merge(hash) unless hash.empty?
end

#symbolize_credentialsObject



35
36
37
38
# File 'app/models/project_import_data.rb', line 35

def symbolize_credentials
  # bang doesn't work here - attr_encrypted makes it not to work
  self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
end

#user_mapping_enabled?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'app/models/project_import_data.rb', line 48

def user_mapping_enabled?
  self.data&.dig('user_contribution_mapping_enabled') || false
end