Users

Add user

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);
$identity = $openstack->identityV3();

$user = $identity->createUser([
    'defaultProjectId' => '{defaultProjectId}',
    'description'      => '{description}',
    'domainId'         => '{domainId}',
    'email'            => '{email}',
    'enabled'          => true,
    'name'             => '{name}',
    'password'         => '{userPass}'
]);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

List users

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

foreach ($identity->listUsers() as $user) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Show user details

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

$user = $identity->getUser('{id}');
$user->retrieve();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Update user

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

$user = $identity->getUser('{id}');

$user->description = '{description}';
$user->name = '{name}';

$user->update();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Delete user

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

$user = $identity->getUser('{id}');
$user->delete();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

List groups for user

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

$user = $identity->getUser('{id}');

foreach ($user->listGroups() as $group) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

List projects for user

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3();

$user = $identity->getUser('{id}');

foreach ($user->listProjects() as $project) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.