0% found this document useful (0 votes)
54 views1 page

Create Users by Using Remote PHP-Client

This document shows how to create users remotely using PHP and an Alfresco API. It authenticates an admin user, creates a session, and then uses the Administration service to create a new user by passing in a user details array with the username, password, and user properties like first name, last name, and email address. On success, it prints the result of creating the new user.

Uploaded by

samudayan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views1 page

Create Users by Using Remote PHP-Client

This document shows how to create users remotely using PHP and an Alfresco API. It authenticates an admin user, creates a session, and then uses the Administration service to create a new user by passing in a user details array with the username, password, and user properties like first name, last name, and email address. On success, it prints the result of creating the new user.

Uploaded by

samudayan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Create Users By Using Remote PHP-Apache System 

$repositoryUrl = "http://test.com:8080/alfresco/api";
$userName = "admin";
$password = "password";

// Include the required Alfresco PHP API objects


require_once "Alfresco/Service/Repository.php";
require_once "Alfresco/Service/Session.php";
require_once "Alfresco/Service/SpacesStore.php";
require_once "Alfresco/Service/UserDetail.php";
require_once "Alfresco/Service/Administration.php";
require_once "Alfresco/Service/NamedValues.php";

// Authenticate the user and create a session


$repository = new Repository($repositoryUrl);
$ticket = $repository->authenticate($userName, $password);
$session = $repository->createSession($ticket);
$spacesStore = new SpacesStore($session);

$administration = new Administration($repository,$spacesStore,$session);

$NamedValues = new NamedValues($session);


$NamedValues->cm_firstName = "FIRSTNAME";
$NamedValues->cm_lastName = "LASTNAME";
$NamedValues->cm_email = "[email protected]";

$userDetails = array("userName"=>"USERNAME",
"password"=>"PASSWORD",
"properties"=>$NamedValues->__toArray());

print_r($administration->createUser($userDetails));

You might also like