Contact info request will return auth error when pw is incorrect

This commit is contained in:
Priit Tark 2015-04-01 11:52:53 +03:00
parent 06b65f057c
commit 15f9b4ae50
2 changed files with 7 additions and 5 deletions

View file

@ -18,6 +18,7 @@ class Ability
end end
# rubocop: disable Metrics/CyclomaticComplexity # rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def epp def epp
# Epp::Domain # Epp::Domain
can(:info, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw } can(:info, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
@ -28,7 +29,7 @@ class Ability
can(:transfer, Epp::Domain) { |d, pw| d.auth_info == pw } can(:transfer, Epp::Domain) { |d, pw| d.auth_info == pw }
# Epp::Contact # Epp::Contact
can(:info, Epp::Contact) can(:info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw } can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:check, Epp::Contact) can(:check, Epp::Contact)
can(:create, Epp::Contact) can(:create, Epp::Contact)
@ -37,7 +38,8 @@ class Ability
can(:renew, Epp::Contact) can(:renew, Epp::Contact)
can(:view_password, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw } can(:view_password, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
end end
# rubocop: enabled Metrics/CyclomaticComplexity # rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def registrar def registrar
can :manage, Invoice can :manage, Invoice

View file

@ -534,11 +534,11 @@ describe 'EPP Contact', epp: true do
end end
end end
it 'returns no authorization error for wrong user and wrong pw' do it 'returns authorization error for wrong user and wrong pw' do
login_as :registrar2 do login_as :registrar2 do
response = info_request({ authInfo: { pw: { value: 'wrong-pw' } } }) response = info_request({ authInfo: { pw: { value: 'wrong-pw' } } })
response[:msg].should == 'Command completed successfully' response[:msg].should == 'Authorization error'
response[:result_code].should == '1000' response[:result_code].should == '2201'
response[:results].count.should == 1 response[:results].count.should == 1
contact = response[:parsed].css('resData infData') contact = response[:parsed].css('resData infData')