Home

Create Users PHP -> Alfresco

You are here

8 posts / 0 new
Last post
Create Users PHP -> Alfresco

Hi,
Anybody know how to create users by PHP webservice? Can I write my own webserice client and server end for this?

Thank
CW

Re: Create Users PHP -> Alfresco

My ideas is, it is easy to use exiting Alfresco service for server-end. And also you can use "ifresco-phplib" for client side php coding works.

You can download
http://forge.alfresco.com/projects/ifresco-phplib/

And you can have more ideas from;
[url]http://forums.alfresco.com/en/viewtopic.php?f=21&t=38685[/url]

Re: Create Users PHP -> Alfresco

Try to take ideas from with this forum;

http://forums.alfresco.com/en/viewtopic.php?f=21&t=38685

Re: Create Users PHP -> Alfresco

Thanks samudaya,

There is an another error;
Fatal error: Uncaught SoapFault exception: [Client] Function ("newUsers") is not a valid method for this service

Thank you very much

Re: Create Users PHP -> Alfresco

Hi,

Try to take ideas from with this forum;
http://forums.alfresco.com/en/viewtopic.php?f=21&t=38685

ifresco-phplib -> Alfresco/Service/Administration.php

   public function createUser($userDetails) {
$result = $this->administrationService->newUsers(array(
"newUsers" => $userDetails));
$resultSet = $result->result;
return $this->resultSetToUserDetails($this->_session,$this->_store,$resultSet);
}

Correct Code

   public function createUser($userDetails) {
$result = $this->administrationService->createUsers(array(
"newUsers" => $userDetails));
$resultSet = $result->result;
return $this->resultSetToUserDetails($this->_session,$this->_store,$resultSet);
}

Re: Create Users PHP -> Alfresco

This is the perfectly working code for me.....

$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@EMAIL.COM";
 
$userDetails = array("userName"=>"USERNAME",
"password"=>"PASSWORD",
"properties"=>$NamedValues->__toArray());
 
print_r($administration->createUser($userDetails));

Re: Create Users PHP -> Alfresco

Thanks samu,

Finally I solved the problem.

Thanks
CW

Re: Create Users PHP -> Alfresco

Glad to see that the library works fine for most of you ;D and iam not the only one in php library who helps others :D

ill fix the problem next week =)

hope the php area will grow on alfresco :D

ifresco client | PHP5 Client for Alfresco - http://www.ifresco.at
ifresco twitter: | http://twitter.com/ifresco
ifresco PHP Library| http://code.google.com/p/ifresco-php-library/

mailto:ddanninger(at)may.co.at | http://www.may.co.at