HasUserPrivilege

Description

This service checks for a specified privilege by name.

Arguments

Argument Type Description
auth (optional) Auth The Auth type supplies credentials and optionally, a host name for licensing. The userId and password can be specified with HTTP BASIC or WS-SECURITY instead.
privilegeName (required) string name of the privilege (for example, "TS_USRSYSPRIV_APIACCESS")
objectId (optional) string The ID of the object to check privileges against.
user UserIdentifier The user to check privileges against.
options Options Holds name value pairing for future arguments.

Response

A boolean is returned, showing whether the user has the privilege (true) or not (false). The privilege is checked in the context of either the calling user or the specified user. For example:

<ae:HasUserPrivilegeResponse>
   <ae:return>true</ae:return>
</ae:HasUserPrivilegeResponse>

Usage

You can call GetUserPrivileges for the administrator account or for a user account (assuming it has all privileges) to return the name of every privilege. You can then use these privilege names in the HasUserPrivilege call to determine if other users have the same privilege.

The objectId argument is used to limit the privilege check to a certain database object. For example, if want to query a table privilege, you specify the table ID of the table. If want to query a project privilege, you specify the project ID. To check for system privileges, send an empty objectID argument. If the object ID is not composed of all numeric digits, the ID is interpreted as the UUID for the object.

Faults

XML

The following XML is a snippet of the payload this is sent with HasUserPrivilege.

<urn:HasUserPrivilege>
    <urn:auth>
        <urn:userId>admin</urn:userId>
        <urn:password></urn:password>
        <urn:hostname>localhost</urn:hostname>
    </urn:auth>
    <urn:privilegeName>TS_ADMCONPRIV_DEPLOY_APPLICATION</urn:privilegeName>
    <urn:objectId></urn:objectId>
    <urn:user>
        <urn:displayName>Joe</urn:displayName>
        <urn:id></urn:id>
        <urn:uuid></urn:uuid>
        <urn:loginId></urn:loginId>
    </urn:user>
</urn:HasUserPrivilege>