camper/deploy/company_login_attempt.sql

29 lines
620 B
MySQL
Raw Normal View History

-- Deploy camper:company_login_attempt to pg
-- requires: roles
-- requires: schema_camper
-- requires: login_attempt
-- requires: user
-- requires: company_user
-- requires: current_company_id
begin;
set search_path to camper, public;
create or replace view company_login_attempt with (security_barrier) as
select attempt_id
, user_name
, ip_address
, success
, attempted_at
from auth.login_attempt
join auth."user" on "user".email = user_name
join company_user using (user_id)
where company_id = current_company_id()
;
;
grant select on table company_login_attempt to admin;
commit;