APPSRV_AUTHCLS Function

Reads the AUTHLIB data set and returns a WHERE clause

Syntax

CLAUSE = APPSRV_AUTHCLS( type )

Required Argument

type
is one of the following character strings: LIBRARY, MEMBER, CATALOGENTRY.

Details

The APPSRV_AUTHCLS function reads the AUTHLIB data set and returns a WHERE clause. This clause references the variable names LIBNAME, MEMNAME, MEMTYPE, OBJNAME, and OBJTYPE. It can be applied to the SQL dictionary views and other views in the SASHELP library. The returned clause can be used to subset the entities in the current SAS session to only the entities that are authorized by the AUTHLIB data set. The returned clause can be combined with a user-determined clause by using the "and" token to create a compound clause that selects the desired entities, provided that access is authorized.
If the value of type is LIBRARY, then the returned clause contains only the LIBNAME variable. If the value of type is MEMBER, then the returned clause contains the LIBNAME, MEMNAME, and MEMTYPE variables. If the value of type is CATALOGENTRY, then the returned clause contains the LIBNAME, MEMNAME, MEMTYPE, OBJNAME, and OBJTYPE variables.

Example: Examples

For the examples in Table 0.2, refer to the contents of the SASHELP.AUTHLIB data set in Table 0.1. Entities are excluded by default, and all exclude rules supersede all include rules.
Contents of SASHELP.AUTHLIB Data Set
Rule
Libname
Memname
Memtype
Objname
Objtype
INCLUDE
SASHELP
*
DATA
*
*
INCLUDE
SASHELP
*
VIEW
*
*
INCLUDE
SASHELP
*
MDDB
*
*
INCLUDE
SAMPDAT
*
*
*
*
EXCLUDE
SAMPDAT
MYCAT
CATALOG
*
*
Examples
SAS Statements
Results
clause=appsrv_authcls('LIBRARY');
put clause=;
clause=( (upcase(libname)='SASHELP')or
(upcase(libname)='SASHELP')or
(upcase(libname)='SASHELP')or
(upcase(libname)='SAMPDAT') )
clause=appsrv_authcls('MEMBER');
put clause=;
clause=( ( (upcase(libname)='SASHELP'
      and upcase(memtype)='DATA') or
   (upcase(libname)='SASHELP' and
      upcase(memtype)='VIEW') or
   (upcase(libname)='SASHELP' and
      upcase(memtype)='MDDB') or
   (upcase(libname)='SAMPDAT') ) and
( (upcase(libname) ne 'SAMPDAT' or
   upcase(memname) ne 'MYCAT' or
   upcase(memtype) ne 'CATALOG') ) )
data null;
   length clause $ 32767;
   clause=appsrv_authcls('MEMBER');
   call symput('CLAUSE',clause);
run;

/*create a data set listing all
   allowed data sets excluding
   views*/

proc sql;
create table work.allowed as
select * from dictionary.tables
where memtype='DATA' and &clause;
quit;
Data set WORK.ALLOWED is created as
a subset from dictionary.tables. It
contains only data sets that are
allowed according to the AUTHLIB data
set. Views are excluded from this table
by the addition of the "memtype='DATA'"
clause.