0.9b (c) 1995 Peter Childs
The function verifies that a userid has the proper access permission for a particular resource.
A successful call to this function can be issued only from an OS/2 application to the local computer. If you are using a redirected drive as parameter, the return code of the function will be 2222.
Syntax
MyRc = NetMisc(NETACCESSCHECK, 'aclInfo', UserId, Resource)
Parameters
The parameters required and returned are:
'aclInfo' The access control profile information variable, which is divided into:
o aclInfo.access
The access rights to query. The access control flags are as defined follows:
- N None
- A Attribute
- R Read
- W Write
- C Create
- X Execute
- D Delete
- P Permissions
- G This is a Group permission
o aclInfo.return
The returned value from the function call. If the value is 0, the access is granted as specified, otherwise the access will not be granted (return = 5, Access Denied)
UserId The user account name
Resource The resource specification
Example
/* Check access to a resource for a userid */ call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs' call LoadLsRxutFuncs NETACCESSCHECK = 420 Resource = 'C:\IBMLAN\DCDB' UserId = 'TEST1' aclInfo.access = 'RWC' /* Not 0 in return */ /* aclInfo.access = 'R' Should return 0 */ myRc = NetMisc(NETACCESSCHECK, 'aclInfo', UserId, Resource) if myRc <> '0' then do say 'Got error from NetMisc() ' myRc exitRc = 9 end else do say 'User access checked successfully' say '0 ok, otherwise bad. Access is' aclInfo.return end call DropLsRxutFuncs call RxFuncDrop 'LoadLsRxutFuncs' exit exitRc
Example Output
User access checked successfully 0 ok, otherwise bad. Access is 0
Inf-HTML End Run - Successful