fix: configurable audit table on restore check
All checks were successful
Build / Build-and-ng-test (pull_request) Successful in 5m41s
Build / Build-and-test-development (pull_request) Successful in 9m29s
Lighthouse Checks / lighthouse (20.15.1) (pull_request) Successful in 19m20s

closes #193
This commit is contained in:
2025-10-27 20:13:49 +00:00
parent 4924df2ef3
commit 26ce95f7c1

View File

@@ -39,15 +39,35 @@
%let &outresult=NO;
%let &outreason=NOTFOUND;
/* check if there is actually a version to restore */
%local libds;
proc sql noprint;
select upcase(cats(base_lib,'.',base_ds)) into: libds
from &dc_libref..mpe_submit
where TABLE_ID="&load_ref";
/**
* check if there is actually a version to restore
*/
%local audtab;
proc sql noprint;
select coalescec(audit_libds,"&dc_libref..MPE_AUDIT") into: audtab
from &dclib..MPE_TABLES
where &dc_dttmtfmt. lt tx_to
and libref="%scan(&libds,1,.)" and dsn="%scan(&libds,2,.)";
%if "&audtab"="0" %then %do;
%let allow_restore=NO;
%let reason= &libds has no audit table configured;
%return;
%end;
%local chk;
%let chk=0;
proc sql noprint;
select count(*) into: chk from &dc_libref..mpe_audit
select count(*) into: chk from &audtab
where load_ref="&load_ref";
%if &chk=0 %then %do;
%let allow_restore=NO;
%let reason=No entry for &load_ref in MPE_AUDIT;
%let reason=No entry for &load_ref in &audtab;
%return;
%end;
@@ -70,11 +90,6 @@
%end;
/* check if user has basic access */
%local libds;
proc sql noprint;
select cats(base_lib,'.',base_ds) into: libds
from &mpelib..mpe_submit
where TABLE_ID="&load_ref";
%mpe_accesscheck(&libds,outds=work.access_check
,user=&user
,access_level=EDIT