cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict User Home Spaces?

trelp
Champ on-the-rise
Champ on-the-rise
Hello,

I have Alfresco Community 3.4d integrated with LDAP. When a user is added to LDAP, at the first tomcat restart the user is syncronized in Alfresco and, automatically, added full permissions to his User Home Space.

I can't control the user home spaces of more than 15000 users and the space that means so I need to restrict the access of all users to his/her user home space.

I tried restricting permissions directly to the User Home folder but it doesn't work. Is there a way to restrict it? Using rules, modifying configuration files…?
6 REPLIES 6

jpotts
World-Class Innovator
World-Class Innovator
I'm not clear on what your goal here is. If you want fewer user home spaces to manage, you can change the home folder provider to point all users at a single space instead of creating a new space for each user. See http://wiki.alfresco.com/wiki/Security_and_Authentication#Home_Folder_Provider_Properties

If you want to restrict what users can do in their home space you could make the above change so that you only have one user home space to deal with, then you should be able to change the permissions on that folder as you see fit. You need to test this thoroughly, though, because I don't know all of the ramifications of having a user that cannot create nodes in their user home.

Jeff

trelp
Champ on-the-rise
Champ on-the-rise
Hi Jeff,

Imagine a development project and a team made by 50 people. As the administrator I create a folder for the team and all of them must upload all the files in that folder. If I don't restrict their personal folder they can upload whatever they want in their folders and I can't control the used space or why Alfresco is using too much memory. So, in order to avoid this, I want to restrict by default the personal folders of the more than 15000 users.

I've tried to restrict the rules in the root folder User Homes but the subfolder doesn't inherit parent space permissions so I need something else such a rule or creating a script in the data dictionary but I can't find the way.

jpotts
World-Class Innovator
World-Class Innovator
In that case, I'd follow my suggestion and either use the user homes folder provider to use the companyHomeFolderProvider or I would create a custom user homes folder provider that points to some other folder (or whatever you need).

Then you'll have all users pointing to the same folder, and you can change the permissions on that folder as you see fit.

OR, you could write a custom user homes folder provider that extends the existing userHomesHomeFolderProvider and sets the permissions as you see fit.

Jeff

trelp
Champ on-the-rise
Champ on-the-rise
Hi Jeff,

n that case, I'd follow my suggestion and either use the user homes folder provider to use the companyHomeFolderProvider or I would create a custom user homes folder provider that points to some other folder (or whatever you need).

How can I do that? Excuse me, I'm novice with Alfresco.

jpotts
World-Class Innovator
World-Class Innovator
Trelp,

No problem! Here's how this works. I am basing this off 3.4.d Community. And I am going to assume you already have your Alfresco server configured to authenticate against an LDAP directory.

If you go look in $TOMCAT_HOME/shared/classes/alfresco/extension/subsystems/Authentication/ldap/ldap1 you should see a file called ldap-authentication.properties.

If you open that up and search for defaultHomeFolderProvider you should find something that looks like this:
ldap.synchronization.defaultHomeFolderProvider=userHomesHomeFolderProvider

That tells Alfresco to create a folder in User Homes for each user using their username as the folder name.

There are other folder providers that ship out-of-the-box. One is the companyHomeFolderProvider. To change to a different home folder provider, you can comment out the existing line and add a new line that specifies the new home folder provider, like this:
ldap.synchronization.defaultHomeFolderProvider=companyHomeFolderProvider

Now when you restart Tomcat and LDAP syncs, users will not get a unique folder. Instead, they'll all point to the same thing: the
Company Home folder. Because the special EVERYONE group is set to Consumer on Company Home, you won't have the problem you are worried about regarding having a large number of people each with their own user home folders.

It is important to note that cmSmiley Tongueerson objects (and home folders) do not get set until the user logs in. When users are sync'd from LDAP they get authority entries, which allows them to log in but they do not get person objects. They must log in for that to happen. And that's when their home folder gets created if you have the userHomesHomeFolderProvider set.

That means that making this will not retroactively change any of the users that have already and had their user home folder created for them. If you want to change their home folder, you'll need to run a script (server-side JavaScript is ideal for this) to set the cm:homeFolder property on their cmSmiley Tongueerson object. When using the companyHomeFolderProvider the cm:homeFolder property needs to be set to the node reference of the Company Home folder.

Before making any changes to existing cmSmiley Tongueerson objects you might want to use the Node Browser in Alfresco Explorer (find it in the admin console) to actually see the values for both the cm:homeFolderProvider and the cm:homeFolder properties. You can find them by doing a lucene search, like this:
TYPE:"cm:person"

Or you can navigate to them. The cmSmiley Tongueerson objects live in this path in the workspace://SpacesStore:
/{http://www.alfresco.org/model/system/1.0}system/{http://www.alfresco.org/model/system/1.0}people/

If the out-of-the-box user home folder providers don't meet your needs you can write Java code to create your own user home folder provider. For example, maybe you want to put all employees in the same department in the same home folder. Step-by-step instructions for doing that are too long to include here, but if you go look in $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/authentication-services-context.xml you will see a bean, like this:

<bean name="companyHomeFolderProvider" class="org.alfresco.repo.security.person.ExistingPathBasedHomeFolderProvider" parent="baseHomeFolderProvider">
        <property name="path">
           <value>/${spaces.company_home.childname}</value>
        </property>
        <property name="storeUrl">
           <value>${spaces.store}</value>
        </property>
    </bean>

You could go look at the source of that ExistingPathBasedHomeFolderProvider class as an example for creating your own custom class, then tell Alfresco about it by configuring your own Spring bean in your own context.xml file that points to your custom provider class.

There you go. Hopefully that explains it in enough detail for you to decide if it meets your needs, and if not, gives you some avenues to explore to customize it so it will work for you.

Jeff

cemy
Champ in-the-making
Champ in-the-making
How can I do that in version4.2??
I put the line
ldap.syncronization.defaultHomeFolderProvider=companyHomeFolderProvider in the global properties file,
but still alfresco creating personal home folders for all users!