如何快速顯示 IFS 目錄或檔案的使用者權限?(Command: DSPIFSAUT with API Qp0lGetAttr)
File : QRPGLESRC
Member : DSPIFSAUT
Type : RPGLE
Usage : CRTBNDRPG PGM(DSPIFSAUT) TGTRLS(V5R2M0)
**
** Program . . : DspIfsAut
** Description : Display IFS File Authority (CPP of command DspIfsAut)
** Author . . : Vengoal Chang
** Date . . : 2008/07/30
**
** Input parameters
** Description Type Size How Used
** ----------- ---- ---- --------
** PxIfsObj Char 5002 IFS object authority for display
**
**
** Compile options:
**
** CrtBndRpg Pgm( DspIfsAut )
** DbgView( *LIST ) TgtRls(V5R1M0)
**
**
**-- Control specification: --------------------------------------------**
H Option( *SrcStmt ) BndDir( 'QC2LE' ) DecEdit( *JOBRUN )
H DftActGrp(*NO)
**-- Printer file:
FQSYSPRT O F 132 Printer InfDs( PrtLinInf ) OflInd( *InOf )
F UsrOpn
**-- Printer file information:
D PrtLinInf Ds
D PlOvfLin 5i 0 Overlay( PrtLinInf: 188 )
D PlCurLin 5i 0 Overlay( PrtLinInf: 367 )
D PlCurPag 5i 0 Overlay( PrtLinInf: 369 )
**-- System information:
D SDs
D PsPgmNam *Proc
**-- API error information:
D ERRC0100 Ds Qualified
D BytPro 10i 0 Inz( %Size( ERRC0100 ))
D BytAvl 10i 0
D MsgId 7a
D 1a
D MsgDta 256a
**-- Global variables:
D LstTim s 6s 0
D IfsObj s 109a
D LinTxt s 40a
D LinVal s 50a
D LinVal2 s 105a
**
D BufSizAvl s 10u 0 Inz( 0 )
D NbrBytRtn s 10u 0 Inz( 0 )
D ApiRcvSiz s 10u 0
D rc s 10i 0
D Idx s 10i 0
D pBuffer s *
D ErrTxt s 256a
D MsgKey s 4a
**
D ObjOwn s 10a
D ObjPgp s 10a
D AutLstNam s 10a
D UsrNam s 10a
D UsrDtaAut s 10a
**
D AutObjMgm s 1a
D AutObjExs s 1a
D AutObjAlt s 1a
D AutObjRef s 1a
D AutObjOpr s 1a
D AutDtaRead s 1a
D AutDtaAdd s 1a
D AutDtaUpd s 1a
D AutDtaDlt s 1a
D AutDtaExe s 1a
D AutDtaExcl s 1a
**-- Spooled file information:
D SPRL0100 Ds Qualified
D BytRtn 10i 0
D BytAvl 10i 0
D SplfNam 10a
D JobNam 10a
D UsrNam 10a
D JobNbr 6a
D SplfNbr 10i 0
D JobSysNam 8a
D SplfCrtDat 7a
D 1a
D SplfCrtTim 6a
**-- File attributes:
D QP0L_ATTR_AUTH c 11
**-- API path constants:
D CUR_CCSID c 0
D CUR_CTRID c x'0000'
D CUR_LNGID c x'000000'
D CHR_DLM_1 c 0
**-- General authority format:
D GenAut Ds Qualified Align Based( pGenAut )
D ObjOwn 10a
D PriGrp 10a
D AutL 10a
D 10a
D OfsUsrE 10i 0
D NbrUsrE 10i 0
D SizUsrE 10i 0
D 12a
**
D UsrAut Ds Qualified Align Based( pUsrAut )
D UsrNam 10a
D UsrDtaAut 10a
D ObjMgm 1a
D ObjExs 1a
D ObjAlt 1a
D ObjRef 1a
D 10a
D ObjOpr 1a
D DtaRead 1a
D DtaAdd 1a
D DtaUpd 1a
D DtaDlt 1a
D DtaExe 1a
D DtaExclude 1a
D 7a
**-- API path:
D Path Ds Qualified Align
D CcsId 10i 0 Inz( CUR_CCSID )
D CtrId 2a Inz( CUR_CTRID )
D LngId 3a Inz( CUR_LNGID )
D 3a Inz( *Allx'00' )
D PthTypI 10i 0 Inz( CHR_DLM_1 )
D PthNamLen 10i 0
D PthNamDlm 2a Inz( '/ ' )
D 10a Inz( *Allx'00' )
D PthNam 5000a
**
D AtrIds Ds Qualified Align
D NbrAtr 10i 0
D AtrId 10i 0 Dim( 32 )
**
D Buffer Ds Qualified Align Based( pBufferE )
D OfsNxtAtr 10i 0
D AtrId 10i 0
D SizAtr 10i 0
D 4a
D AtrDta 1024a
D AtrInt2 5i 0 Overlay( AtrDta: 1 )
D AtrInt 10i 0 Overlay( AtrDta: 1 )
D AtrUint 10u 0 Overlay( AtrDta: 1 )
D AtrUint8 20u 0 Overlay( AtrDta: 1 )
**-- Get attributes:
D GetAtr Pr 10i 0 ExtProc( 'Qp0lGetAttr' )
D GaFilNam * Value
D GaAtrLst * Value
D GaBuffer * Value
D GaBufSizPrv 10u 0 Value
D GaBufSizAvl 10u 0
D GaBufSizRtn 10u 0
D GaFlwSymLnk 10u 0 Value
D GaDots 10i 0 Options( *NoPass )
**-- Initialize memory:
D memset Pr 10i 0 ExtProc( 'memset' )
D pStg * Value
D InzVal 1a Value
D InzByt 10i 0 Value
**-- Copy memory:
D memcpy Pr * ExtProc( '_MEMMOVE' )
D MemOut * Value
D MemInp * Value
D MemSiz 10u 0 Value
**-- Send program message:
D SndPgmMsg Pr ExtPgm( 'QMHSNDPM' )
D SpMsgId 7a Const
D SpMsgFq 20a Const
D SpMsgDta 128a Const
D SpMsgDtaLen 10i 0 Const
D SpMsgTyp 10a Const
D SpCalStkE 10a Const Options( *VarSize )
D SpCalStkCtr 10i 0 Const
D SpMsgKey 4a
D SpError 32767a Options( *VarSize )
**-- Retrieve last spooled file identity:
D RtvLstSplfId Pr ExtPgm( 'QSPRILSP' )
D RsRcvVar 32767a Options( *VarSize )
D RsRcvVarLen 10i 0 Const
D RsFmtNam 8a Const
D RsError 32767a Options( *VarSize )
**-- Run system command:
D system Pr 10i 0 ExtProc( 'system' )
D command * Value Options( *String )
**-- Write attribute line:
D WrtAtrLin Pr
D PxLinTxt 40a Const
D PxLinVal 50a Const
**-- Write attribute line:
D WrtAtrLin2 Pr
D PxLinVal 100a Const
**-- Write blank line:
D WrtBlkLin Pr
**-- Write list header:
D WrtLstHdr Pr
D PxOvrFlwRel 10i 0 Const Options( *NoPass )
**-- Send escape message:
D SndEscMsg Pr 10i 0
D PxMsgDta 512a Const Varying
**-- Send completion message:
D SndCmpMsg Pr 10i 0
D PxMsgDta 512a Const Varying
**-- Error identification:
D errno Pr 10i 0
**
D strerror Pr 128a Varying
D DSPIFSAUT Pr
D PxIfsObj 5002a Varying
**
D DSPIFSAUT Pi
D PxIfsObj 5002a Varying
/Free
Path.PthNam = PxIfsObj;
Path.PthNamLen = %Len( PxIfsObj );
AtrIds.NbrAtr = 1;
AtrIds.AtrId = QP0L_ATTR_AUTH;
If GetAtr( %Addr( Path )
: %Addr( AtrIds )
: *Null
: *Zero
: BufSizAvl
: NbrBytRtn
: 0
) = 0;
ApiRcvSiz = BufSizAvl;
pBuffer = %Alloc( ApiRcvSiz );
memset( pBuffer: x'00': ApiRcvSiz );
If GetAtr( %Addr( Path )
: %Addr( AtrIds )
: pBuffer
: ApiRcvSiz
: BufSizAvl
: NbrBytRtn
: 0
) = 0;
pBufferE = pBuffer;
//When Buffer.AtrId = QP0L_ATTR_AUTH;
pGenAut = %Addr( Buffer.AtrDta );
ObjOwn = GenAut.ObjOwn;
ObjPgp = GenAut.PriGrp;
AutLstNam = GenAut.AutL;
Open QSYSPRT;
WrtAtrLin( 'Authorization list . . . . . . . . . . :': AutLstNam );
WrtAtrLin( 'Object primary group . . . . . . . . . :': ObjPgp );
WrtBlkLin();
WrtAtrLin( 'User authority . . . . :' : ' ');
LinVal2 = ' Data --Object Authorities-- ' +
'-------------Data Authorities------------';
WrtAtrLin2(LinVal2);
LinVal2 = 'User Authority Exist Mgt Alter Ref ' +
'Objopr Read Add Update Delete Execute';
WrtAtrLin2(LinVal2);
WrtBlkLin();
pUsrAut = pBuffer + GenAut.OfsUsrE;
For Idx = 1 to GenAut.NbrUsrE;
// Authorization entry available here
LinVal2 = ' ';
%SubSt(LinVal2:1 :10) = UsrAut.UsrNam;
%SubSt(LinVal2:13:10) = UsrAut.UsrDtaAut;
If UsrAut.ObjExs = X'01';
%SubSt(LinVal2:26: 1) = 'X';
EndIf;
If UsrAut.ObjMgm = X'01';
%SubSt(LinVal2:32: 1) = 'X';
EndIf;
If UsrAut.ObjAlt = X'01';
%SubSt(LinVal2:38: 1) = 'X';
EndIf;
If UsrAut.ObjRef = X'01';
%SubSt(LinVal2:44: 1) = 'X';
EndIf;
If UsrAut.ObjOpr = X'01';
%SubSt(LinVal2:50: 1) = 'X';
EndIf;
If UsrAut.DtaRead= X'01';
%SubSt(LinVal2:57: 1) = 'X';
EndIf;
If UsrAut.DtaAdd = X'01';
%SubSt(LinVal2:63: 1) = 'X';
EndIf;
If UsrAut.DtaUpd = X'01';
%SubSt(LinVal2:69: 1) = 'X';
EndIf;
If UsrAut.DtaDlt = X'01';
%SubSt(LinVal2:77: 1) = 'X';
EndIf;
If UsrAut.DtaExe = X'01';
%SubSt(LinVal2:86: 1) = 'X';
EndIf;
WrtAtrLin2( LinVal2 );
WrtBlkLin();
If Idx < GenAut.NbrUsrE;
pUsrAut += GenAut.SizUsrE;
EndIf;
EndFor;
Close QSYSPRT;
ExSr DspSplf;
EndIf;
Else;
SndEscMsg( %Char( Errno ) + ': ' + Strerror );
EndIf;
DeAlloc pBuffer;
*InLr = *On;
Return;
BegSr DspSplf;
RtvLstSplfId( SPRL0100: %Size( SPRL0100 ): 'SPRL0100': ERRC0100 );
system( 'DSPSPLF FILE(' + %Trim( SPRL0100.SplfNam ) + ')' +
' JOB(' + %Trim( SPRL0100.JobNbr ) + '/' +
%Trim( SPRL0100.UsrNam ) + '/' +
%Trim( SPRL0100.JobNam ) + ')' +
' SPLNBR(' + %Char( SPRL0100.SplfNbr ) + ')'
);
system( 'DLTSPLF FILE(' + %Trim( SPRL0100.SplfNam ) + ')' +
' JOB(' + %Trim( SPRL0100.JobNbr ) + '/' +
%Trim( SPRL0100.UsrNam ) + '/' +
%Trim( SPRL0100.JobNam ) + ')' +
' SPLNBR(' + %Char( SPRL0100.SplfNbr ) + ')'
);
SndCmpMsg( 'IFS authority list has been displayed and deleted.' );
EndSr;
BegSr *InzSr;
LstTim = %Int( %Char( %Time(): *ISO0));
If %Len( PxIfsObj ) > %Size( IfsObj );
EvalR IfsObj = PxIfsObj;
%Subst( IfsObj: 1: 3 ) = '...';
Else;
IfsObj = PxIfsObj;
EndIf;
EndSr;
/End-Free
**-- Printer file definition: ------------------------------------------**
OQSYSPRT EF Header 2 2
O UDATE Y 8
O LstTim 18 ' : : '
O 70 'Display IFS File Attribute-
O s'
O 107 'Program:'
O PsPgmNam 118
O 126 'Page:'
O PAGE + 1
OQSYSPRT EF LstHdr 1
O 20 'Object . . . . . . :'
O IfsObj 132
OQSYSPRT EF DtlLin 1
O LinTxt 40
O LinVal 93
OQSYSPRT EF DtlLin2 1
O LinVal2 130
OQSYSPRT EF DtlBlk 1
**
OQSYSPRT EF LstTrl 1
O 26 '* E N D O F L I S T *'
**-- Get runtime error number: -----------------------------------------**
P errno B
D Pi 10i 0
D sys_errno Pr * ExtProc( '__errno' )
**
D Error s 10i 0 Based( pError ) NoOpt
/Free
pError = sys_errno;
Return Error;
/End-Free
P Errno E
**-- Get runtime error text: -------------------------------------------**
P strerror B
D Pi 128a Varying
D sys_strerror Pr * ExtProc( 'strerror' )
D 10i 0 Value
/Free
Return %Str( sys_strerror( Errno ));
/End-Free
P strerror E
**-- Write attribute line: ---------------------------------------------**
P WrtAtrLin B
D Pi
D PxLinTxt 40a Const
D PxLinVal 50a Const
/Free
WrtLstHdr( 3 );
LinTxt = PxLinTxt;
LinVal = PxLinVal;
Except DtlLin;
/End-Free
P WrtAtrLin E
**-- Write attribute line2: ---------------------------------------------**
P WrtAtrLin2 B
D Pi
D PxLinVal2 100a Const
/Free
WrtLstHdr( 3 );
LinVal2= PxLinVal2;
Except DtlLin2;
/End-Free
P WrtAtrLin2 E
**-- Write blank line: -------------------------------------------------**
P WrtBlkLin B
D Pi
/Free
WrtLstHdr( 2 );
Except DtlBlk;
/End-Free
P WrtBlkLin E
**-- Write list header: ------------------------------------------------**
P WrtLstHdr B
D Pi
D PxOvrFlwRel 10i 0 Const Options( *NoPass )
/Free
If %Parms = *Zero;
Except Header;
Except LstHdr;
Else;
If PlCurLin > PlOvfLin - PxOvrFlwRel;
Except Header;
Except LstHdr;
EndIf;
EndIf;
/End-Free
P WrtLstHdr E
**-- Send escape message: ----------------------------------------------**
P SndEscMsg B
D Pi 10i 0
D PxMsgDta 512a Const Varying
/Free
SndPgmMsg( 'CPF9897'
: 'QCPFMSG *LIBL'
: PxMsgDta
: %Len( PxMsgDta )
: '*ESCAPE'
: '*PGMBDY'
: 1
: MsgKey
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
Return -1;
Else;
Return 0;
EndIf;
/End-Free
P SndEscMsg E
**-- Send completion message: ------------------------------------------**
P SndCmpMsg B
D Pi 10i 0
D PxMsgDta 512a Const Varying
/Free
SndPgmMsg( 'CPF9897'
: 'QCPFMSG *LIBL'
: PxMsgDta
: %Len( PxMsgDta )
: '*COMP'
: '*PGMBDY'
: 1
: MsgKey
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
Return -1;
Else;
Return 0;
EndIf;
/End-Free
**
P SndCmpMsg E
File : QCMDSRC
Member : DSPIFSAUT
Type : CMD
Usage : CRTCMD CMD(DSPIFSAUT) PGM(DSPIFSAUT)
Sample : DSPIFSAUT OBJ('/tmp')
/* =============================================================== */
/* = Command....... DspIfsAut = */
/* = CPP........... DspIfsAut = */
/* = Description... Display IFS File Authority = */
/* = = */
/* = CrtCmd Cmd( DspIfsAut ) = */
/* = Pgm( DspIfsAut ) = */
/* = SrcFile( YourSourceFile ) = */
/* = = */
/* =============================================================== */
/* = Date : 2008/07/30 = */
/* = Author: Vengoal Chang = */
/* =============================================================== */
CMD PROMPT('DISPLAY IFS FILE AUTHORITY')
PARM OBJ *PNAME 5000 +
MIN( 1 ) +
VARY( *YES *INT2 ) +
CASE( *MIXED ) +
PROMPT( 'OBJECT' )
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期三, 11月 08, 2023
2008-07-30 如何快速顯示 IFS 目錄或檔案的使用者權限?(Command: DSPIFSAUT with API Qp0lGetAttr)
星期二, 11月 07, 2023
2007-03-13 如何針對系統中密碼過期超過指定天數的 user , 將之設定為失效(DISABLED)?(Command: ANZUSREXP API:QSYRUSRI)
如何針對系統中密碼過期超過指定天數的 user , 將之設定為失效(DISABLED)?(Command: ANZUSREXP API:QSYRUSRI)
Vengoal AS/400 日誌
張純銀 (Vengoal Chang) 的日誌
AS/400 相關資訊分享
王春元部落格 易網打勁 易經教學
Vengoal 新網頁
所有過往電子報請至 Vengoal AS/400 日誌瀏覽
若您有任何 AS/400 報表格式轉換(TXT, EXCEL, PDF, email)或報表儲存至 windows 平台及列印或難字處理需求, 請洽中菲電腦 (02)25117233 分機 609 蘇先生.
某大陸網站將我的電子報內容轉成簡體, 一字不差且未註明出處, 在此建議若欲轉載請註明來源.
如何針對系統中密碼過期超過指定天數的 user , 將之設定為失效(DISABLED)?(Command: ANZUSREXP API:QSYRUSRI)
File : QRPGLESRC
Member: ANZUSREXP
Type : RPGLE
Usage : CRTBNDPGM ANZUSREXP
OS : V5R2(含)以後
**
** Program . . : ANZUSREXP
** Description : Analyze user profiles expiration by expired date
** and do action
** Author . . : Vengoal Chang
**
** Date . . : 2007/03/13
**
**
**-- Control specification: --------------------------------------------**
H Option( *SrcStmt: *NoDebugIo ) DftActGrp(*NO)
**-- Printer file:
FQSYSPRT O F 132 Printer InfDs( PrtLinInf ) OflInd( *InOf )
**-- Printer file information:
D PrtLinInf Ds Qualified
D OvfLin 5i 0 Overlay( PrtLinInf: 188 )
D CurLin 5i 0 Overlay( PrtLinInf: 367 )
D CurPag 5i 0 Overlay( PrtLinInf: 369 )
**-- System information:
D PgmSts SDs Qualified
D PgmNam *Proc
**-- API error data structure:
D ERRC0100 Ds Qualified
D BytPrv 10i 0 Inz( %Size( ERRC0100 ))
D BytAvl 10i 0
D MsgId 7a
D 1a
D MsgDta 128a
**-- Global variables:
D LstTim s 6s 0
D SysNam s 8a
D TrlTxt s 32a
D Workdate s d
D CmdStr S 1024 INZ
D CmdLen S 15P 5 INZ(1024)
**-- List record:
D LstRcd Ds Qualified
D UsrPrf 10a
D PrfSts 10a
D PwdExpI 4a
D PwdExpD 8a
D InvSgo 3i 0
D GrpPrf 10a
D PwdI 4a
D LmtCap 4a
D SpcAut 4a
D UsrCls 10a
D PrvSgoD 8a
D PwdChgD 8a
**-- List API parameters:
D LstApi Ds Qualified Inz
D RtnRcdNbr 10i 0
D GrpNam 10a
D SltCri 10a
**-- List information:
D LstInf Ds Qualified
D RcdNbrTot 10i 0
D RcdNbrRtn 10i 0
D Handle 4a
D RcdLen 10i 0
D InfSts 1a
D Dts 13a
D LstSts 1a
D 1a
D InfLen 10i 0
D Rcd1 10i 0
D 40a
**-- User information:
D AUTU0100 Ds Qualified
D UsrPrf 10a
D UsrGrpI 1a
D GrpMbrI 1a
**-- User information:
D USRI0300 Ds Qualified
D BytRtn 10i 0
D BytAvl 10i 0
D UsrPrf 10a
D PrvSgoDts 13a Overlay( USRI0300: 19 )
D PrvSgoDat 7a Overlay( USRI0300: 19 )
D PrvSgoTim 6a Overlay( USRI0300: 26 )
D InvSgo 10i 0 Overlay( USRI0300: 33 )
D PrfSts 10a Overlay( USRI0300: 37 )
D PwdChgDat 8a Overlay( USRI0300: 47 )
D NoPwdI 1a Overlay( USRI0300: 55 )
D PwdExpDat 8a Overlay( USRI0300: 61 )
D PwdExpI 1a Overlay( USRI0300: 73 )
D UsrCls 10a Overlay( USRI0300: 74 )
D SpcAut 15a Overlay( USRI0300: 84 )
D GrpPrf 10a Overlay( USRI0300: 99 )
D LmtCap 10a Overlay( USRI0300: 189 )
**-- Open list of authorized users:
D LstAutUsr Pr ExtPgm( 'QGYOLAUS' )
D LuRcvVar 65535a Options( *VarSize )
D LuRcvVarLen 10i 0 Const
D LuLstInf 80a
D LuNbrRcdRtn 10i 0 Const
D LuFmtNam 8a Const
D LuSltCri 10a Const
D LuGrpNam 10a Const
D LuError 1024a Options( *VarSize )
**-- Get list entry:
D GetLstEnt Pr ExtPgm( 'QGYGTLE' )
D GlRcvVar 65535a Options( *VarSize )
D GlRcvVarLen 10i 0 Const
D GlHandle 4a Const
D GlLstInf 80a
D GlNbrRcdRtn 10i 0 Const
D GlRtnRcdNbr 10i 0 Const
D GlError 1024a Options( *VarSize )
**-- Close list:
D CloseLst Pr ExtPgm( 'QGYCLST' )
D ClHandle 4a Const
D ClError 1024a Options( *VarSize )
**-- Send program message:
D SndPgmMsg Pr ExtPgm( 'QMHSNDPM' )
D SpMsgId 7a Const
D SpMsgFq 20a Const
D SpMsgDta 128a Const
D SpMsgDtaLen 10i 0 Const
D SpMsgTyp 10a Const
D SpCalStkE 10a Const Options( *VarSize )
D SpCalStkCtr 10i 0 Const
D SpMsgKey 4a
D SpError 32767a Options( *VarSize )
**-- Convert date & time:
D CvtDtf Pr ExtPgm( 'QWCCVTDT' )
D CdInpFmt 10a Const
D CdInpVar 17a Const Options( *VarSize )
D CdOutFmt 10a Const
D CdOutVar 17a Options( *VarSize )
D CdError 10i 0 Const
**-- Retrieve net attribute:
D RtvNetAtr Pr ExtPgm( 'QWCRNETA' )
D RnRcvVar 32767a Options( *VarSize )
D RnRcvVarLen 10i 0 Const
D RnNbrNetAtr 10i 0 Const
D RnNetAtr 10a Const Dim( 256 )
D Options( *VarSize )
D RnError 32767a Options( *VarSize )
**-- Retrieve user information:
D RtvUsrInf Pr ExtPgm( 'QSYRUSRI' )
D RuRcvVar 32767a Options( *VarSize )
D RuRcvVarLen 10i 0 Const
D RuFmtNam 10a Const
D RuUsrPrf 10a Const
D RuError 32767a Options( *VarSize )
**-- Retrieve object description:
D RtvObjD Pr ExtPgm( 'QUSROBJD' )
D RoRcvVar 32767a Options( *VarSize )
D RoRcvVarLen 10i 0 Const
D RoFmtNam 8a Const
D RoObjNamQ 20a Const
D RoObjTyp 10a Const
D RoError 32767a Options( *VarSize )
**-- Convert system DTS to date:
D CvtDtsDat Pr d
D PxSysDts 8a Value
**-- Get system name:
D GetSysNam Pr 8a Varying
**-- Get user creator:
D GetUsrCrt Pr 10a
D PxUsrPrf 10a Value
**-- Send completion message:
D SndCmpMsg Pr 10i 0
D PxMsgDta 512a Const Varying
**-- Write detail line:
D WrtDtlLin Pr
**-- Write list header:
D WrtLstHdr Pr
D PxOvrFlwRel 10i 0 Const Options( *NoPass )
**-- Write list trailer:
D WrtLstTrl Pr
D PxTrlTxt 32a Const
**-- Call system command:
D QCMDEXC PR ExtPgm('QCMDEXC')
D Cmd 500A options(*varsize) Const
D CmdLen 15P 5 Const
**-- Entry parameters:
D ANZUSREXP Pr
D PxOverDays 5 0
D PxActOpt 10a
D PxSysPrf 4a
**
D ANZUSREXP Pi
D PxOverDays 5 0
D PxActOpt 10a
D PxSysPrf 4a
/Free
ExSr GetWorkdate;
LstApi.RtnRcdNbr = 1;
LstApi.SltCri = '*ALL';
LstApi.GrpNam = '*NONE';
LstAutUsr( AUTU0100
: %Size( AUTU0100 )
: LstInf
: 1
: 'AUTU0100'
: LstApi.SltCri
: LstApi.GrpNam
: ERRC0100
);
If ERRC0100.BytAvl = *Zero;
DoW LstInf.LstSts <> '2' Or LstInf.RcdNbrTot >= LstApi.RtnRcdNbr;
ExSr GetPrfInf;
LstApi.RtnRcdNbr = LstApi.RtnRcdNbr + 1;
GetLstEnt( AUTU0100
: %Size( AUTU0100 )
: LstInf.Handle
: LstInf
: 1
: LstApi.RtnRcdNbr
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
Leave;
EndIf;
EndDo;
CloseLst( LstInf.Handle: ERRC0100 );
EndIf;
WrtLstTrl( '*** E N D O F L I S T ***' );
SndCmpMsg( 'List has been printed.' );
*InLr = *On;
Return;
BegSr GetPrfInf;
RtvUsrInf( USRI0300
: %Size( USRI0300 )
: 'USRI0300'
: AUTU0100.UsrPrf
: ERRC0100
);
If ERRC0100.BytAvl = *Zero;
ExSr ChkPrfInf;
EndIf;
EndSr;
BegSr ChkPrfInf;
If PxSysPrf = '*YES' Or GetUsrCrt( USRI0300.UsrPrf ) <> '*IBM';
Select;
//When USRI0300.PwdExpI = 'Y';
// ExSr WrtPrfInf;
When USRI0300.PwdExpDat = *Blanks;
// No expiration date - skip user profile.
//When CvtDtsDat( USRI0300.PwdExpDat ) <= %Date();
When CvtDtsDat( USRI0300.PwdExpDat ) <= WorkDate;
If (PxActOpt = '*DISABLED');
CmdStr = 'CHGUSRPRF USRPRF(' + %trim(USRI0300.UsrPrf) +
') STATUS(*DISABLED)';
CmdLen = %len(%trim(CmdStr));
QCMDEXC(%trim(CmdStr) : CmdLen);
Else;
ExSr WrtPrfInf;
EndIf;
EndSl;
EndIf;
EndSr;
BegSr WrtPrfInf;
LstRcd.UsrPrf = USRI0300.UsrPrf;
LstRcd.PrfSts = USRI0300.PrfSts;
LstRcd.InvSgo = USRI0300.InvSgo;
LstRcd.GrpPrf = USRI0300.GrpPrf;
LstRcd.LmtCap = USRI0300.LmtCap;
LstRcd.UsrCls = USRI0300.UsrCls;
If USRI0300.PwdExpDat = *Blanks;
LstRcd.PwdExpD = '*NONE';
Else;
LstRcd.PwdExpD = %Char( CvtDtsDat( USRI0300.PwdExpDat ): *JOBRUN );
EndIf;
If USRI0300.PwdChgDat = *Blanks;
LstRcd.PwdChgD = '*NONE';
Else;
LstRcd.PwdChgD = %Char( CvtDtsDat( USRI0300.PwdChgDat ): *JOBRUN );
EndIf;
If USRI0300.PrvSgoDts = *Blanks;
LstRcd.PrvSgoD = '*NONE';
Else;
LstRcd.PrvSgoD = %Char( %Date( USRI0300.PrvSgoDat: *CYMD0 )
: *JOBRUN
);
EndIf;
If USRI0300.PwdExpI = 'Y';
LstRcd.PwdExpI = '*YES';
Else;
LstRcd.PwdExpI = '*NO';
EndIf;
If USRI0300.NoPwdI = 'Y';
LstRcd.PwdI = '*NO';
Else;
LstRcd.PwdI = '*YES';
EndIf;
If USRI0300.SpcAut = 'NNNNNNNN';
LstRcd.SpcAut = '*NO';
Else;
LstRcd.SpcAut = '*YES';
EndIf;
WrtDtlLin();
EndSr;
BegSr *InzSr;
LstTim = %Int( %Char( %Time(): *ISO0));
SysNam = GetSysNam();
WrtLstHdr();
EndSr;
/End-Free
C GetWorkDate BegSr
C eval Workdate = %Date()
C SUBDUR PxOverDays:*D Workdate
C EndSr
**-- Printer file definition: ------------------------------------------**
OQSYSPRT EF Header 2 2
O UDATE Y 8
O LstTim 18 ' : : '
O 36 'System:'
O SysNam 45
O 82 'User profile exceptions'
O 107 'Program:'
O PgmSts.PgmNam 118
O 126 'Page:'
O PAGE + 1
**
OQSYSPRT EF LstHdr 1
O 4 'User'
O 17 'Class'
O 29 'Group'
O 42 'Status'
O 53 'Limit'
O 65 'Spc.aut.'
O 75 'Inv.sign.'
O 84 'Password'
O 94 'Pwd.exp.'
O 104 'Exp.date'
O 114 'Sign-on'
O 129 'Pwd. changed'
**
OQSYSPRT EF DtlLin 1
O LstRcd.UsrPrf 10
O LstRcd.UsrCls 22
O LstRcd.GrpPrf 34
O LstRcd.PrfSts 46
O LstRcd.LmtCap 52
O LstRcd.SpcAut 62
O LstRcd.InvSgo Z 70
O LstRcd.PwdI 81
O LstRcd.PwdExpI 92
O LstRcd.PwdExpD 104
O LstRcd.PrvSgoD 115
O LstRcd.PwdChgD 126
**
OQSYSPRT EF LstTrl 1
O TrlTxt 34
**-- Write detail line: ------------------------------------------------**
P WrtDtlLin B
D Pi
/Free
WrtLstHdr( 3 );
Except DtlLin;
/End-Free
P WrtDtlLin E
**-- Write list header: ------------------------------------------------**
P WrtLstHdr B
D Pi
D PxOvrFlwRel 10i 0 Const Options( *NoPass )
/Free
If %Parms = *Zero;
Except Header;
Except LstHdr;
Else;
If PrtLinInf.CurLin > PrtLinInf.OvfLin - PxOvrFlwRel;
Except Header;
Except LstHdr;
EndIf;
EndIf;
/End-Free
P WrtLstHdr E
**-- Write list trailer: -----------------------------------------------**
P WrtLstTrl B
D Pi
D PxTrlTxt 32a Const
/Free
TrlTxt = PxTrlTxt;
Except LstTrl;
/End-Free
P WrtLstTrl E
**-- Convert system DTS to date: ---------------------------------------**
P CvtDtsDat B
D Pi d
D PxSysDts 8a Value
D MI_DTS s 20a
/Free
CvtDtf( '*DTS': PxSysDts: '*YYMD': MI_DTS: *Zero );
Return %Date( %Timestamp( MI_DTS: *ISO0 ));
/End-Free
P CvtDtsDat E
**-- Get system name: --------------------------------------------------**
P GetSysNam B
D Pi 8a Varying
**
**-- Local variables:
D Idx s 10i 0
D SysNam s 8a Varying
**
D RtnAtrLen s 10i 0
D NetAtrNbr s 10i 0 Inz( %Elem( NetAtr ))
D NetAtr s 10a Dim( 1 )
**
D RtnVar Ds Qualified
D RtnVarNbr 10i 0
D RtnVarOfs 10i 0 Dim( %Elem( NetAtr ))
D RtnVarDta 1024a
D RtnAtr Ds Qualified Based( RtnValPtr )
D AtrNam 10a
D DtaTyp 1a
D InfSts 1a
D AtrLen 10i 0
D Atr 1008a
/Free
RtnAtrLen = %Elem( NetAtr ) * 24 + ( %Size( SysNam )) + 4;
NetAtr(1) = 'SYSNAME';
RtvNetAtr( RtnVar
: RtnAtrLen
: NetAtrNbr
: NetAtr
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
SysNam = '';
Else;
For Idx = 1 to RtnVar.RtnVarNbr;
RtnValPtr = %Addr( RtnVar ) + RtnVar.RtnVarOfs(Idx);
If RtnAtr.AtrNam = 'SYSNAME';
SysNam = %SubSt( RtnAtr.Atr: 1: RtnAtr.AtrLen );
EndIf;
EndFor;
EndIf;
Return SysNam;
/End-Free
P GetSysNam E
**-- Get user creator: -------------------------------------------------**
P GetUsrCrt B Export
D Pi 10a
D PxUsrPrf 10a Value
**
D OBJD0300 Ds Qualified
D BytRtn 10i 0
D BytAvl 10i 0
D ObjCrt 10a Overlay( OBJD0300: 220 )
/Free
RtvObjD( OBJD0300
: %Size( OBJD0300 )
: 'OBJD0300'
: PxUsrPrf + 'QSYS'
: '*USRPRF'
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
Return *Blanks;
Else;
Return OBJD0300.ObjCrt;
EndIf;
/End-Free
P GetUsrCrt E
**-- Send completion message: ------------------------------------------**
P SndCmpMsg B
D Pi 10i 0
D PxMsgDta 512a Const Varying
**
D MsgKey s 4a
/Free
SndPgmMsg( 'CPF9897'
: 'QCPFMSG *LIBL'
: PxMsgDta
: %Len( PxMsgDta )
: '*COMP'
: '*PGMBDY'
: 1
: MsgKey
: ERRC0100
);
If ERRC0100.BytAvl > *Zero;
Return -1;
Else;
Return 0;
EndIf;
/End-Free
**
P SndCmpMsg E
File : QCMDSRC
Member: ANZUSREXP
Type : CMD
Usage : CRTCMD CMD(ANZUSREXP) PGM(ANZUSREXP)
OS : V5R2(含)以後
Usage : ANZUSREXP EXPDAYS(10) EXPACT(*PRINT) SYSPRF(*NO)
將密碼過期 10 天的 User 列印出來, 且不包含由系統預設產生的 user
ANZUSREXP EXPDAYS(10) EXPACT(*DISABLED)
將密碼過期 10 天的 User 設定為失效
/*-------------------------------------------------------------------*/
/* */
/* Compile options: */
/* */
/* CrtCmd Cmd( ANZUSREXP ) */
/* Pgm( ANZUSREXP ) */
/* SrcMbr( ANZUSREXP ) */
/* */
/*-------------------------------------------------------------------*/
Cmd Prompt( 'Analyze User Expired' )
PARM KWD(EXPDAYS) TYPE(*DEC) LEN(5 0) MIN(1) +
EXPR(*YES) PROMPT('Over user expired days')
PARM KWD(EXPACT) TYPE(*CHAR) LEN(10) RSTD(*YES) +
DFT(*PRINT) VALUES(*PRINT *DISABLED) +
EXPR(*YES) PROMPT('Action for over +
exipred days')
Parm SYSPRF *Char 4 +
Dft( *YES ) +
Rstd( *YES ) +
SpcVal(( *YES ) +
( *NO )) +
Expr( *YES ) +
Prompt( 'Include system profiles' )
2006-09-30 如何判別使用者對某些物件是否有某些權限?(CHKAUT command with API QSYRUSRA)
如何判別使用者對某些物件是否有某些權限?(CHKAUT command with API QSYRUSRA)
如何判別使用者對某些物件是否有某些權限?(CHKAUT command with API QSYRUSRA)
此指令執行時, 若使用者對物件沒有指定的權限, 會拋出錯誤訊息 CPF9802,
所以於 CLP中可以執行類似如下指令:
CHKAUT USER(TEST) OBJ(QGPL/QCLSRC) OBJTYPE(*FILE) AUT(*ALL)
monmsg cpf9802 exec(do)
/* 無權限處理程序 */
chgvar &Okay '0'
enddo
File : QCLSRC
Member: CHKAUT
Type : CLP
Usage : CRTCLPGM CHKAUT
/*------------------------------------------------------------------*/
/* Programmers Group & Management Resource Copyright 2000 */
/* */
/* \\\ */
/* ( o o ) */
/*------------------------oOO----(_)----OOo-------------------------*/
/* */
/* System name . . . : Technical Support */
/* Program name . . . : CHKAUT */
/* Text . . . . . . . : Check authority to the Object */
/* */
/* Author . . . . . . : Alexander Nubla */
/* Description . . . : This is the CPP for CHKAUT command. */
/* The program checks to determine what */
/* type of authority the user has over */
/* the specified object. */
/* */
/* ooooO Ooooo */
/* ( ) ( ) */
/*-------------------------( )-------------( )----------------------*/
/* (_) (_) */
/* Updated by Vengoal Chang 2006/09/30 */
/*------------------------------------------------------------------*/
pgm (&user /* Check user */ +
&fullobj /* Object name */ +
&objtype /* Object type */ +
&auts ) /* Authorities */
/*--------------------------------------------------------*/
/* declaration */
/*--------------------------------------------------------*/
dcl &user *char 10
dcl &fullobj *char 20
dcl &objtype *char 7
dcl &auts *char 72
dcl &obj *char 10
dcl &objlib *char 10
dcl &nbr *dec 5 0
dcl &objaut *char 10
dcl &authority *char 10
dcl &autreq *char 70
dcl &okay *char 1
dcl &RcvVar *char 93
dcl &VarLen *char 4 x'0000005D'
dcl &Fmtnam *char 8 USRA0100
dcl &Objtyp *char 10
dcl &ErrDta *char 116
dcl &ErrDta2 *char 116
dcl &bin4 *char 4
dcl &Erravl *dec 15
/*--------------------------------------------------------*/
/* error message variables */
/*--------------------------------------------------------*/
dcl &error *lgl /* std err */
dcl &msgid *char 7 /* std err */
dcl &msgkey *char 4 /* std err */
dcl &msgdta *char 100 /* std err */
dcl &msgf *char 10 /* std err */
dcl &msgflib *char 10 /* std err */
dcl &msgtyp *char 10 '*DIAG' /* std err */
dcl &msgtypctr *char 4 X'00000001' /* std err */
dcl &pgmmsgq *char 10 '*' /* std err */
dcl &stkctr *char 4 X'00000001' /* std err */
dcl &errbytes *char 4 X'00000000' /* std err */
monmsg msgid(cpf0000) exec(goto error)
/*--------------------------------------------------------*/
/* Get the object name & library */
/*--------------------------------------------------------*/
chgvar &Obj %sst(&FullObj 1 10)
chgvar &Objlib %sst(&FullObj 11 10)
if (%sst(&Objlib 1 1) = '*' ) do
rtvobjd obj(&Obj) +
objtype(&objtype) +
rtnlib(&Objlib)
enddo
chkobj obj(&Objlib/&Obj) +
objtype(&objtype)
/*--------------------------------------------------------*/
/* Retrieve user authority to the object */
/*--------------------------------------------------------*/
chgvar &RcvVar ' '
chgvar &Objtyp &objtype
chgvar &ErrDta X'00000074'
call pgm(QSYRUSRA) +
parm(&RcvVar +
&VarLen +
&Fmtnam +
&User +
&FullObj +
&Objtyp +
&ErrDta)
chgvar &bin4 %sst(&ErrDta 5 4)
chgvar &ErrAvl %bin(&bin4)
/*----------------------------------------------*/
/* Error found on the API, send error message */
/*----------------------------------------------*/
if (&ErrAvl > 0) do
chgvar &ErrDta2 %sst(&ErrDta 1 &ErrAvl)
chgvar &Msgid %sst(&ErrDta2 9 7)
chgvar &MsgDta %sst(&ErrDta2 17 100)
if (&Msgid *ne ' ') do
sndpgmmsg msgid(&Msgid) +
msgdta(&MsgDta) +
msgf(QCPFMSG) +
msgtype(*escape)
enddo
enddo
chgvar &ObjAut %sst(&RcvVar 9 10)
/*--------------------------------------------------------*/
/* Get the list of authorities requested */
/*--------------------------------------------------------*/
chgvar &Nbr %bin(&Auts 1 2)
chgvar &Nbr (&Nbr * 10)
chgvar &AutReq %sst(&Auts 3 &Nbr)
/*--------------------------------------------------------*/
/* Check the requested authorities Vs &ObjAut returned */
/*--------------------------------------------------------*/
chkaut:
chgvar &Authority %sst(&AutReq 1 10)
If (&Authority = ' ' ) goto nomore
chgvar &Okay 'Y'
If (&Authority *eq '*ALL' *and +
&Objaut *ne '*ALL') do
chgvar &Okay 'N'
enddo
If (&Authority *eq '*CHANGE' *and +
&Objaut *ne '*ALL' *and +
&Objaut *ne '*CHANGE') do
chgvar &Okay 'N'
enddo
If (&Authority *eq '*USE' *and +
&Objaut *ne '*ALL' *and +
&Objaut *ne '*CHANGE' *and +
&Objaut *ne '*USE') do
chgvar &Okay 'N'
enddo
If (&Authority *eq '*EXCLUDE' *and +
&Objaut *ne '*EXCLUDE' ) do
chgvar &Okay 'N'
enddo
If (&Authority *eq '*OBJOPR') do
chgvar &Okay %sst(&RcvVar 20 1)
enddo
If (&Authority *eq '*OBJMGT') do
chgvar &Okay %sst(&RcvVar 21 1)
enddo
If (&Authority *eq '*OBJEXIST') do
chgvar &Okay %sst(&RcvVar 22 1)
enddo
If (&Authority *eq '*OBJALTER') do
chgvar &Okay %sst(&RcvVar 92 1)
enddo
If (&Authority *eq '*OBJREF') do
chgvar &Okay %sst(&RcvVar 93 1)
enddo
If (&Authority *eq '*READ' ) do
chgvar &Okay %sst(&RcvVar 23 1)
enddo
If (&Authority *eq '*ADD') do
chgvar &Okay %sst(&RcvVar 24 1)
enddo
If (&Authority *eq '*UPDATE') do
chgvar &Okay %sst(&RcvVar 25 1)
enddo
If (&Authority *eq '*DELETE') do
chgvar &Okay %sst(&RcvVar 26 1)
enddo
If (&Authority *eq '*EXECUTE') do
chgvar &Okay %sst(&RcvVar 81 1)
enddo
/*--------------------------------------------------------*/
/* NOT AUTHORIZED! */
/*--------------------------------------------------------*/
If (&Okay *eq 'N' ) do
sndpgmmsg msgid(CPF9802) +
msgf(QCPFMSG) +
msgdta(&Obj || &Objlib || +
%sst(&Objtyp 2 6)) +
msgtype(*escape)
enddo
chgvar &AutReq %sst(&AutReq 11 60)
goto chkaut
nomore:
return
/*--------------------------------------------------------*/
/* error routine: */
/*--------------------------------------------------------*/
error:
if &error (goto errordone)
else chgvar &error '1'
/*----------------------------------------------*/
/* move all *DIAG message to *PRV program queue */
/*----------------------------------------------*/
call QMHMOVPM (&msgkey +
&msgtyp +
&msgtypctr +
&pgmmsgq +
&stkctr +
&errbytes)
/*----------------------------------------------*/
/* resend the last *ESCAPE message */
/*----------------------------------------------*/
errordone:
call QMHRSNEM (&msgkey +
&errbytes)
monmsg cpf0000 exec(do)
sndpgmmsg msgid(cpf3cf2) msgf(QCFPMSG) +
msgdta('QMHRSNEM') msgtype(*escape)
monmsg cpf0000
enddo
end: endpgm
File : QCMDSRC
Member: CHKAUT
Type : CMD
Usage : CRTCMD CMD(yourlib/CHKAUT) PGM(yourlib/CHKAUT)
/*-----------------------------------------------------------------*/
/* Programmers Group & Management Resource Copyright 2000 */
/* */
/* \\\ */
/* ( o o ) */
/*------------------------oOO----(_)----OOo------------------------*/
/* */
/* System name . . . : Technical Support */
/* Command name . . . : CHKAUT */
/* Text . . . . . . . : Check Authority of User */
/* */
/* Author . . . . . . : Alexander Nubla */
/* */
/* ooooO Ooooo */
/* ( ) ( ) */
/*-----------------------( )-------------( )-----------------------*/
/* (_) (_) */
/* */
/* Command parameters: */
/* */
/* ALLOW((*ALL) */
/* */
/* CPP: CHKAUT */
/* */
/*-----------------------------------------------------------------*/
CMD PROMPT('Check Authority')
/* -------------------------------------------- */
/* User id */
/* -------------------------------------------- */
PARM KWD(USER) TYPE(*NAME) LEN(10) +
SPCVAL((*CURRENT)) MIN(1) PROMPT('User')
/* -------------------------------------------- */
/* Object */
/* -------------------------------------------- */
PARM KWD(OBJ) TYPE(QOBJ) MIN(1) PROMPT('Object')
QOBJ: QUAL TYPE(*NAME) LEN(10) EXPR(*YES)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL)) EXPR(*YES) PROMPT('Library')
/* -------------------------------------------- */
/* Object type */
/* -------------------------------------------- */
PARM KWD(OBJTYPE) TYPE(*NAME) LEN(7) +
SPCVAL((*ALRTBL) (*AUTL) (*BNDDIR) +
(*CFGL) (*CHTFMT) (*CLD) (*CLS) (*CMD) +
(*CNNL) (*COSD) (*CRG) (*CRQD) (*CSI) +
(*CSPMAP) (*CSPTBL) (*CTLD) (*DEVD) +
(*DTAARA) (*DTADCT) (*DTAQ) (*EDTD) +
(*FCT) (*FILE) (*FNTRSC) (*FNTTBL) +
(*FORMDF) (*FTR) (*GSS) (*IPXD) (*JOBD) +
(*JOBQ) (*JRN) (*JRNRCV) (*LIB) (*LIND) +
(*LOCALE) (*MEDDFN) (*MENU) (*MGTCOL) +
(*MODD) (*MODULE) (*MSGF) (*MSGQ) (*M36) +
(*M36CFG) (*NODGRP) (*NODL) (*NTBD) +
(*NWID) (*NWSD) (*OUTQ) (*OVL) (*PAGDFN) +
(*PAGSEG) (*PDG) (*PGM) (*PNLGRP) +
(*PRDDFN) (*PRDLOD) (*PSFCFG) (*QMFORM) +
(*QMQRY) (*QRYDFN) (*RCT) (*SBSD) +
(*SCHIDX) (*SPADCT) (*SQLPKG) (*SQLUDT) +
(*SRVPGM) (*SSND) (*SVRSTG) (*TBL) +
(*USRIDX) (*USRPRF) (*USRQ) (*USRSPC) +
(*VLDL) (*WSCST)) MIN(1) EXPR(*YES) +
PROMPT('Object type')
/* -------------------------------------------- */
/* Object authority */
/* -------------------------------------------- */
PARM KWD(AUT) TYPE(*CHAR) LEN(10) RSTD(*YES) +
VALUES(*OBJALTER *OBJEXIST *OBJMGT +
*OBJOPR *OBJREF *ADD *DELETE *EXECUTE +
*READ *UPDATE) SNGVAL((*ALL) (*CHANGE) +
(*USE) (*EXCLUDE)) MIN(1) MAX(7) +
EXPR(*YES) PROMPT('Authority')
2006-01-09 如何檢核某位使用者是否有某些特殊權限?(Command CHKSPCAUT with API QSYCUSRS)
如何檢核某位使用者是否有某些特殊權限?(Command CHKSPCAUT with API QSYCUSRS)
QSYCUSRS -- Check User Special Authorities (QSYCUSRS) API
此 API 可檢核個人與群組組合的特殊權限.
CHKSPCAUT 指令可以檢核某一使用者是否有指定的特殊權限, 若無時, 此指令會拋出 CPFB304 的錯誤訊息ID
, 只要於 CLP 中監控此錯誤訊息ID,即知該使用者無所指定的特殊權限.
詳細訊息參照:
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/QSYCUSRS.htm
File : QCLSRC
Member: CHKSPCAUTC
Type : CLP
Usage : CRTCLPGM CHKSPCAUTC
PGM (&USER &SPCAUT)
/*--------------------------------------------------------*/
/* declaration */
/*--------------------------------------------------------*/
dcl &user *char 10
dcl &spcaut *char 82
dcl &autind *char 1
dcl &auts *char 80
dcl &autsno *char 4
dcl &calllvl *char 4 X'00000000'
dcl &errcde *char 8 X'0000000000000000'
dcl &spcautnoc *char 2
dcl &spcautno *dec 10
dcl &spcautlen *dec 10
/*--------------------------------------------------------*/
/* error message variables */
/*--------------------------------------------------------*/
dcl &error *lgl /* std err */
dcl &msgid *char 7 /* std err */
dcl &msgkey *char 4 /* std err */
dcl &msgdta *char 100 /* std err */
dcl &msgf *char 10 /* std err */
dcl &msgflib *char 10 /* std err */
dcl &msgtyp *char 10 '*DIAG' /* std err */
dcl &msgtypctr *char 4 X'00000001' /* std err */
dcl &pgmmsgq *char 10 '*' /* std err */
dcl &stkctr *char 4 X'00000001' /* std err */
dcl &errbytes *char 4 X'00000000' /* std err */
monmsg msgid(cpf0000) exec(goto error)
chgvar &spcautnoc %sst(&spcaut 1 2)
chgvar &spcautno %bin(&spcautnoc)
chgvar &spcautlen (&spcautno * 10)
chgvar %bin(&autsno) &spcautno
chgvar &auts %sst(&spcaut 3 &Spcautlen)
if (%sst(&spcaut 3 10) *EQ '*ALL ') do
chgvar &auts ('*ALLOBJ +
*AUDIT +
*IOSYSCFG +
*JOBCTL +
*SAVSYS +
*SECADM +
*SERVICE +
*SPLCTL ')
chgvar %bin(&autsno) 8
enddo
/*--------------------------------------------------------*/
/* Check authority */
/*--------------------------------------------------------*/
call QSYCUSRS parm(&autind +
&user +
&auts +
&autsno +
&calllvl +
&errcde)
/* RETURN &AUTIND */
/* Y The user has the specified special authorities. */
/* N The user does not have the specified special authorities.*/
if (&autind = 'Y') goto end
sndpgmmsg msgid(cpfb304) +
msgf(qcpfmsg) +
msgtype(*escape)
/*--------------------------------------------------------*/
/* error routine: */
/*--------------------------------------------------------*/
error:
if &error (goto errordone)
else chgvar &error '1'
/*----------------------------------------------*/
/* move all *DIAG message to *PRV program queue*/
/*----------------------------------------------*/
call QMHMOVPM (&msgkey +
&msgtyp +
&msgtypctr +
&pgmmsgq +
&stkctr +
&errbytes)
/*----------------------------------------------*/
/* resend the last *ESCAPE message */
/*----------------------------------------------*/
errordone:
call QMHRSNEM (&msgkey +
&errbytes)
monmsg cpf0000 exec(do)
sndpgmmsg msgid(cpf3cf2) msgf(QCFPMSG) +
msgdta('QMHRSNEM') msgtype(*escape)
monmsg cpf0000
enddo
end:
endpgm
File : QCMDSRC
Member: CHKSPCAUT
Type : CMD
Usage : CRTCMD CMD(CHKSPCAUT) PGM(CHKSPCAUTC)
/********************************************************************/
/* Title: CHKSPCAUT: Check User Special Authority */
/* */
/* Description - This command performs special authority checked */
/* */
/* The Create Command command should include the following: */
/* */
/* CRTCMD CMD(CHKSPCAUT) PGM(CHKSPCAUTC) */
/* */
/* Usage in clp: */
/* CHKSPCAUT USER(TEST) SPCAUT(*ALL) */
/* MONMSG CPFB304 EXEC(DO) */
/* SNDPGMMSG MSG('USER DON'T HAVE SPECIFIED AUTHORITY') */
/* ENDDO */
/********************************************************************/
/*------------------------------------------------*/
/* Command Definition */
/*------------------------------------------------*/
CMD PROMPT('Check user special authority')
PARM KWD(USER) TYPE(*SNAME) LEN(10) MIN(1) +
PROMPT('User name')
PARM KWD(SPCAUT) TYPE(*CHAR) LEN(10) RSTD(*YES) +
VALUES(*ALLOBJ *AUDIT *IOSYSCFG *JOBCTL +
*SAVSYS *SECADM *SERVICE *SPLCTL) +
SPCVAL((*ALL)) MIN(1) MAX(8) EXPR(*YES) +
PROMPT('Special authority')
File : QCLSRC
Member: CHKSPCAUTT
Type : CLP
Usage : CRTCLPGM CHKSPCAUTT
假設有一個使用者 TEST, 要檢核其是否有哪些特殊權限, 可以用以下範例
PGM
CHKSPCAUT USER(TEST) SPCAUT(*ALL)
MONMSG CPFB304 EXEC(DO)
SNDPGMMSG MSG('User TEST didn''t have *all spcial aut.')
ENDDO
CHKSPCAUT USER(TEST) SPCAUT(*JOBCTL)
MONMSG CPFB304 EXEC(DO)
SNDPGMMSG MSG('User TEST didn''t have *JOBCTL spcaut.')
ENDDO
CHKSPCAUT USER(TEST) SPCAUT(*SPLCTL)
MONMSG CPFB304 EXEC(DO)
SNDPGMMSG MSG('User TEST didn''t have *SPLCTL spcaut.')
ENDDO
ENDPGM
星期一, 11月 06, 2023
2004-04-21 如何檢查使用者對某一物件事否有權限 ?
如何檢查使用者對某一物件事否有權限 ?
APIs BY EXAMPLE: CHECK USER AUTHORITY
In this issue of APIs by Example, Carsten Flensburg demonstrates checking a
user's authority to an object.
The first sample program is called CBX5031. It checks to see if a given user
has private authority to an object, such as that provided when a user is
listed in an authorization list. It does not check other sources of
authority.
Here's an example that calls CBX5031 from an ILE RPG program to see if a
user has *ALL authority to object MYLIBRARY/MYOBJECT via an authorization
list:
C Call 'CBX5031'
C Parm 'MYOBJECT' PxObjNam
C Parm 'MYLIBRARY' PxObjLib
C Parm '*AUTL' PxObjTyp
C Parm 'MYUSERID' PxUsrPrf
C Parm '*ALL' PxAut
C Parm PxRtnCod
C if PxRtnCod = '1'
C*** user has authority.
C else
C*** user does not have authority.
C endif
The second sample program is called CBX5032. It checks to see if a given
user has authority to an object. All means of providing authority are taken
into account, including group profiles, adopted authority, *PUBLIC, *ALLOBJ,
and authorization lists.
Here's an example that calls CBX5032 from an ILE RPG program to see if a
user has *USE authority to MYPGM, which is a program that's located in his
library list:
C Call 'CBX5032'
C Parm 'MYPGM' PxObjNam
C Parm '*LIBL' PxObjLib
C Parm '*PGM' PxObjTyp
C Parm 'MYUSERID' PxUsrPrf
C Parm '*USE' PxAut
C Parm PxRtnCod
C if PxRtnCod = '1'
C*** user has authority.
C else
C*** user does not have authority.
C endif
A third sample program, CBX503T, is provided as a demonstration of making
calls to CBX5031 and CBX5032.
The following APIs are demonstrated in this article:
Retrieve User Authority to Object (QSYRUSRA)
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qsyrusra.htm
List Users Authorized to Object (QSYLUSRA)
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qsylusra.htm
You can download the sample code for this article from
http://www.iseriesnetwork.com/noderesources/code/clubtechcode/ChkUsrAut.zip
The above source code was written by Carsten Flensburg. For questions
regarding this tip, contact Carsten at mailto:flensburg@novasol.dk
CBX5031.RPGLE
**
** Program . . : CBX5031
** Description : Check private authority
** Author . . : Carsten Flensburg
** Published . : Club Tech iSeries Programming Tips Newsletter
** Date . . . : April 15, 2004
**
**
** Program summary
** ---------------
**
** Parameters:
** INPUT PxObjNam Object name, the object for which to
** check the specified authorization level.
**
** INPUT PxObjLib Object library.
**
** INPUT PxObjTyp Object type.
**
** INPUT PxAut Authorization level to check for.
**
** Valid values:
** *ALL
** *CHANGE
** *USE
** *EXCLUDE
** *AUTLMGT
**
** INPUT PxUsrPrf Name of user profile having it's
** authority checked.
**
** Special values:
** *CURRENT The user currently running
** the job.
**
** *PUBLIC The public authority for
** the specified object is
** checked.
**
** OUTPUT PxRtnCod A boolean value indicating the result
** of the requested action.
**
** Valid return codes:
** 0 = Authority level not found
** 1 = Authority level found
**
** Security API:
** QSYLUSRA List users authorized Creates a list of users having a
** to object private authority to the object
** specified. The list is put into
** a user space.
**
** Object - User space APIs:
** QUSCRTUS Create user space Creates a user space in either
** user domain or system domain.
** Only user domain user spaces are
** accessible by the user space APIs.
**
** QUSDLTUS Delete user space Deletes the user space specified.
**
** QUSPTRUS Retrieve pointer to The address of the first byte
** user space of the storage allocated by the
** user space requested is returned.
**
**
** Programmer's notes:
** This program checks if a user holds a private authorization of
** the specified level to an object. No other authorization sources
** are taken into account during the authorization check.
**
**
** Compile options:
**
** CrtRpgMod Module( CBX5031 ) DbgView( *LIST )
**
** CrtPgm Pgm( CBX5031 )
** Module( CBX5031 )
**
** **
**-- Header specifications: --------------------------------------------**
H Option( *SrcStmt )
**-- System information: -----------------------------------------------**
D PgmSts SDs
D PsJobUsr 10a Overlay( PgmSts: 254 )
D PsCurUsr 10a Overlay( PgmSts: 358 )
**-- Global variables: -------------------------------------------------**
D Idx s 10i 0
**-- API error data structure: -----------------------------------------**
D ApiError Ds
D AeBytPro 10i 0 Inz( %Size( ApiError ))
D AeBytAvl 10i 0 Inz
**-- Create User Space Parameter: --------------------------------------**
D CuUsrSpcQ Ds
D CuUsrSpcNam 10 Inz( 'AUTLST ' )
D CuUsrSpcLib 10 Inz( 'QTEMP ' )
**-- Entry format USRA0100: --------------------------------------------**
D USRA0100 Ds Based( pLstEnt )
D U1UsrPrf 10a
D U1AutVal 10a
D U1AutLstMgt 1a
D U1ObjOpr 1a
D U1ObjMgt 1a
D U1ObjExs 1a
D U1DtaRead 1a
D U1DtaAdd 1a
D U1DtaUpd 1a
D U1DtaDlt 1a
D U1DtaExe 1a
D 10a
D U1ObjAlt 1a
D U1ObjRef 1a
**-- API format USRA0100: Header information: --------------------------**
D HdrInf Ds Based( pHdrInf )
D HiObjNam 10a
D HiLibNam 10a
D HiObjTyp 10a
D HiOwnNam 10a
D HiAutL 10a
D HiPriGrp 10a
D HiFldAut 1a
D HiAspDevLib 10a
D HiAspDevObj 10a
**-- User Space Generic Header: ---------- -----------------------------**
D UsrSpc Ds Based( pUsrSpc )
D UsOfsHdr 10i 0 Overlay( UsrSpc: 117 )
D UsOfsLst 10i 0 Overlay( UsrSpc: 125 )
D UsNumLstEnt 10i 0 Overlay( UsrSpc: 133 )
D UsSizLstEnt 10i 0 Overlay( UsrSpc: 137 )
**-- Pointers: ---------------------------------------------------------**
D pUsrSpc s * Inz( *Null )
D pHdrInf s * Inz( *Null )
D pLstEnt s * Inz( *Null )
**-- List authorized users: --------------------------------------------**
D LstAutUsr Pr ExtPgm( 'QSYLUSRA' )
D LaSpcNamQ 20a Const
D LaFmtNam 8a Const
D LaObjNamQ 20a Const
D LaObjTyp 10a Const
D LaError 32767a Options( *VarSize )
D LaAspDev 10a Options( *NoPass )
**-- Create user space: -------------------------------------------------**
D CrtUsrSpc Pr ExtPgm( 'QUSCRTUS' )
D CsSpcNamQ 20a Const
D CsExtAtr 10a Const
D CsInzSiz 10i 0 Const
D CsInzVal 1a Const
D CsPubAut 10a Const
D CsText 50a Const
**
D CsReplace 10a Const Options( *NoPass )
D CsError 32767a Options( *NoPass: *VarSize )
**
D CsDomain 10a Const Options( *NoPass )
**
D CsTfrSizRqs 10i 0 Const Options( *NoPass )
D CsOptSpcAlg 1a Const Options( *NoPass )
**-- Retrieve pointer to user space: ------------------------------------**
D RtvPtrSpc Pr ExtPgm( 'QUSPTRUS' )
D RpSpcNamQ 20a Const
D RpPointer *
D RpError 32767a Options( *NoPass: *VarSize )
**-- Delete user space: -------------------------------------------------**
D DltUsrSpc Pr ExtPgm( 'QUSDLTUS' )
D DsSpcNamQ 20a Const
D DsError 32767a Options( *VarSize )
**-- Parameters: -------------------------------------------------------**
D PxObjNam s 10a
D PxObjLib s 10a
D PxObjTyp s 10a
D PxUsrPrf s 10a
D PxAut s 10a
D PxRtnCod s n
**
C *Entry Plist
C Parm PxObjNam
C Parm PxObjLib
C Parm PxObjTyp
C Parm PxUsrPrf
C Parm PxAut
C Parm PxRtnCod
**
**-- Mainline: ---------------------------------------------------------**
**
C Eval PxRtnCod = *Off
**
C If PxUsrPrf = '*CURRENT'
C Eval PxUsrPrf = PsCurUsr
C EndIf
**
C CallP CrtUsrSpc( CuUsrSpcQ
C : *Blanks
C : 65535
C : x'00'
C : '*CHANGE'
C : *Blanks
C : '*YES'
C : ApiError
C )
**
C CallP LstAutUsr( CuUsrSpcQ
C : 'USRA0100'
C : PxObjNam + PxObjLib
C : PxObjTyp
C : ApiError
C )
**
C If AeBytAvl = *Zero
**
C CallP RtvPtrSpc( CuUsrSpcQ
C : pUsrSpc
C )
**
C ExSr ChkUsrAut
C EndIf
**
C CallP DltUsrSpc( CuUsrSpcQ
C : ApiError
C )
**
C Return
**
**-- Check user authority: ---------------------------------------------**
C ChkUsrAut BegSr
**
C Eval pHdrInf = pUsrSpc + UsOfsHdr
C Eval pLstEnt = pUsrSpc + UsOfsLst
**
C For Idx = 1 to UsNumLstEnt
**
C If U1UsrPrf = PxUsrPrf
C ExSr ChkAutVal
**
C Leave
C EndIf
**
C If Idx < UsNumLstEnt
C Eval pLstEnt = pLstEnt + UsSizLstEnt
C EndIf
C EndFor
**
C EndSr
**-- Check authority value: --------------------------------------------**
C ChkAutVal BegSr
**
C Select
C When PxAut = '*ALL ' And
C U1AutVal = '*ALL '
**
C Eval PxRtnCod = *On
**
C When PxAut = '*CHANGE ' And
C U1ObjOpr = 'Y' And
C U1DtaRead = 'Y' And
C U1DtaAdd = 'Y' And
C U1DtaUpd = 'Y' And
C U1DtaDlt = 'Y' And
C U1DtaExe = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*USE ' And
C U1ObjOpr = 'Y' And
C U1DtaRead = 'Y' And
C U1DtaExe = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*AUTLMGT ' And
C U1AutLstMgt = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*EXCLUDE ' And
C U1AutVal = '*EXCLUDE '
**
C Eval PxRtnCod = *On
C EndSl
**
C EndSr
CBX5032.RPGLE
**
** Program . . : CBX5032
** Description : Check object authority
** Author . . : Carsten Flensburg
** Published . : Club Tech iSeries Programming Tips Newsletter
** Date . . . : April 15, 2004
**
**
** Program summary
** ---------------
**
** Parameters:
** INPUT PxObjNam Object name, the object for which to
** check the specified authorization level.
**
** INPUT PxObjLib Object library.
**
** INPUT PxObjTyp Object type.
**
** INPUT PxAut Authorization level to check for.
**
** Valid values:
** *ALL
** *CHANGE
** *USE
** *EXCLUDE
** *AUTLMGT
**
** INPUT PxUsrPrf Name of user profile having it's
** authority checked.
**
** Special values:
** *CURRENT The user currently running
** the job.
**
** *PUBLIC The public authority for
** the specified object is
** checked.
**
** OUTPUT PxRtnCod A boolean value indicating the result
** of the requested action.
**
** Valid return codes:
** 0 = Authority level not found
** 1 = Authority level found
**
** Security API:
** QSYRUSRA Retrieve user Returns a specific user's
** authority to object authority for the specified
** object.
**
**
** Programmer's notes:
** This program checks if a user has the specified authority to an
** object. All authorization sources are taken into account during
** the authorization check (group profile(s), adopted authority as
** well as authorization lists, public and *ALLOBJ authority).
**
** The actual source of authority is specified in the returned data
** structure subfield 'U1AutSrc' as a 2-letter code. Please check
** the Security API manual for the details. It can be found online
** here:
**
** http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qsyrusra.htm
**
**
** Compile options:
**
** CrtRpgMod Module( CBX5032 ) DbgView( *LIST )
**
** CrtPgm Pgm( CBX5032 )
** Module( CBX5032 )
**
**
**-----------------------------------------------------------------------**
** Revised . : 00.00.0000
** by . . . :
** Reference :
** Changes . :
**
**-- Header specifications: --------------------------------------------**
H Option( *SrcStmt )
**-- Api Error: --------------------------------------------------------**
D ApiError Ds
D AeBytPrv 10i 0 Inz( %Size( ApiError ))
D AeBytAvl 10i 0
D AeMsgId 7a
D 1a
D AeMsgDta 128a
**-- Receiver format USRA0100: -----------------------------------------**
D USRA0100 Ds
D U1BytRtn 10i 0
D U1BytAvl 10i 0
D U1ObjAut 10a
D U1AutLstMgt 1a
D U1ObjOpr 1a
D U1ObjMgm 1a
D U1ObjExs 1a
D U1DtaRead 1a
D U1DtaAdd 1a
D U1DtaUpd 1a
D U1DtaDlt 1a
D U1AutLst 10a
D U1AutSrc 2a
D U1AdpAut 1a
D U1AdpObjAut 10a
D U1AdpAutLstMg 1a
D U1AdpObjOpr 1a
D U1AdpObjMgm 1a
D U1AdpObjExs 1a
D U1AdpDtaRead 1a
D U1AdpDtaAdd 1a
D U1AdpDtaUpd 1a
D U1AdpDtaDlt 1a
D U1AdpDtaExe 1a
D 10a
D U1AdpObjAlt 1a
D U1AdpObjRef 1a
D 10a
D U1DtaExe 1a
D 10a
D U1ObjAlt 1a
D U1ObjRef 1a
D U1AspDevLib 10a
D U1AspDevObj 10a
**-- Retrieve user authority to object: --------------------------------**
D RtvUsrAut Pr ExtPgm( 'QSYRUSRA' )
D RuRcvVar Like( USRA0100 )
D RuRcvVarLen 10i 0 Const
D RuFmtNam 8a Const
D RuUsrPrf 10a Const
D RuObjNamQ 20a Const
D RuObjTyp 10a Const
D RuError 32767a Options( *VarSize )
D RuAspDev 10a Options( *NoPass )
**-- Parameters: -------------------------------------------------------**
D PxObjNam s 10a
D PxObjLib s 10a
D PxObjTyp s 10a
D PxUsrPrf s 10a
D PxAut s 10a
D PxRtnCod s n
**
C *Entry Plist
C Parm PxObjNam
C Parm PxObjLib
C Parm PxObjTyp
C Parm PxUsrPrf
C Parm PxAut
C Parm PxRtnCod
**
**-- Mainline: ---------------------------------------------------------**
**
C Eval PxRtnCod = *Off
**
C CallP RtvUsrAut( USRA0100
C : %Size( USRA0100 )
C : 'USRA0100'
C : PxUsrPrf
C : PxObjNam + PxObjLib
C : PxObjTyp
C : ApiError
C )
**
C If AeBytAvl = *Zero
**
C Select
C When PxAut = '*ALL ' And
C U1ObjAut = '*ALL '
**
C Eval PxRtnCod = *On
**
C When PxAut = '*CHANGE ' And
C U1ObjOpr = 'Y' And
C U1DtaRead = 'Y' And
C U1DtaAdd = 'Y' And
C U1DtaUpd = 'Y' And
C U1DtaDlt = 'Y' And
C U1DtaExe = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*USE ' And
C U1ObjOpr = 'Y' And
C U1DtaRead = 'Y' And
C U1DtaExe = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*AUTLMGT ' And
C U1AutLstMgt = 'Y'
**
C Eval PxRtnCod = *On
**
C When PxAut = '*EXCLUDE ' And
C U1ObjAut = '*EXCLUDE '
**
C Eval PxRtnCod = *On
C EndSl
C EndIf
C
C Return
**
CBX503T.RPGLE
**
** Program . . : CBX503T
** Description : Check authority programs - test
** Author . . : Carsten Flensburg
** Published . : Club Tech iSeries Programming Tips Newsletter
** Date . . . : April 15, 2004
**
** Test setup:
** Please replace the object name, library and type as well as
** user profile and authorization level to check for, to values
** appropriate for your enviroment in the two call examples below
** prior to compiling this test program.
**
**
** Compile options:
**
** CrtRpgMod Module( CBX503T ) DbgView( *LIST )
**
** CrtPgm Pgm( CBX503T )
** Module( CBX503T )
**
**-- Header specifications: --------------------------------------------**
H Option( *SrcStmt )
**-- Send program message: ---------------------------------------------**
D SndPgmMsg Pr ExtPgm( 'QMHSNDPM' )
D SpMsgId 7a Const
D SpMsgFq 20a Const
D SpMsgDta 128a Const
D SpMsgDtaLen 10i 0 Const
D SpMsgTyp 10a Const
D SpCalStkE 10a Const Options( *VarSize )
D SpCalStkCtr 10i 0 Const
D SpMsgKey 4a
D SpError 10i 0 Const
**-- Send completion message: ------------------------------------------**
D SndCmpMsg Pr 10i 0
D PxMsgDta 512a Const Varying
**-- Program parameters: -----------------------------------------------**
D PxObjNam s 10a
D PxObjLib s 10a
D PxObjTyp s 10a
D PxUsrPrf s 10a
D PxAut s 10a
D PxRtnCod s n
**
**-- Check private authority:
**
C Call 'CBX5031'
C Parm 'QPWFSERVER' PxObjNam
C Parm 'QSYS' PxObjLib
C Parm '*AUTL' PxObjTyp
C Parm 'QSYS' PxUsrPrf
C Parm '*ALL' PxAut
C Parm PxRtnCod
**
C If PxRtnCod = '1'
**
C CallP SndCmpMsg( 'User profile ' +
C %TrimR( PxUsrPrf ) +
C ' has private authority ' +
C %TrimR( PxAut ) +
C ' to object ' +
C %TrimR( PxObjNam ) +
C '.'
C )
**
C Else
C CallP SndCmpMsg( 'User profile ' +
C %TrimR( PxUsrPrf ) +
C ' did not have ' +
C 'private authority ' +
C %TrimR( PxAut ) +
C ' to object ' +
C %TrimR( PxObjNam ) +
C '.'
C )
C EndIf
**
**-- Check object authority:
**
C Call 'CBX5032'
C Parm 'QCMD' PxObjNam
C Parm '*LIBL' PxObjLib
C Parm '*PGM' PxObjTyp
C Parm '*PUBLIC' PxUsrPrf
C Parm '*USE' PxAut
C Parm PxRtnCod
**
C If PxRtnCod = '1'
**
C CallP SndCmpMsg( 'User profile ' +
C %TrimR( PxUsrPrf ) +
C ' has object authority ' +
C %TrimR( PxAut ) +
C ' to object ' +
C %TrimR( PxObjNam ) +
C '.'
C )
**
C Else
C CallP SndCmpMsg( 'User profile ' +
C %TrimR( PxUsrPrf ) +
C ' did not have ' +
C 'object authority ' +
C %TrimR( PxAut ) +
C ' to object ' +
C %TrimR( PxObjNam ) +
C '.'
C )
C EndIf
**
C Eval *InLr = *On
C Return
**
**-- Send completion message: ------------------------------------------**
P SndCmpMsg B
D Pi 10i 0
D PxMsgDta 512a Const Varying
**
D MsgKey s 4a
**
C CallP(e) SndPgmMsg( 'CPF9897'
C : 'QCPFMSG *LIBL'
C : PxMsgDta
C : %Len( PxMsgDta )
C : '*COMP'
C : '*PGMBDY'
C : 1
C : MsgKey
C : *Zero
C )
**
C If %Error
C Return -1
**
C Else
C Return 0
C EndIf
**
P SndCmpMsg E
訂閱:
文章 (Atom)