Create Users By Using Remote PHP-Apache System
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2011 02:24 PM
I'm currently running Alfresco Community 3.4.d on Ubuntu 10.04 server. I want to create user accounts by using PHP module which runs on Apache web server (this should be separate physical server) . Anyone have achieved this so far? Could you please post the codes, configurations and relevant library files.
This is a grate help for me……
Thanks
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2011 08:32 PM
download my library -> http://forge.alfresco.com/projects/ifresco-phplib/
i implemented some functions of the AdministrationService -> which can be found in Administration.php
there you find the method "createUser" …. also there is an UserDetails.php
So what you should do create a object by using the UserDetails then you should add the parameters to the UserDetails object like $object->cm_name and so on and then send it to the method of createUser in Administration.php
Thats not really nice implemented right now in the next versions of my ifresco phplibrary ill implement that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2011 06:55 AM
Thank you very much for your help and contributions to open source.
I'm new to "ifresco". So it is great help if you could post a sample php code for create user by using "ifresco php library".
Thank you very much……..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 02:20 PM
$repositoryUrl = "http://myurl.com/alfresco/api";
$userName = "admin";
$password = "adminpassword";
// 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";
// Authenticate the user and create a session
$repository = new Repository($repositoryUrl);
$ticket = $repository->authenticate($userName, $password);
$session = $repository->createSession($ticket);
$store = new SpacesStore($session);
$new_admin_object = new Administration($repository, $store, $session);
$my_user_details = $new_admin_object->getUser("admin");
//This is perfectly work…………
/*
//This is not working
$new_user_object = new UserDetail($session, $store, "userName=>newusername, password=>newpassword", $node=null, $id=null);
$new_admin_object2 = new Administration($repository, $store, $session);
$my_user_details = $new_admin_object2->createUser($new_user_object);
*/
?>
There is no "newUsers" in WSDL. I've changed it to "createUsers". But there are another errors.
Help me to solve this problem. Could you please post a sample code for create user.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 02:35 PM

$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));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2011 12:45 PM
I installed ifresco library 0.2 and tested your code but I have this error :
Fatal error: Uncaught SoapFault exception: [Client] Function ("createUser") is not a valid method for this service in /home/vtiger510/www/alfresco_php/Alfresco/Service/WebService/AlfrescoWebService.php:65 Stack trace: #0 /home/vtiger510/www/alfresco_php/Alfresco/Service/WebService/AlfrescoWebService.php(65): SoapClient->__soapCall('createUser', Array, Array, Array, Array) #1 /home/vtiger510/www/alfresco_php/Alfresco/Service/WebService/AlfrescoWebService.php(47): AlfrescoWebService->__soapCall('createUser', Array) #2 [internal function]: AlfrescoWebService->__call('createUser', Array) #3 /home/vtiger510/www/alfresco_php/Alfresco/Service/Administration.php(76): AlfrescoWebService->createUser(Array) #4 /home/vtiger510/www/alfresco_php/examples/import_users/index.php(82): Administration->createUser(Array) #5 {main} thrown in /home/vtiger510/www/alfresco_php/Alfresco/Service/WebService/AlfrescoWebService.php on line 65
(The sample
SimpleBrowsein the ifresco examples works like a charm).
Do you know where I can investigate ?
Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2011 04:38 AM
the functions queryUsers and getUser works, but createUser don't… any ideas ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2011 05:25 AM
in the ifresco client library 0.2 there is still this bug which samudaya reported:
So the fix is:
modify the Administration.php and go to line 75 + 76:
which is:
$result = $this->administrationService->newUsers(array( "createUsers" => $userDetails));
modify it to:
$result = $this->administrationService->createUsers(array( "newUsers" => $userDetails));
Not tested. please tell me if it worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2011 05:41 AM
Thank you for your help, it works !
There's another small bug in Alfresco/Service/Repository.php line 45 that I corrected :
Line 45 :
public function __construct($connectionUrl="http://localhost:8080/alfresco/api")
should be replaced by the url in config.php
and line 50
$this->_port = $parts["port"];
did not work with my url (https://www.url.net/alfresco/api). I hardcoded
$this->_port = 443;
By the way thanks for your work.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2011 05:51 AM
