#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 = @repository.build_key_pair subject_params(Repository, KeyPair)
|
||||
key_pair.user_id = current_user.id
|
||||
authorize key_pair, :create?
|
||||
if key_pair.save
|
||||
render_json_response @repository, 'Signatures have been updated for repository successfully'
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ class Platforms::KeyPairsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def create
|
||||
@key_pair = KeyPair.new params[:key_pair]
|
||||
@key_pair = KeyPair.new subject_params(KeyPair)
|
||||
@key_pair.user_id = current_user.id
|
||||
authorize @key_pair
|
||||
if @key_pair.save
|
||||
|
|
|
@ -10,7 +10,7 @@ class KeyPairPolicy < ApplicationPolicy
|
|||
#
|
||||
# Returns Array
|
||||
def permitted_attributes
|
||||
%i(public secret)
|
||||
%i(public secret repository_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue