Registrant API: Allow tech domain query without tech flag

This commit is contained in:
Karl Erik Õunapuu 2021-02-26 17:18:52 +02:00
parent 747aa502d0
commit 63a15154cb
No known key found for this signature in database
GPG key ID: C9DD647298A34764

View file

@ -4,6 +4,8 @@ module Api
module V1 module V1
module Registrant module Registrant
class DomainsController < ::Api::V1::Registrant::BaseController class DomainsController < ::Api::V1::Registrant::BaseController
before_action :set_tech_flag, only: [:show]
def index def index
limit = params[:limit] || 200 limit = params[:limit] || 200
offset = params[:offset] || 0 offset = params[:offset] || 0
@ -42,6 +44,12 @@ module Api
private private
def set_tech_flag
# current_user_domains scope depends on tech flag
# However, if it's not present, tech contact can not see specific domain entry at all.
params.merge!(tech: 'true')
end
def current_user_domains_total_count def current_user_domains_total_count
current_registrant_user.domains.count current_registrant_user.domains.count
rescue CompanyRegister::NotAvailableError rescue CompanyRegister::NotAvailableError