PreviousNext
Help > API Functions > Connection > i5_adopt_authority
i5_adopt_authority

 

Changes authority of the connection to a specific user. All actions will be executed as this user from now on.

 

 

 bool i5_adopt_authority (string username, string password, [resource connection])

 

 

Parameters

 

username

Name of the user to change to

 

password

 

Password for the user

 

connection

Connection resource - result from i5_connect

 

 

Return

True if OK, false if failed.

 

Error returned

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_HDLCONN

257

This resource has no connection active.

I5_ERR_PHP_RESOURCE_BAD

261

No resource found.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y.

Type z was provided.

I5_ERR_PHP_NBPARAM_BAD

263

Wrong parameter count

 

 

Details

I5_adopt_authority function adds the authority of a new user to the EASYCOM job associated to the connection.

See IBM documentation for more information on security and authority's management.

 

Example

 

$conn = i5_connect("AS_NAME", "PHP", "PASSWORD");

 

if ($conn)

{

$res = i5_adopt_authority("QPGMR","PASSWORD", $conn);

if (!$res)

                trigger_error("i5_adopt_authority error : ".i5_errormsg(), E_USER_ERROR);

}

else

{

trigger_error("i5_connect error :".i5_errormsg(), E_USER_ERROR);

}

 

 

See also

 

i5_connect