« Back to Product

Documentation

IPS_GetUser

 array IPS_GetUser (string $User) 

Parameters

User

Name of the user (case-sensitive)

Returns

The following information is available as key => value pairs:

Index Type Description
UserName string Name of the user
UserType integer Type of the user (0 (USER_TYPE_LOCAL): Local account, 1 (USER_TYPE_LDAP): LDAP)
FirstName string First name
LastName string Last name
EMail string E-mail address
BindDN string BindDN for logging in at the LDAP server (only relevant for LDAP users)
IsActive boolean TRUE if the user is active and can log in
Roles array Names of the directly assigned roles
Permissions array Directly assigned permissions, see Permissions

Permissions

Index Type Description
ObjectID integer ID of the object the permission applies to
Operation string Name of the operation, e.g. VISUALIZATION
Recursive boolean TRUE if the permission also applies to all objects below the object

Description

The function returns an array with information about the user User. The password is not returned; it is only stored as a hash. Roles and Permissions only contain the entries assigned directly to the user; permissions resulting from roles can be read with IPS_GetRole or checked with IPS_UserHasPermission.

For the @admin user the function returns the first name "Default" and the last name "Administrator" without roles and permissions, as this user has all permissions anyway.

If the user does not exist, the function fails with "User with name '…' does not exist". The function requires neither the RBAC feature in the license nor administrator permissions.

See also: IPS_GetUserList, IPS_UserExists

Example

print_r(IPS_GetUser('anna'));

/* e.g. returns:
Array
(
    [BindDN] => 
    [EMail] => anna@example.com
    [FirstName] => Anna
    [IsActive] => 1
    [LastName] => Muster
    [Permissions] => Array
        (
            [0] => Array
                (
                    [ObjectID] => 12345
                    [Operation] => VISUALIZATION
                    [Recursive] => 
                )

        )

    [Roles] => Array
        (
            [0] => visu
        )

    [UserName] => anna
    [UserType] => 0
)
*/
Any questions?