IObjectSecurity Method: IsAccessAllowed

IsAccessAllowed
(
 Trustee As String,
 AccessPermissions As String
) As Variant_Boolean;

Parameters

[in] String Trustee
User or group name for whom permissions are to be checked

[in] String AccessPermissions
The access permissions to be checked. See Access Permissions for a complete list of access permissions for a securable object.

Description
Checks if the specified user or group has the specified access permissions. The function also checks for indirect access. This includes access to the Trustee's global groups (of the current PDC) and local groups (of the user specified computer).

Return Value
Returns TRUE if the trustee has the access specified in the AccessPermissions parameter; otherwise, it returns FALSE.

Example

Dim ObjSec  As IObjectSecurity
Set ObjSec = CreateObject("DirectScript.ObjectSecurity")
'Attach to the file c:\test.txt
ObjSec.AttachFile "c:\test.txt"
'Check if W (Write) permission is allowed for the "TrusteeName"
Debug.Print ObjSec.IsAccessAllowed("TrusteeName", "W")

 

See Also