#472: Update Platforms::KeyPairsController
This commit is contained in:
parent
d38bede620
commit
161a249c82
|
@ -99,6 +99,7 @@ class Api::V1::RepositoriesController < Api::V1::BaseController
|
||||||
key_pair.destroy if key_pair
|
key_pair.destroy if key_pair
|
||||||
key_pair = @repository.build_key_pair subject_params(Repository, KeyPair)
|
key_pair = @repository.build_key_pair subject_params(Repository, KeyPair)
|
||||||
key_pair.user_id = current_user.id
|
key_pair.user_id = current_user.id
|
||||||
|
authorize key_pair, :create?
|
||||||
if key_pair.save
|
if key_pair.save
|
||||||
render_json_response @repository, 'Signatures have been updated for repository successfully'
|
render_json_response @repository, 'Signatures have been updated for repository successfully'
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Platforms::KeyPairsController < Platforms::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@key_pair = KeyPair.new params[:key_pair]
|
@key_pair = KeyPair.new subject_params(KeyPair)
|
||||||
@key_pair.user_id = current_user.id
|
@key_pair.user_id = current_user.id
|
||||||
authorize @key_pair
|
authorize @key_pair
|
||||||
if @key_pair.save
|
if @key_pair.save
|
||||||
|
|
|
@ -10,7 +10,7 @@ class KeyPairPolicy < ApplicationPolicy
|
||||||
#
|
#
|
||||||
# Returns Array
|
# Returns Array
|
||||||
def permitted_attributes
|
def permitted_attributes
|
||||||
%i(public secret)
|
%i(public secret repository_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue