Let only owning registrar approve transfer, tests refactor

This commit is contained in:
Martin Lensment 2014-09-04 17:23:05 +03:00
parent 142db654c4
commit b6ce705748
4 changed files with 61 additions and 32 deletions

View file

@ -211,8 +211,14 @@ class Domain < ActiveRecord::Base
def transfer(params)
return false unless authenticate(params[:pw])
pt = pending_transfer
if pt && params[:action] == 'approve'
if params[:current_user].registrar != pt.transfer_from
add_epp_error('2304', nil, nil, I18n.t('transfer_can_be_approved_only_by_current_registrar'))
return false
end
if pending_transfer && params[:action] == 'approve'
approve_pending_transfer and return true
end