ayoub idelhoussain ayoub idelhoussain - 1 year ago 91
PHP Question

using alfresco to copy directory under php

I have a model folder

in a directory A in
and whenever a new user is created , I have to create a folder for him with the same folder structure as the model folder , I found through rest api, that I can do that with this :

{"alf_destination": "workspace://SpacesStore/35818681-274f-4d61-8fe7-5cff238513e5",
"prop_cm_name": "0000",
"prop_cm_title": "",
"prop_cm_description": "",
"sourceNodeRef": "workspace://SpacesStore/aeeaca0a-89bf-4294-8506-315ecd7d18f2",
"parentNodeRef": "workspace://SpacesStore/35818681-274f-4d61-8fe7-5cff238513e5"

but how can I get the that spacestore
in php ?

and I have created the dest folder via
because I didn't understand how to do it with alfresco (I didn't know what a {container} and site's name is )
here is the path to the model :
/Alfresco/Dictionnaire de données/Modèles d'espace/0000

and here where the new folders will be created :

pardon my english and Thank you

Answer Source

There is the userHomesHomeFolderProvider that allows you inject Home Folder Template. You can find its definition inside this library: tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-{ver}.jar/alfresco/authentication-services-context.xml:

<bean name="userHomesHomeFolderProvider" parent="usernameHomeFolderProvider">
    <property name="rootPath">       
    <property name="storeUrl">

You can customize this bean as follows:

  1. Create the template folder and its content (files, sub-folders,..), for example: Repository> Data Dictionary> user_homes_templates> custom_home_root

  2. Override the userHomesHomeFolderProvider bean definition and inject the new property templatePath pointing to the template folder. Create the file tomcat/shared/classes/alfresco/extension/user-homes-custom-context.xml with the new bean definition:

    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
        <bean name="userHomesHomeFolderProvider" parent="usernameHomeFolderProvider">
            <property name="rootPath">
            <property name="storeUrl">
            <property name="templatePath">

Now restart Alfresco and create the new user, template content will be copied into the new user home folder (Repository> User Homes> {user-name}).

... and if you really must use PHP try Apache Chemistry CMIS PHP Client or REST API.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download