BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
26628fb9
Commit
26628fb9
authored
Dec 15, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BB importer: Fixed bug with putting expired token to a project.clone_url
parent
076cdd20
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
bitbucket_controller.rb
app/controllers/import/bitbucket_controller.rb
+3
-0
client.rb
lib/bitbucket/client.rb
+2
-2
connection.rb
lib/bitbucket/connection.rb
+2
-2
project_creator.rb
lib/gitlab/bitbucket_import/project_creator.rb
+1
-1
No files found.
app/controllers/import/bitbucket_controller.rb
View file @
26628fb9
...
...
@@ -49,6 +49,9 @@ class Import::BitbucketController < Import::BaseController
namespace
=
find_or_create_namespace
(
@target_namespace
,
current_user
)
if
current_user
.
can?
(
:create_projects
,
namespace
)
# The token in a session can be expired, we need to get most recent one because
# Bitbucket::Connection class refreshes it.
session
[
:bitbucket_token
]
=
bitbucket_client
.
connection
.
token
@project
=
Gitlab
::
BitbucketImport
::
ProjectCreator
.
new
(
repo
,
@project_name
,
namespace
,
current_user
,
credentials
).
execute
else
render
'unauthorized'
...
...
lib/bitbucket/client.rb
View file @
26628fb9
module
Bitbucket
class
Client
attr_reader
:connection
def
initialize
(
options
=
{})
@connection
=
Connection
.
new
(
options
)
end
...
...
@@ -48,8 +50,6 @@ module Bitbucket
private
attr_reader
:connection
def
get_collection
(
path
,
type
)
paginator
=
Paginator
.
new
(
connection
,
path
,
type
)
Collection
.
new
(
paginator
)
...
...
lib/bitbucket/connection.rb
View file @
26628fb9
...
...
@@ -4,6 +4,8 @@ module Bitbucket
DEFAULT_BASE_URI
=
'https://api.bitbucket.org/'
DEFAULT_QUERY
=
{}
attr_reader
:expires_at
,
:expires_in
,
:refresh_token
,
:token
def
initialize
(
options
=
{})
@api_version
=
options
.
fetch
(
:api_version
,
DEFAULT_API_VERSION
)
@base_uri
=
options
.
fetch
(
:base_uri
,
DEFAULT_BASE_URI
)
...
...
@@ -38,8 +40,6 @@ module Bitbucket
private
attr_reader
:expires_at
,
:expires_in
,
:refresh_token
,
:token
def
client
@client
||=
OAuth2
::
Client
.
new
(
provider
.
app_id
,
provider
.
app_secret
,
options
)
end
...
...
lib/gitlab/bitbucket_import/project_creator.rb
View file @
26628fb9
...
...
@@ -21,7 +21,7 @@ module Gitlab
visibility_level:
repo
.
visibility_level
,
import_type:
'bitbucket'
,
import_source:
repo
.
full_name
,
import_url:
repo
.
clone_url
(
@
session_data
[
:token
]),
import_url:
repo
.
clone_url
(
session_data
[
:token
]),
import_data:
{
credentials:
session_data
}
).
execute
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment