Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1271399
  • 博文数量: 287
  • 博客积分: 11000
  • 博客等级: 上将
  • 技术积分: 3833
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-16 08:43
文章分类
文章存档

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2010-06-04 16:09:18

Retrieve user authority to object ** ** 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: ** ** ... ** ... 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 **

The calling program **-- 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 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 Else C EndIf ** Thanks to Carsten Flensburg

阅读(708) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~