\triagens\ArangoDbUserHandler

A handler that manages users

. A user-document handler that fetches vertices from the server and persists them on the server. It does so by issuing the appropriate HTTP requests to the server.


Summary

Methods
Properties
Constants
__construct()
addUser()
replaceUser()
updateUser()
get()
removeUser()
No public properties found
No constants found
getConnection()
getConnectionOption()
getCursorOptions()
json_encode_wrapper()
validateAndIncludeOldSingleParameterInParams()
includeOptionsInParams()
includeOptionsInBody()
No protected properties found
N/A
No private methods found
$_connection
N/A

Properties

$_connection

$_connection : 

Connection object

Type

Methods

addUser()

addUser(mixed $username, mixed $passwd, mixed $active, array $extra, array $options) : boolean

save an user to the user-collection

This will save the user to the user-collection

This will throw if the user cannot be saved

Parameters

mixed $username
  • The name of the user as a string. This is mandatory.
mixed $passwd
  • The user password as a string. If no password is specified, the empty string will be used.
mixed $active
  • an optional flag that specifies whether the user is active. If not specified, this will default to true.
array $extra
  • an optional array with arbitrary extra data about the user.
array $options
  • an array of options
                   <p>Options are :<br>
                   </p>

Throws

\triagens\ArangoDb\Exception

Returns

boolean —
  • true, if user could be saved

replaceUser()

replaceUser(mixed $username, mixed $passwd, mixed $active, array $extra, array $options) : boolean

Replace an existing User, identified by its username

This will replace the user-document on the server

This will throw if the document cannot be Replaced

Parameters

mixed $username
  • The name of the user as a string, who's user-data is going to be replaced. This is mandatory.
mixed $passwd
  • The user password as a string. If no password is specified, the empty string will be used.
mixed $active
  • an optional flag that specifies whether the user is active. If not specified, this will default to true.
array $extra
  • an optional array with arbitrary extra data about the user.
array $options
  • an array of options
                   <p>Options are :
                   </p>

Throws

\triagens\ArangoDb\Exception

Returns

boolean —
  • always true, will throw if there is an error

updateUser()

updateUser(mixed $username, mixed $passwd, mixed $active, array $extra, array $options) : boolean

Update an existing user, identified by the username

This will update the user-document on the server

This will throw if the document cannot be updated

Parameters

mixed $username
  • The name of the user as a string, who's user-data is going to be updated. This is mandatory.
mixed $passwd
  • The user password as a string. If no password is specified, the empty string will be used.
mixed $active
  • an optional flag that specifies whether the user is active. If not specified, this will default to true.
array $extra
  • an optional array with arbitrary extra data about the user.
array $options
  • an array of options
                   <p>Options are :
                   </p>

Throws

\triagens\ArangoDb\Exception

Returns

boolean —
  • always true, will throw if there is an error

get()

get(mixed $username) : \triagens\ArangoDb\User

Get a single user-document, identified by the username

This will throw if the document cannot be fetched from the server

Parameters

mixed $username
  • username as a string

Throws

\triagens\ArangoDb\Exception

Returns

\triagens\ArangoDb\User
  • the user-document fetched from the server

removeUser()

removeUser(mixed $username) : boolean

Remove a user, identified by the username

Parameters

mixed $username
  • username as a string, of the user that is to be deleted

Throws

\triagens\ArangoDb\Exception

Returns

boolean —
  • always true, will throw if there is an error

getConnection()

getConnection() : \triagens\ArangoDb\Connection

Return the connection object

Returns

\triagens\ArangoDb\Connection
  • the connection object

getConnectionOption()

getConnectionOption( $optionName) : mixed

Return a connection option This is a convenience function that calls json_encode_wrapper on the connection

Parameters

$optionName
  • The option to return a value for

Returns

mixed —
  • the option's value

getCursorOptions()

getCursorOptions(mixed $options) : array

Return an array of cursor options

Parameters

mixed $options
  • $options might be a boolean sanitize value, or an array of options, with or without a '_sanitize' key.

Returns

array —
  • array of options

json_encode_wrapper()

json_encode_wrapper(array $body) : string

Return a json encoded string for the array passed.

This is a convenience function that calls json_encode_wrapper on the connection

Parameters

array $body
  • The body to encode into json

Returns

string —
  • json string of the body that was passed

validateAndIncludeOldSingleParameterInParams()

validateAndIncludeOldSingleParameterInParams(array $options, array $params, mixed $parameter) : array

Helper function that validates and includes an old single method parameter setting into the parameters array given.

This is only for keeping backwards-compatibility where methods had for example a parameter which was called 'policy' and which was later changed to being an array of options, so more than one options can be passed easily. This is only for options that are to be sent to the ArangoDB server.

Parameters

array $options
  • The options array that may hold the policy to include in the parameters. If it's not an array, then the value is the policy value.
array $params
  • The parameters into which the options will be included.
mixed $parameter
  • the old single parameter key to use.

Returns

array —

$params - array of parameters for use in a url

includeOptionsInParams()

includeOptionsInParams(array $options, array $params, array $includeArray) : array

Helper function that runs through the options given and includes them into the parameters array given.

Only options that are set in $includeArray will be included. This is only for options that are to be sent to the ArangoDB server in form of url parameters (like 'waitForSync', 'keepNull', etc...) .

Parameters

array $options
  • The options array that holds the options to include in the parameters
array $params
  • The parameters into which the options will be included.
array $includeArray
  • The array that defines which options are allowed to be included, and what their default value is. for example: 'waitForSync'=>true

Returns

array —

$params - array of parameters for use in a url

includeOptionsInBody()

includeOptionsInBody(array $options, array $body, array $includeArray) : array

Helper function that runs through the options given and includes them into the parameters array given.

Only options that are set in $includeArray will be included. This is only for options that are to be sent to the ArangoDB server in a json body(like 'limit', 'skip', etc...) .

Parameters

array $options
  • The options array that holds the options to include in the parameters
array $body
  • The array into which the options will be included.
array $includeArray
  • The array that defines which options are allowed to be included, and what their default value is. for example: 'waitForSync'=>true

Returns

array —

$params - array of parameters for use in a url