aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/store/pg/sql/find_impersonator.sql
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2023-06-19 17:18:21 -0700
committerbenj <benj@rse8.com>2023-06-19 17:18:21 -0700
commitab6d5cefbea1e8ddf41f385dd85918f651958287 (patch)
treeac3a6b45b1a0e6a833a627307d07e94a95ba3c23 /crates/secd/store/pg/sql/find_impersonator.sql
parent3406b370fe290559ff2445097a380d6f48d0f9af (diff)
downloadsecdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar.gz
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar.bz2
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar.lz
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar.xz
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.tar.zst
secdiam-ab6d5cefbea1e8ddf41f385dd85918f651958287.zip
hack to allow impersonator to impersonate target
Diffstat (limited to 'crates/secd/store/pg/sql/find_impersonator.sql')
-rw-r--r--crates/secd/store/pg/sql/find_impersonator.sql10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/secd/store/pg/sql/find_impersonator.sql b/crates/secd/store/pg/sql/find_impersonator.sql
new file mode 100644
index 0000000..e544598
--- /dev/null
+++ b/crates/secd/store/pg/sql/find_impersonator.sql
@@ -0,0 +1,10 @@
+select i2.identity_public_id as impersonator_public_id
+ , i3.identity_public_id as target_public_id
+ , i.created_at
+from secd.impersonator i
+join secd.identity i2 on i.impersonator_id = i2.identity_id
+join secd.identity i3 on i.target_id = i3.identity_id
+join secd.credential c using (credential_id)
+where (($1::uuid is null) or (i2.identity_public_id = $1))
+and (($2::uuid is null) or (i3.identity_public_id = $2))
+and c.revoked_at > $3;