Share via


UserHasPermissions Method in Class SMS_SecuredObject

The UserHasPermissions WMI class method returns TRUE if the current user has all the requested rights to the given object.

The following syntax is simplified from MOF code and is intended to show you the definition of the method.

boolean UserHasPermissions(
  [in] SMS_BaseClass ref ObjectPath,
  [in] uint32 Permissions
);

Parameters

  • ObjectPath
    Data type: string
    Qualifiers: In

    Object being checked for access permissions. Can be a class name or instance path.

  • Permissions
    Data type: uint32
    Qualifiers: In

    Permissions to be tested for a particular object. Bit fields:
    READ (0)
    MODIFY (1)
    DELETE (2)
    DISTRIBUTE (3)
    CREATE_CHILD (4)
    REMOTE_CONTROL (5)
    ADVERTISE (6)
    MODIFY_RESOURCE (7)
    ADMINISTER (8)
    DELETE_RESOURCE (9)
    CREATE (10)
    VIEW_COLL_FILE (11)
    READ_RESOURCE (12)

Return Values

The UserHasPermissions method returns a Boolean that is TRUE, if the user has permissions.

Example Code

The following example shows you how to call the UserHasPermissions method to verify that the user has permissions to modify the given package.

Dim Security As SWbemObject
Dim HasPermissions As SWbemObject

Set Security = GetObject("winmgmts:root\sms\site_<sitecode>:SMS_SecuredObject")
HasPermission = Security.UserHasPermissions("SMS_Package.PackageID=""<packageid>""", 2)

See Also

Security Class Reference Classes, SMS_SecuredObject