cancel
Showing results for 
Search instead for 
Did you mean: 

User Home Space based on Template?

mvanbergen
Champ in-the-making
Champ in-the-making
Hello,

We are using the Alfresco LDAP integration with Active Directory.  We are able to authenticate and synchronize users without any problems.  We have also customized where a user's home space is created (under a "Users" space).  Now, we would like to take this one step further and have the user's space be created based on a space template (actually a smart space template).  Is this possible?

Thanks,
Matt
7 REPLIES 7

mvanbergen
Champ in-the-making
Champ in-the-making
Thanks for the quick reply, Andy.

I think the "templatePath" defined as a property in the "personalHomeFolderProvider" bean will serve my purpose. However, I can't seem to get it to work.  Here is what I have done:

1. Created a space template called "Employees" in the Space Templates space. The "Employees" space includes other sub-spaces as well.

2. Altered the authority-services-context.xml file (not really, I modified the copy of the file in the extension folder) to include the following property to be overridden:
       <property name="templatePath">
          <value>/app:space_templates/cm:Employees</value>
       </property>

I login as a new user (we are using active directory synchronization) and I receive the following error:

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
caused by:
javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
caused by:
java.lang.IllegalStateException: Non-unique path: found : /app:space_templates/cm:Employees 0

If I take out the above property in our extension file, and login with the same user it works just fine.

Any thoughts? 

Thanks again,
Matt

andy
Champ on-the-rise
Champ on-the-rise
Hi

The error means you have got the path to the template directory wrong (or it does not exist) or the same for the directory where user homes are to be created.

Regards

Andy

mvanbergen
Champ in-the-making
Champ in-the-making
Hello,

I am not sure what I could be doing wrong.  In the repository.properties file there is a "shortcut" for the space templates (${spaces.templates.childname}) and I know that there is a "Employees" space directly under the spaces template folder (on the same level as the default Software Engineering space template that comes with the default Alfresco Enterprise install).  Therefore, I believe the templatePath property should be:

<property name="templatePath">
            <value>/${spaces.templates.childname}/cm:Employees</value>
</property>

So that I understand what is supposed to happen here, when someone logs in and their home space is created, the Employees space template should be copied under the User's home folder.  At least that is what we need.  Is this a correct use case?

Thanks,
Matt

andy
Champ on-the-rise
Champ on-the-rise
Hi

Does it work using the guest folder as a template?

Is there anything special about your template folder?
Is it a plain folder with files as sub-folders? Does it have permissions? Does it have rules?


Regards

Andy

mvanbergen
Champ in-the-making
Champ in-the-making
Hi Andy,

I tried to make the templatePath point to the guest folder and it still did not work:

<property name="templatePath">
            <value>/app:guest_home</value>
</property>

and I get the following error when attempting to login the first time:

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
caused by:
javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
caused by:
java.lang.IllegalStateException: Non-unique path: found : /app:guest_home 0

Thanks!
Matt

mvanbergen
Champ in-the-making
Champ in-the-making
Hello,

Thanks to Alfresco support, they were able to easily help me with this problem.  I hope this is of use to someone out there in the future…

Here is the what I ended up setting in the personalHomeFolderProvider" bean authority-services-context.xml file (which I put in the extension folder):

<property name="templatePath">     <value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}/cm:Employees</value>
</property>

Basically, the ${…} are variables set in the repository.properties file (like a shortcut).  The cm:Employees part is a space template that contains rules and sub-spaces.  So, when a new user logs into Alfresco using their Active Directory credentials, their user space is setup using this space template.    This is very useful functionality!

Feel free to post up any follow-up questions if anybody else runs into the same question. 

Matt