Commit b9765439 authored by James Lopez's avatar James Lopez

fix some issues with credentials

parent 5e51fce4
...@@ -22,7 +22,7 @@ class ProjectImportData < ActiveRecord::Base ...@@ -22,7 +22,7 @@ class ProjectImportData < ActiveRecord::Base
before_validation :symbolize_credentials before_validation :symbolize_credentials
def symbolize_credentials def symbolize_credentials
return if credentials.blank? # bang doesn't work here
credentials.deep_symbolize_keys! self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
end end
end end
...@@ -6,10 +6,10 @@ module Gitlab ...@@ -6,10 +6,10 @@ module Gitlab
attr_reader :consumer, :api attr_reader :consumer, :api
def self.from_project(project) def self.from_project(project)
credentials = project.import_data if project.import_data import_data_credentials = project.import_data.credentials if project.import_data
if credentials && credentials[:bb_session] if import_data_credentials && import_data_credentials[:bb_session]
token = credentials[:bb_session][:bitbucket_access_token] token = import_data_credentials[:bb_session][:bitbucket_access_token]
token_secret = credentials[:bb_session][:bitbucket_access_token_secret] token_secret = import_data_credentials[:bb_session][:bitbucket_access_token_secret]
new(token, token_secret) new(token, token_secret)
else else
raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}" raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
...@@ -131,7 +131,7 @@ module Gitlab ...@@ -131,7 +131,7 @@ module Gitlab
end end
def config def config
Gitlab.config.omniauth.providers.find { |provider| provider.name == "bitbucket"} Gitlab.config.omniauth.providers.find { |provider| provider.name == "bitbucket" }
end end
def bitbucket_options def bitbucket_options
......
...@@ -31,7 +31,7 @@ module Gitlab ...@@ -31,7 +31,7 @@ module Gitlab
private private
def import_data_credentials def import_data_credentials
@import_data_credentials ||= project.import_data if project.import_data @import_data_credentials ||= project.import_data.credentials if project.import_data
end end
def user_map def user_map
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment