Loading...
Searching...
No Matches
mpe_accesscheck.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mpe_accesscheck macro
4 @details Checking functionality of mpe_accesscheck.sas macro
5
6
7 <h4> SAS Macros </h4>
8 @li mf_getuniquename.sas
9 @li mf_getuser.sas
10 @li mp_assertdsobs.sas
11 @li mpe_getgroups.sas
12 @li mpe_accesscheck.sas
13
14
15 @author 4GL Apps Ltd
16 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
17 and may not be re-distributed or re-sold without the express permission of
18 4GL Apps Ltd.
19
20**/
21
22/* get the groups this user is actually a member of */
23%mpe_getgroups(user=%mf_getuser(),outds=work.groups)
24
25data _null_;
26 set work.groups;
27 call symputx('groupname',groupname);
28run;
29
30/* create demo MPE_SECURITY table */
31data work.mpe_security;
32 if 0 then set &dc_libref..mpe_security;
33 do access_level='EDIT','APPROVE','VIEW','SIGNOFF','AUDIT';
34 LIBREF='SOMELIB';
35 DSN='SOMEDS';
36 sas_group="&groupname";
37 tx_from=0;
38 tx_to='31dec4999:23:59:59'dt;
39 output;
40 end;
41run;
42
43%let WRK=WORK;
44
45%mpe_accesscheck(
46 SOMELIB.SOMEDS
47 ,outds=work.test1
48 ,access_level=APPROVE
49 ,cntl_lib_var=WRK
50)
51%mp_assertdsobs(work.test1,
52 desc=Test 1 - One record returned,
53 test=EQUALS 1,
54 outds=work.test_results
55)
56
57%mpe_accesscheck(
58 SOMELIB.INVALID
59 ,outds=work.test2
60 ,access_level=APPROVE
61 ,cntl_lib_var=WRK
62)
63%mp_assertdsobs(work.test2,
64 desc=Test 12 - 0 records returned,
65 test=EQUALS 0,
66 outds=work.test_results
67)
68