cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically creates space inside a user space

ktavasalo
Champ on-the-rise
Champ on-the-rise
Hello everyone.. I am a newbie in Alfresco Share.
May you help me solving my problem?
I need to automatically create a space inside a user space. So, it means that once a user signs up, aside from its user space, another space inside the user space will also be automatically created?
Thank you very much.
11 REPLIES 11

ecarbenay
Star Contributor
Star Contributor
You can process this way :
- create a script into Data Dictionary\Scripts to create the required space as a child of the space identified by Document (which is the object that will trigger that script)
- create a rule on the space "User Homes" to be triggered when a new space is created, and that executes the script described previously

See following documentation article for more informations on the usage of rules to automate repetitive tasks : http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/concepts/library-folder-rules.html

Hello.
Thank you very much! I will try that one. Thanks!

wait, correct me if I am wrong, in the script, I have to find first the directory/space name to have the required space, lets say Private Folder, be created. How am I going to get that, considering the name is dynamic.. For example, the user space follows the name  of the user? Sorry if my question is stupid.. I really dont know what to do..

Thank you very much…

ecarbenay
Star Contributor
Star Contributor
In your script, the object "document" references the object that triggered the rule, so document.name for instance gives you the name of the space that triggered the rule.
You just have to create a child folder for "document" in your script :
<javascript>var privateFolder = document.createFolder("Private Folder");</javascript>

Hello.. My script works fine.. It automatically creates Private Folder to each user space. But the permission is not working… I want to make Private Folder a hidden one.. But the other user can see the private folder of another user.

I tried to put a line of code after creating the folder.. Here is the part of the code:

privateFolder = document.createFolder("privateFolder");
privateFolder.setInheritsPermissions(false);

What seems to be the problem?
Thank you very much!!

Hello…
In my script, there are permissions I have included.. But when the process is actually implemented, permission I had specified is not working… Here's my code..


var privateFolder = document.createFolder("My Private Space");
var user = person.properties.userName;
if(privateFolder == null && space.hasPermission("CreateChildren")){
privateFolder = document.createFolder("privateFolder");
privateFolder.setPermission("All",  user);
privateFolder.setInheritsPermissions(false);
}


Please help me.. Thank you very much..

ktavasalo
Champ on-the-rise
Champ on-the-rise
Okay… Got it.. Thank you very much!!

ecarbenay
Star Contributor
Star Contributor
I don't understand your problem.
When a user is created in Alfresco with the standard configuration, a private space is created into the repository under User Homes with the name of the user. For instance, my user home gets the path User Homes/ecarbenay.
When a space is created under User Homes it gets private : each user is able to see its space, but not the other users space.
So without changing permissions, inherited permissions keep the new space private.

Can you explain with more details what you want to realize and the difficulties you meet ?

By private, you mean that you must not see and open the other space? But, whenever I create a user, its user space has a permission of "Consumer" to EVERYONE. So other users can see other spaces. That's why I have to control the permission everytime I create a user.
Is it different from yours?

Now, my problem is that a user gets access to the Private Folder inside the other user's home space. I think, it is because of permission inheritance. But I included in my script that turning off of that property. I think you dont get me because we have different standard configuration? Is it possible? Thank you..