Allow to update own contact without password

This commit is contained in:
Priit Tark 2015-05-04 11:47:06 +03:00
parent 8cc03774ff
commit 430f3e3e58
4 changed files with 44 additions and 12 deletions

View file

@ -117,7 +117,7 @@ class Epp::ContactsController < EppController
contact_org_disabled
fax_disabled
status_editing_disabled
requires 'id', 'authInfo > pw'
requires 'id'
@prefix = nil
end

View file

@ -36,7 +36,7 @@ class Ability
can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:check, Epp::Contact)
can(:create, Epp::Contact)
can(:update, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id && c.auth_info == pw }
can(:update, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:delete, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:renew, Epp::Contact)
can(:view_password, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }

View file

@ -23,7 +23,6 @@ class Epp::Contact < Contact
at[:street] = nil if f.css('postalInfo addr street').present?
at[:state] = nil if f.css('postalInfo addr sp').present?
at[:country_code] = nil if f.css('postalInfo addr cc').present?
at[:auth_info] = nil if f.css('authInfo pw').present?
else
at[:name] = f.css('postalInfo name').text if f.css('postalInfo name').present?
at[:org_name] = f.css('postalInfo org').text if f.css('postalInfo org').present?