Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
b50a2289
Commit
b50a2289
authored
May 23, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor construction of response
parent
0a0f66c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
lib/api/helpers/internal_helpers.rb
lib/api/helpers/internal_helpers.rb
+16
-0
lib/api/internal.rb
lib/api/internal.rb
+6
-14
No files found.
lib/api/helpers/internal_helpers.rb
View file @
b50a2289
...
@@ -42,6 +42,22 @@ module API
...
@@ -42,6 +42,22 @@ module API
@project
,
@wiki
=
Gitlab
::
RepoPath
.
parse
(
params
[
:project
])
@project
,
@wiki
=
Gitlab
::
RepoPath
.
parse
(
params
[
:project
])
end
end
end
end
# Project id to pass between components that don't share/don't have
# access to the same filesystem mounts
def
gl_repository
Gitlab
::
GlRepository
.
gl_repository
(
project
,
wiki?
)
end
# Return the repository full path so that gitlab-shell has it when
# handling ssh commands
def
repository_path
if
wiki?
project
.
wiki
.
repository
.
path_to_repo
else
project
.
repository
.
path_to_repo
end
end
end
end
end
end
end
end
lib/api/internal.rb
View file @
b50a2289
...
@@ -37,26 +37,18 @@ module API
...
@@ -37,26 +37,18 @@ module API
.
new
(
actor
,
project
,
protocol
,
authentication_abilities:
ssh_authentication_abilities
)
.
new
(
actor
,
project
,
protocol
,
authentication_abilities:
ssh_authentication_abilities
)
begin
begin
access_status
=
access_checker
.
check
(
params
[
:action
],
params
[
:changes
])
access_checker
.
check
(
params
[
:action
],
params
[
:changes
])
response
=
{
status:
access_status
.
status
,
message:
access_status
.
message
}
rescue
Gitlab
::
GitAccess
::
UnauthorizedError
,
Gitlab
::
GitAccess
::
NotFoundError
=>
e
rescue
Gitlab
::
GitAccess
::
UnauthorizedError
,
Gitlab
::
GitAccess
::
NotFoundError
=>
e
return
{
status:
false
,
message:
e
.
message
}
return
{
status:
false
,
message:
e
.
message
}
end
end
log_user_activity
(
actor
)
log_user_activity
(
actor
)
# Project id to pass between components that don't share/don't have
response
=
{
# access to the same filesystem mounts
status:
true
,
response
[
:gl_repository
]
=
Gitlab
::
GlRepository
.
gl_repository
(
project
,
wiki?
)
gl_repository:
gl_repository
,
repository_path:
repository_path
# Return the repository full path so that gitlab-shell has it when
}
# handling ssh commands
response
[
:repository_path
]
=
if
wiki?
project
.
wiki
.
repository
.
path_to_repo
else
project
.
repository
.
path_to_repo
end
response
response
end
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