Add host information to session recording view
This commit is contained in:
1 parent
a8224f4f57
commit
e1540be9f3
7 files changed
+72
-13
No files matched your search
@@ -62,7 +62,33 @@ select
|
||||
tsh.description as target_scope_history_description,
|
||||
tsh.type as target_scope_history_type,
|
||||
tsh.parent_id as target_scope_history_parent_id,
|
||||
tsh.primary_auth_method_id as target_scope_history_primary_auth_method_id
|
||||
tsh.primary_auth_method_id as target_scope_history_primary_auth_method_id,
|
||||
-- static
|
||||
-- host catalogs
|
||||
shch.public_id as static_catalog_history_public_id,
|
||||
shch.project_id as static_catalog_history_project_id,
|
||||
shch.name as static_catalog_history_name,
|
||||
shch.description as static_catalog_history_description,
|
||||
-- hosts
|
||||
shh.public_id as static_host_history_public_id,
|
||||
shh.name as static_host_history_name,
|
||||
shh.description as static_host_history_description,
|
||||
shh.address as static_host_history_address,
|
||||
|
||||
-- plugin
|
||||
-- host catalogs
|
||||
hpch.public_id as plugin_catalog_history_public_id,
|
||||
hpch.project_id as plugin_catalog_history_project_id,
|
||||
hpch.name as plugin_catalog_history_name,
|
||||
hpch.description as plugin_catalog_history_description,
|
||||
hpch.attributes as plugin_catalog_history_attributes,
|
||||
hpch.plugin_id as plugin_catalog_history_plugin_id,
|
||||
-- hosts
|
||||
hph.public_id as plugin_host_history_public_id,
|
||||
hph.name as plugin_host_history_name,
|
||||
hph.description as plugin_host_history_description,
|
||||
hph.external_id as plugin_host_history_external_id
|
||||
|
||||
from recording_session rs
|
||||
join storage_plugin_storage_bucket sb on
|
||||
rs.storage_bucket_id = sb.public_id
|
||||
@@ -73,7 +99,15 @@ from recording_session rs
|
||||
join target_ssh_hst th on
|
||||
rs.target_hst_id = th.history_id
|
||||
join iam_scope_hst as tsh on
|
||||
rs.target_project_hst_id = tsh.history_id;
|
||||
rs.target_project_hst_id = tsh.history_id
|
||||
left join static_host_catalog_hst as shch on
|
||||
rs.host_catalog_hst_id = shch.history_id
|
||||
left join host_plugin_catalog_hst as hpch on
|
||||
rs.host_catalog_hst_id = hpch.history_id
|
||||
left join static_host_hst as shh on
|
||||
rs.host_hst_id = shh.history_id
|
||||
left join host_plugin_host_hst as hph on
|
||||
rs.host_hst_id = hph.history_id;
|
||||
comment on view session_recording_aggregate is
|
||||
'session_recording_aggregate contains the session recording resource with its storage bucket scope info and historical user info.';
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@ begin;
|
||||
('p____rcolors', 't_________cr', 's___2cr-sths'),
|
||||
('p____bcolors', 'tssh______cb', 's___1cb-sths'),
|
||||
('p____bcolors', 'tssh______cb', 's___2cb-sths'),
|
||||
('p____bcolors', 'tssh______cb', 's___1cb-plghs'),
|
||||
('p____rcolors', 'tssh______cr', 's___1cr-sths'),
|
||||
('p____rcolors', 'tssh______cr', 's___2cr-sths');
|
||||
|
||||
@@ -457,15 +458,17 @@ begin;
|
||||
('p____bcolors', 't_________cb', 's1_____ciara', 'u______cindy', 'tok____cindy', 'abc'::bytea, 'ep1'),
|
||||
('p____bcolors', 't_________cb', 's1_____carly', 'u______carly', 'tok____carly', 'abc'::bytea, 'ep1'),
|
||||
('p____gcolors', 'tssh______cg', 's1______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep1'),
|
||||
--- the next two are used in recording_session tests
|
||||
--- the next are used in recording_session tests
|
||||
('p____bcolors', 'tssh______cb', 's2_____clare', 'u______clare', 'tok____clare', 'abc'::bytea, 'ep2'),
|
||||
('p____gcolors', 'tssh______cg', 's2______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep3');
|
||||
('p____gcolors', 'tssh______cg', 's2______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep3'),
|
||||
('p____bcolors', 'tssh______cb', 's2_____carly', 'u______carly', 'tok____carly', 'abc'::bytea, 'ep4');
|
||||
|
||||
insert into session_credential_static
|
||||
(session_id, credential_static_id, credential_purpose)
|
||||
values
|
||||
('s1_____clare', 'csj__bcolors', 'injected_application'), -- tssh______cb
|
||||
('s2_____clare', 'csj__bcolors', 'injected_application'), -- tssh______cb
|
||||
('s2_____carly', 'csj__bcolors', 'injected_application'), -- tssh______cb
|
||||
('s1_____cindy', 'csj__bcolors', 'brokered'), -- t_________cb
|
||||
('s1_____ciara', 'csj__bcolors', 'brokered'), -- t_________cb
|
||||
('s1_____carly', 'csj__bcolors', 'brokered'), -- t_________cb
|
||||
@@ -482,7 +485,8 @@ begin;
|
||||
('s2_____clare', 's___1cb-sths', 'h_____cb__01'),
|
||||
('s1_____cindy', 's___1cb-sths', 'h_____cb__01'),
|
||||
('s1_____ciara', 's___1cb-sths', 'h_____cb__01'),
|
||||
('s1_____carly', 's___1cb-sths', 'h_____cb__01');
|
||||
('s1_____carly', 's___1cb-sths', 'h_____cb__01'),
|
||||
('s2_____carly', 's___1cb-plghs', 'h_____cb__01-plgh');
|
||||
|
||||
insert into session_target_address
|
||||
(session_id, target_id)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
-- end_time_null_or_after_start_time
|
||||
|
||||
begin;
|
||||
select plan(56);
|
||||
select plan(57);
|
||||
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'sessions');
|
||||
|
||||
select has_view('session_recording_aggregate', 'view for aggregating session recording info does not exist');
|
||||
@@ -99,6 +99,13 @@ begin;
|
||||
'select endpoint from recording_session where public_id = ''sr_________2''',
|
||||
'select endpoint from session where public_id = ''s2______cora''');
|
||||
|
||||
prepare insert_recording_session_plugin_host as
|
||||
insert into recording_session
|
||||
(public_id, storage_bucket_id, session_id)
|
||||
values
|
||||
('sr_________3', 'sb____global', 's2_____carly');
|
||||
select lives_ok('insert_recording_session_plugin_host');
|
||||
|
||||
-- Try to set end_time before start_time
|
||||
prepare invalid_close_recording_session as
|
||||
update recording_session set
|
||||
@@ -176,9 +183,11 @@ begin;
|
||||
prepare select_session_recordings as
|
||||
select public_id::text, storage_bucket_id::text, storage_bucket_scope_id::text, session_id::text,
|
||||
user_history_public_id::text, user_history_name::text, user_history_scope_id::text, user_scope_history_type::text,
|
||||
target_history_public_id::text, target_history_name::text, target_scope_history_public_id::text
|
||||
target_history_public_id::text, target_history_name::text, target_scope_history_public_id::text,
|
||||
static_catalog_history_public_id::text, static_host_history_public_id::text,
|
||||
plugin_catalog_history_public_id::text, plugin_host_history_public_id::text, plugin_catalog_history_plugin_id::text
|
||||
from session_recording_aggregate
|
||||
where public_id in ('sr_________1')
|
||||
where public_id in ('sr_________1', 'sr_________2', 'sr_________3')
|
||||
order by public_id;
|
||||
|
||||
select results_eq(
|
||||
@@ -186,7 +195,19 @@ begin;
|
||||
$$VALUES
|
||||
('sr_________1', 'sb____global', 'global', 's2_____clare',
|
||||
'u______clare', 'Clare', 'o_____colors', 'org',
|
||||
'tssh______cb', 'Blue Color SSH Target', 'p____bcolors')$$
|
||||
'tssh______cb', 'Blue Color SSH Target', 'p____bcolors',
|
||||
'c___cb-sthcl', 'h_____cb__01', null, null,
|
||||
null),
|
||||
('sr_________2', 'sb____global', 'global', 's2______cora',
|
||||
'u_______cora', 'Cora', 'o_____colors', 'org',
|
||||
'tssh______cg', 'Green Color SSH Target', 'p____gcolors',
|
||||
null, null, null, null,
|
||||
null),
|
||||
('sr_________3', 'sb____global', 'global', 's2_____carly',
|
||||
'u______carly', 'Carly', 'o_____colors', 'org',
|
||||
'tssh______cb', 'Blue Color SSH Target', 'p____bcolors',
|
||||
null, null, 'c___cb-plghcl', 'h_____cb__01-plgh',
|
||||
'plg_____chost')$$
|
||||
);
|
||||
|
||||
-- Closing a second time should error
|
||||
|
||||
@@ -12,7 +12,7 @@ begin;
|
||||
|
||||
-- Check that we have a session for both auth token
|
||||
select is(count(*), 2::bigint) from session where auth_token_id = 'tok____clare';
|
||||
select is(count(*), 1::bigint) from session where auth_token_id = 'tok____carly';
|
||||
select is(count(*), 2::bigint) from session where auth_token_id = 'tok____carly';
|
||||
|
||||
-- Delete auth tokens, expect no errors
|
||||
delete from auth_token where public_id = 'tok____clare' or public_id = 'tok____carly';
|
||||
|
||||
@@ -11,7 +11,7 @@ begin;
|
||||
select is(count(*), 1::bigint) from session_state where session_id = 's1_____carly' and state='active';
|
||||
|
||||
-- Check that we have 5 sessions using this project
|
||||
select is(count(*), 5::bigint) from session where project_id = 'p____bcolors';
|
||||
select is(count(*), 6::bigint) from session where project_id = 'p____bcolors';
|
||||
|
||||
-- Delete project, expect no errors
|
||||
delete from iam_scope_project where scope_id = 'p____bcolors';
|
||||
|
||||
@@ -11,7 +11,7 @@ begin;
|
||||
select is(count(*), 1::bigint) from session_state where session_id = 's1_____carly' and state='active';
|
||||
|
||||
select is(count(*), 3::bigint) from session where target_id = 't_________cb';
|
||||
select is(count(*), 2::bigint) from session where target_id = 'tssh______cb';
|
||||
select is(count(*), 3::bigint) from session where target_id = 'tssh______cb';
|
||||
|
||||
-- Delete target, expect no errors
|
||||
delete from target where public_id='t_________cb';
|
||||
|
||||
@@ -12,7 +12,7 @@ begin;
|
||||
|
||||
-- Check that we have a session for both users
|
||||
select is(count(*), 2::bigint) from session where user_id = 'u______clare';
|
||||
select is(count(*), 1::bigint) from session where user_id = 'u______carly';
|
||||
select is(count(*), 2::bigint) from session where user_id = 'u______carly';
|
||||
|
||||
-- Delete users, expect no errors
|
||||
delete from iam_user where public_id = 'u______clare' or public_id = 'u______carly';
|
||||
|
||||
Reference in new issue
Block a user