cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get the user home path?

camillo
Champ in-the-making
Champ in-the-making
Hi all,

I'm a very newbie about the development as reguard as application Alfresco-based.
In particular, in this period, i must develop (using J2ee) a web client for Alfresco.
Because each Alfresco user has an home space, how can i get the path of a specific user home?
Can you advice me classes and methods I must use for my purpose?
Thank you so much in advance

Camillo
3 REPLIES 3

zomurn
Champ in-the-making
Champ in-the-making
String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId();
         NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId);


quoted from public void processToolbarLocation(String location, boolean navigate) in NavigationBean.java

derek
Star Contributor
Star Contributor
Hi,


NodeRef personNodeRef = personService.getPerson(userName);
NodeRef homespaceNodeRef = (NodeRef) nodeService.getProperty(personNodeRef, ContentModel.PROP_HOMEFOLDER);  // Might be null
You can use the Node Browser in the admin section of the UI to see what properties are on the nodes.

Regards

veronika_zenz
Champ in-the-making
Champ in-the-making
Just stumbled over the same problem, so thanks to derek for the answer!
btw, to geth the currently logged in user, use

String userName = serviceRegistry.getAuthenticationService().getCurrentUserName();

Before finding this thread i had tried, the following line from a java backed webscript.

repository.getUserHome(personNodeRef)
But this throws an exception. any idea when its safe to use repository.getUserHome?

Caused by: org.alfresco.error.AlfrescoRuntimeException: 11040002 Transaction must be active and synchronization is required:

at $Proxy11.getProperty(Unknown Source)
at org.alfresco.repo.model.Repository.getUserHome(Repository.java:288)