#472: Update Platforms::KeyPairsController

This commit is contained in:
Vokhmin Alexey V 2015-05-21 00:19:47 +03:00
parent d38bede620
commit 161a249c82
3 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -10,7 +10,7 @@ class KeyPairPolicy < ApplicationPolicy
#
# Returns Array
def permitted_attributes
%i(public secret)
%i(public secret repository_id)
end
end