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