Skip to content

Commit

Permalink
[GSD-101] CA showing 0 for samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Oct 22, 2024
1 parent 02eb5f0 commit b9a6087
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions GIC-Institution/auth/V14__FIX_AGG_REQUESTS.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- This is the access rule responsible for allowing aggregate requests
SET @uuidAccessRule = (SELECT uuid from access_rule WHERE access_rule.name = 'Aggregate Only Access' LIMIT 1 OFFSET 0);

-- This is an extra access rule that does the same thing. It's identical
SET @uuidThatBrokeThings = (SELECT uuid from access_rule WHERE access_rule.name = 'Aggregate Only Access' LIMIT 1 OFFSET 1);

-- Release the evil access rule and kill it
UPDATE accessRule_gate
SET gate_id = @uuidAccessRule
WHERE gate_id = @uuidThatBrokeThings;

-- There's one sub rule relation to expected result type = COUNT, but that makes no sense
DELETE FROM accessRule_subRule WHERE accessRule_id = @uuidThatBrokeThings;

DELETE FROM access_rule WHERE uuid = @uuidThatBrokeThings;

-- Delete all from accessRule_subRule for Aggregate Only Access
DELETE
FROM accessRule_subRule
WHERE accessRule_subRule.accessRule_id = @uuidAccessRule;

-- Delete all from accessRule_subRule for count rules (this should be empty anyways)
DELETE
FROM accessRule_subRule
WHERE
accessRule_subRule.accessRule_id IN (
SELECT access_rule.uuid
FROM access_rule
WHERE
access_rule.rule = '$..expectedResultType'
AND access_rule.value IN ('OBSERVATION_COUNT', 'OBSERVATION_CROSS_COUNT', 'CROSS_COUNT', 'COUNT', 'INFO_COLUMN_LISTING')
);

-- Delete all from accessRule_gate for Aggregate Only Access


-- Add new sub rule entries for all access rules that target expectedResultType and have a count value
INSERT INTO accessRule_gate (accessRule_id, gate_id)
SELECT @uuidAccessRule AS accessRule_id, access_rule.uuid AS gate_id
FROM access_rule
WHERE
access_rule.rule = '$..expectedResultType'
AND access_rule.value IN ('OBSERVATION_COUNT', 'OBSERVATION_CROSS_COUNT', 'CROSS_COUNT', 'COUNT', 'INFO_COLUMN_LISTING');

0 comments on commit b9a6087

Please sign in to comment.