summaryrefslogtreecommitdiff
path: root/app/controllers/projects/settings/repository_controller.rb
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-03-19 10:11:12 -0600
committerMayra Cabrera <mcabrera@gitlab.com>2018-04-06 21:20:16 -0500
commitdb18993f652425b72c4b854e18a002e0ec44b196 (patch)
tree7466e5f6b154bd79e72c13a5021d92eb9d7e4a13 /app/controllers/projects/settings/repository_controller.rb
parentaade8b3652573db40e7b777c72caa922b0bc12ef (diff)
downloadgitlab-ce-db18993f652425b72c4b854e18a002e0ec44b196.tar.gz
Create barebones for Deploytoken
Includes: - Model, factories, create service and controller actions - As usual, includes specs for everything - Builds UI (copy from PAT) - Add revoke action Closes #31591
Diffstat (limited to 'app/controllers/projects/settings/repository_controller.rb')
-rw-r--r--app/controllers/projects/settings/repository_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb
index dd9e4a2af3e..28897cc5946 100644
--- a/app/controllers/projects/settings/repository_controller.rb
+++ b/app/controllers/projects/settings/repository_controller.rb
@@ -5,7 +5,9 @@ module Projects
def show
@deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user)
+ @deploy_tokens = DeployTokensPresenter.new(@project.deploy_tokens.active, current_user: current_user, project: project)
+ define_deploy_token
define_protected_refs
end
@@ -51,6 +53,14 @@ module Projects
gon.push(protectable_branches_for_dropdown)
gon.push(access_levels_options)
end
+
+ def define_deploy_token
+ @deploy_token = @project.deploy_tokens.build(deploy_token_attributes)
+ end
+
+ def deploy_token_attributes
+ params.fetch(:deploy_token, {}).permit(:name, :expires_at, scopes: [])
+ end
end
end
end