17 lines
363 B
Ruby
17 lines
363 B
Ruby
class KeyPairPolicy < ApplicationPolicy
|
|
|
|
def create?
|
|
return false unless record.repository
|
|
is_admin? || local_admin?(record.repository.platform)
|
|
end
|
|
alias_method :destroy?, :create?
|
|
|
|
# Public: Get list of parameters that the user is allowed to alter.
|
|
#
|
|
# Returns Array
|
|
def permitted_attributes
|
|
%i(public secret repository_id)
|
|
end
|
|
|
|
end
|