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
Jérome Perrin
gitlab-ce
Commits
7e47a828
Commit
7e47a828
authored
Aug 08, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Namespace EnableDeployKeyService under Projects
parent
81e839f4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
18 deletions
+22
-18
app/controllers/projects/deploy_keys_controller.rb
app/controllers/projects/deploy_keys_controller.rb
+1
-1
app/services/enable_deploy_key_service.rb
app/services/enable_deploy_key_service.rb
+0
-14
app/services/projects/enable_deploy_key_service.rb
app/services/projects/enable_deploy_key_service.rb
+17
-0
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+2
-1
spec/services/projects/enable_deploy_key_service_spec.rb
spec/services/projects/enable_deploy_key_service_spec.rb
+2
-2
No files found.
app/controllers/projects/deploy_keys_controller.rb
View file @
7e47a828
...
...
@@ -27,7 +27,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end
def
enable
EnableDeployKeyService
.
new
(
@project
,
current_user
,
params
).
execute
Projects
::
EnableDeployKeyService
.
new
(
@project
,
current_user
,
params
).
execute
redirect_to
namespace_project_deploy_keys_path
(
@project
.
namespace
,
@project
)
end
...
...
app/services/enable_deploy_key_service.rb
deleted
100644 → 0
View file @
81e839f4
class
EnableDeployKeyService
<
BaseService
def
execute
key
=
accessible_keys
.
find_by
(
id:
params
[
:key_id
]
||
params
[
:id
])
project
.
deploy_keys
<<
key
if
key
key
end
private
def
accessible_keys
current_user
.
accessible_deploy_keys
end
end
app/services/projects/enable_deploy_key_service.rb
0 → 100644
View file @
7e47a828
module
Projects
class
EnableDeployKeyService
<
BaseService
def
execute
key
=
accessible_keys
.
find_by
(
id:
params
[
:key_id
]
||
params
[
:id
])
return
unless
key
project
.
deploy_keys
<<
key
key
end
private
def
accessible_keys
current_user
.
accessible_deploy_keys
end
end
end
lib/api/deploy_keys.rb
View file @
7e47a828
...
...
@@ -76,7 +76,8 @@ module API
requires
:key_id
,
type:
Integer
,
desc:
'The ID of the deploy key'
end
post
":id/
#{
path
}
/:key_id/enable"
do
key
=
EnableDeployKeyService
.
new
(
user_project
,
current_user
,
declared
(
params
)).
execute
key
=
::
Projects
::
EnableDeployKeyService
.
new
(
user_project
,
current_user
,
declared
(
params
)).
execute
if
key
present
key
,
with:
Entities
::
SSHKey
...
...
spec/services/enable_deploy_key_service_spec.rb
→
spec/services/
projects/
enable_deploy_key_service_spec.rb
View file @
7e47a828
require
'spec_helper'
describe
EnableDeployKeyService
,
services:
true
do
describe
Projects
::
EnableDeployKeyService
,
services:
true
do
let
(
:deploy_key
)
{
create
(
:deploy_key
,
public:
true
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
project
.
creator
}
...
...
@@ -22,6 +22,6 @@ describe EnableDeployKeyService, services: true do
end
def
service
EnableDeployKeyService
.
new
(
project
,
user
,
params
)
Projects
::
EnableDeployKeyService
.
new
(
project
,
user
,
params
)
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