#472: Update Api::V1::RepositoriesController
This commit is contained in:
parent
347c97703a
commit
83981996cd
|
@ -97,7 +97,7 @@ class Api::V1::RepositoriesController < Api::V1::BaseController
|
||||||
def signatures
|
def signatures
|
||||||
key_pair = @repository.key_pair
|
key_pair = @repository.key_pair
|
||||||
key_pair.destroy if key_pair
|
key_pair.destroy if key_pair
|
||||||
key_pair = @repository.build_key_pair(params[:repository])
|
key_pair = @repository.build_key_pair subject_params(Repository, KeyPair)
|
||||||
key_pair.user_id = current_user.id
|
key_pair.user_id = current_user.id
|
||||||
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'
|
||||||
|
|
|
@ -4,7 +4,6 @@ class KeyPair < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
attr_accessor :fingerprint
|
attr_accessor :fingerprint
|
||||||
# attr_accessible :public, :secret, :repository_id
|
|
||||||
attr_encrypted :secret, key: APP_CONFIG['keys']['key_pair_secret_key']
|
attr_encrypted :secret, key: APP_CONFIG['keys']['key_pair_secret_key']
|
||||||
|
|
||||||
validates :repository, :user, presence: true
|
validates :repository, :user, presence: true
|
||||||
|
|
|
@ -36,13 +36,6 @@ class Repository < ActiveRecord::Base
|
||||||
|
|
||||||
before_destroy :detele_directory
|
before_destroy :detele_directory
|
||||||
|
|
||||||
# attr_accessible :name,
|
|
||||||
# :description,
|
|
||||||
# :publish_without_qa,
|
|
||||||
# :synchronizing_publications,
|
|
||||||
# :publish_builds_only_from_branch,
|
|
||||||
# :build_for_platform_id
|
|
||||||
|
|
||||||
attr_readonly :name, :platform_id
|
attr_readonly :name, :platform_id
|
||||||
attr_accessor :projects_list, :build_for_platform_id
|
attr_accessor :projects_list, :build_for_platform_id
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,11 @@ class KeyPairPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
alias_method :destroy?, :create?
|
alias_method :destroy?, :create?
|
||||||
|
|
||||||
|
# Public: Get list of parameters that the user is allowed to alter.
|
||||||
|
#
|
||||||
|
# Returns Array
|
||||||
|
def permitted_attributes
|
||||||
|
%i(public secret)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,6 +54,20 @@ class RepositoryPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
alias_method :remove_repo_lock_file?, :add_repo_lock_file?
|
alias_method :remove_repo_lock_file?, :add_repo_lock_file?
|
||||||
|
|
||||||
|
# Public: Get list of parameters that the user is allowed to alter.
|
||||||
|
#
|
||||||
|
# Returns Array
|
||||||
|
def permitted_attributes
|
||||||
|
%i(
|
||||||
|
name
|
||||||
|
description
|
||||||
|
publish_without_qa
|
||||||
|
synchronizing_publications
|
||||||
|
publish_builds_only_from_branch
|
||||||
|
build_for_platform_id
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Public: Get user ids of repository.
|
# Public: Get user ids of repository.
|
||||||
|
|
Loading…
Reference in New Issue