From ea2f9dcbb6044534388130d8f5e5071562f10f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 26 Feb 2021 13:50:18 +0200 Subject: [PATCH 1/2] Registrant User: Fix UUID ident parsing --- app/models/registrant_user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 227ae8cbf..b09970b1e 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -9,7 +9,7 @@ class RegistrantUser < User delegate :can?, :cannot?, to: :ability def ident - registrant_ident.to_s.split('-').last + registrant_ident.to_s.slice(3) end def country From 1999493bac9bfa6fefe359d4585ceddfe7f00b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 26 Feb 2021 13:53:40 +0200 Subject: [PATCH 2/2] Skip company query if ident is eIDAS UUID --- app/models/registrant_user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index b09970b1e..f7e85c5af 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -9,7 +9,7 @@ class RegistrantUser < User delegate :can?, :cannot?, to: :ability def ident - registrant_ident.to_s.slice(3) + registrant_ident.to_s[3..] end def country @@ -18,6 +18,8 @@ class RegistrantUser < User end def companies(company_register = CompanyRegister::Client.new) + return [] if ident.include?('-') + company_register.representation_rights(citizen_personal_code: ident, citizen_country_code: country.alpha3) end