Skip to content

Commit 97480ef

Browse files
committed
[NRL-2140] Add sandbox perms to perms layer
1 parent 3b396df commit 97480ef

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

scripts/get_s3_permissions.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,48 @@ def add_smoke_test_files(secretsmanager, local_path, env_name):
276276
]
277277

278278

279+
def add_sandbox_files(local_path):
280+
"""Add the permissions required for the sandbox environments.
281+
Only call this function if your want to add sandbox permissions.
282+
These permissions are taken from the existing permissions in the API repos.
283+
"""
284+
sandbox_app_id = "NRL-SANDBOX-APP"
285+
nrl_sandbox_perms = {
286+
"RJ11": [
287+
"http://snomed.info/sct|736253001",
288+
"http://snomed.info/sct|736253002",
289+
],
290+
# These ones are needed for the Seed data
291+
"Y05868": [
292+
"http://snomed.info/sct|736253002",
293+
"http://snomed.info/sct|887701000000100",
294+
"http://snomed.info/sct|1363501000000100",
295+
"http://snomed.info/sct|861421000000109",
296+
],
297+
"8J008": ["http://snomed.info/sct|1363501000000100"],
298+
"RY26A": ["http://snomed.info/sct|861421000000109"],
299+
# This one is needed for Smoke Tests
300+
"RM559": ["http://snomed.info/sct|736253002"],
301+
}
302+
303+
for ods_code, snomed_codes in nrl_sandbox_perms.items():
304+
_write_permission_file(
305+
Path.joinpath(local_path, "producer", sandbox_app_id),
306+
ods_code,
307+
snomed_codes,
308+
)
309+
_write_permission_file(
310+
Path.joinpath(local_path, "consumer", sandbox_app_id),
311+
ods_code,
312+
snomed_codes,
313+
)
314+
_write_v1_permission_file(
315+
Path.joinpath(local_path, sandbox_app_id),
316+
ods_code,
317+
snomed_codes,
318+
)
319+
320+
279321
def download_files(
280322
s3_client, bucket_name, local_path, file_names, folders, secretsmanager, env_name
281323
):
@@ -297,6 +339,9 @@ def download_files(
297339
add_feature_test_files(local_path)
298340
add_smoke_test_files(secretsmanager, local_path, env_name)
299341

342+
if env_name in ["dev-sandbox", "qa-sandbox", "int-sandbox"]:
343+
add_sandbox_files(local_path)
344+
300345

301346
def main(use_shared_resources: str, env: str, workspace: str, path_to_store: str):
302347
stack_name = env if use_shared_resources else workspace

0 commit comments

Comments
 (0)