Merge pull request #2509 from internetee/71-authorize-xml-console

Added missing abilities to xml_console and contacts
This commit is contained in:
Timo Võhmar 2022-12-14 12:07:30 +02:00 committed by GitHub
commit 1a54c80fbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View file

@ -74,6 +74,7 @@ module Repp
api :POST, '/repp/v1/contacts'
desc 'Create a new contact'
def create
authorize! :create, Epp::Contact
@contact = Epp::Contact.new(contact_params_with_address, current_user.registrar, epp: false)
action = Actions::ContactCreate.new(@contact, contact_params[:legal_document],
contact_ident_params)
@ -89,6 +90,7 @@ module Repp
api :PUT, '/repp/v1/contacts/:contact_code'
desc 'Update existing contact'
def update
authorize! :update, Epp::Contact
action = Actions::ContactUpdate.new(@contact, contact_params_with_address(required: false),
contact_params[:legal_document],
contact_ident_params(required: false), current_user)
@ -104,6 +106,7 @@ module Repp
api :DELETE, '/repp/v1/contacts/:contact_code'
desc 'Delete a specific contact'
def destroy
authorize! :delete, Epp::Contact
action = Actions::ContactDelete.new(@contact, params[:legal_document])
unless action.call
handle_errors(@contact)