Loading...
Searching...
No Matches
mpe_security_postedit.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Post Edit Hook script for the MPE_SECURITY table
4 @details Post edit hooks provide additional backend validation against
5 user-sourced data. The incoming dataset is always `work.staging_ds` and this
6 file is included from the mpe_loader.sas macro.
7
8 Available (at runtime) macro variables:
9 @li DC_LIBREF - The DC control library for your site
10 @li LIBREF - The library of the dataset being edited (is assigned)
11 @li DS - The dataset being edited
12
13 Hook scripts run inside the service that includes them, so the macros
14 they call are already in that session. They are listed as ignored rather
15 than declared, so the script keeps no macro list of its own to maintain.
16
17 @sasjslint {"ignoredMacros": ["mp_abort"]}
18
19**/
20
21/* ensure upcase and check access level values*/
22%let errval=0;
23%let errmsg=;
24data work.staging_ds;
25 set work.staging_ds;
26 LIBREF=upcase(LIBREF);
27 if LIBREF in ('WORK','CASUSER','SASUSER') then do;
28 putlog "ERR" +(-1) "OR: invalid LIBREF - " LIBREF;
29 call symputx('errval',1);
30 call symputx('errmsg',"Invalid LIBREF: "!!LIBREF);
31 end;
32 DSN=upcase(DSN);
33 ACCESS_LEVEL=upcase(ACCESS_LEVEL);
34 if ACCESS_LEVEL not in ('EDIT','APPROVE','VIEW','SIGNOFF','AUDIT') then do;
35 putlog "ERR" +(-1) "OR: invalid ACCESS_LEVEL - " access_level;
36 call symputx('errval',1);
37 call symputx('errmsg',"Invalid ACCESS_LEVEL: "!!access_level);
38 end;
39run;
40
41%mp_abort(iftrue=(&errval=1)
42 ,mac=mpe_security_postedit.sas
43 /* %bquote: the submitted value is interpolated into this message, and a
44 comma in it would split this call into extra positional parameters */
45 ,msg=%bquote(&errmsg)
46)