gitlab-org--gitlab-foss/app/controllers/deploy_keys_controller.rb

47 lines
897 B
Ruby
Raw Normal View History

2011-12-29 14:44:16 -05:00
class DeployKeysController < ApplicationController
2012-01-17 17:46:13 -05:00
respond_to :html
2011-12-29 14:44:16 -05:00
layout "project"
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_admin_project!
2011-12-29 14:44:16 -05:00
def project
@project ||= Project.find_by_code(params[:project_id])
end
def index
@keys = @project.deploy_keys.all
2011-12-29 14:44:16 -05:00
end
def show
@key = @project.deploy_keys.find(params[:id])
2011-12-29 14:44:16 -05:00
end
def new
@key = @project.deploy_keys.new
2011-12-29 14:44:16 -05:00
respond_with(@key)
end
def create
@key = @project.deploy_keys.new(params[:key])
2012-01-17 18:00:40 -05:00
if @key.save
redirect_to project_deploy_keys_path(@project)
else
render "new"
end
2011-12-29 14:44:16 -05:00
end
def destroy
@key = @project.deploy_keys.find(params[:id])
2011-12-29 14:44:16 -05:00
@key.destroy
respond_to do |format|
2011-12-29 16:31:27 -05:00
format.html { redirect_to project_deploy_keys_url }
2011-12-29 14:44:16 -05:00
format.js { render :nothing => true }
end
end
end