Archive for February, 2010

Alfresco Multi-tenancy: Exporting and Importing Tenants

February 27, 2010 2 comments

This post is the continuation of my previous post Alfresco Multi-tenancy Feature. If you haven’t read it, you can read it here. This post will provide easy steps on exporting and importing tenants in Alfresco Enterprise 3.0.

Exporting a tenant in Alfresco is one of the ways to back-up a tenant. The export will produce one or more .acp (Alfresco Content Package) files. It is like a zip file that contains xml files that describes the exported folders or contents. it also contains meta data of documents and folders. On the other hand, importing a tenant is the reverse of export wherein the information held in the .acp file is copied to the repository.

Exporting a tenant is normally like a complete repository export, which can be performed in previous Alfresco versions. Below are the steps to export a tenant:

1. Start Alfresco. Log-in as super admin.(Only the super admin can perform the tenant export)

2. Go to the tenant admin console.

3. In the text field, enter the command:

export <tenant domain> <destination directory>

Ex. export tenanta C:\exported_tenants

4. Go to the location where you specified the tenant to b0 exported and check if you six .acp files below:

  • <tenant domain>_users.acp
  • <tenant domain>_spaces.acp
  • <tenant domain>_spaces_archive.acp
  • <tenant domain>_model.acp
  • <tenant domain>_versions2.acp

Now you have successfully exported your tenant. The next step is to import the tenant. Reminder, importing should be done on the same version of Alfresco where you performed the export, otherwise you will encounter some errors. Below are the steps:

1. In a multi-tenant enabled Alfresco, log in as super admin.

2. Open the tenant admin console.

3. In the text field, enter command:

import <tenant domain> <source directory> <root contentstore directory>

Ex: import tenanta C:\exported_tenants C:\Alfresco\alf_data\tenantstore\a

NOTE: During this process, I have encountered errors regarding the version2Store does not exist. This is because I have versioned files in the version history(Allow versioning functionality in Alfresco is turned on). I guess this is a bug or an issue that is needed to be resolve.

If all goes well and you haven’t encountered errors, you can check the imported tenants, log in as tenant admin. Congatulations, you have now successfully imported the tenant! =)

For more information about Alfresco Multi-tenancy, visit the wiki page.

Categories: Alfresco Features

Alfresco Multi-Tenancy Feature

February 27, 2010 1 comment

This post will provide information about the Multi-tenancy functionality of Alfresco Enterprise 3.0. I have decided to make this article because currently, I have been researching for this feature for a project requirement. I decided to divide this in several parts like enabling, creating, exporting and importing a tenant. Now, let’s get started!

The Multi-Tenancy Feature enables Alfresco to run in a single-instance (meaning using only one Alfresco WAR, DB and same port) multi-tenant environment. So how is it enabled, below are the steps:

1. If it is your first time to run Alfresco(clean DB and alf_data), I suggest you run it first. (Because for some reason, I can not access the tenant admin console if I enable it here).

2. Stop Alfresco.

3. Locate the three files below located at tomcat/shared/classes/alfresco/extension/mt directory :

  • mt-context.xml.sample
  • mt-admin-context.xml.sample
  • mt-contentstore-context.xml.sample

4. Rename the files:

  • mt-context.xml.sample -> mt-context.xml
  • mt-admin-context.xml.sample ->mt-admin-context.xml
  • mt-contentstore-context.xml.sample -> mt-contentstore-context.xml

5. Restart Alfresco.

6. Open tenant admin console (http://localhost:8080/alfresco/faces/jsp/admin/tenantadmin-console.jsp). If you are able to access this page, multi-tenancy is enabled.

Now that multi-tenancy is enabled, you are now ready to create your first tenant. Below are the steps:

1. Log in as super admin

2. Open tenant admin console

3.  Enter command to create tenant:

create <tenant domain> <tenant admin password> <root contentstore dir>

Ex: create tenanta admina C:\Alfresco\alf_data\tenantstore\a

The above command will create a tenant tenanta with an administrator password admina

4. When creation is successful, you can login as tenant by accessing the login page of Alfresco and typing:

Username : admin@tenanta

Password:   admin

You can now create spaces, content and users inside your tenant. Enjoy!=)

Alfresco: Adding Permissions through Webcripts

February 5, 2010 9 comments

This is my first blog and my first post about Alfresco. Haha, dont know where to start. But anyway, I choose the title “Alfresco: Adding Permissions through Webcripts” because I’ve recently figured out that you can assign permissions for a user to a space/folder or node in Alfresco using web scripts. Well, this is because I am currently involved in a project requiring this functionality and it took me a while to figure it out. In this post, I will share how I was able to do it using java-backed web scripts in Alfresco. I’ll also be including some links to Alfresco forum for guides and for understanding. If you are reading this, I assume that you are a beginner like me or an expert (probably an Alfresco expert). But, for those who are beginners, this post might help you (I hope :)).

First, the question is: What are permissions in Alfresco? Permissions define what actions a user can and can not do in a space or folder inside Alfresco. It defines whether you ca ADD contents, DELETE contents, ADD CHILDREN, CHECK-IN or CHECK-OUT a file, etc So if you want to restrict a user to just viewing contents, you may do so by setting permissions. Now, Alfresco by default has out-of-the-box way of setting permissions through ROLES.

Now, what are ROLES in Alfresco? Roles are permission group in Alfresco. For example, the lowest Role in Alfresco is the Consumer Role which can only have the reading permissions of folders,spaces and children nodes. By default, Alfresco has 5 Roles (from

Coordinator: This role has all privileges including the possibility of taking ownership of nodes, and changing its owner.

Collaborator: This role has the same capabilities as Contributor and Editor.

Contributor: Adds to consumer privileges the possibility of adding children and execute CheckOuts in nodes with aspect lockable.

Editor: Adds to consumer privileges the ability to write nodes (properties, content, and children) and execute CheckOuts in nodes with aspect lockable.

Consumer: Allows read properties, content, and children of a node.

For complete User Role and Permissions Guide, see this link:

Now, let us get on track. The following procedures is how to come up for setting permissions for a node. For this example, I’ve used a java-backed web script since there is already a pattern that has been set for this in our project. But you can also use just web scripts.

1. First, search for a space or node that you want to apply permissions using lucene query.

2. If the node has been found, set the permissions, from my code:

PermissionService permissionService;

//Get all the AccessPermissions that are set for anyone for the given node


//Output the permissions to console


permissionService.setPermission(NodeRef nodeRef, Authority auth, PermissionService.<type of permission>, boolean allow);

//nodeRef – the node reference of the space or content

//auth – Authority can be a username of the user or group name (if using //group, add a prefix “GROUP_” ex. “GROUP_”+grouName)

//type of permission – can be ALL_PERMISSIONS, ADD_CHILDREN, etc.

//allow – true/false, usually set to true

Now you have set a permission to a node, you can also clear or delete a permission of the node by using the following methods:

clearPermission(NodeRef nodeRef,java.lang.String authority)

The method above will delete all permission assigned to the specific authority while the method below will delete a specific permission for an auhority

deletePermission(NodeRef nodeRef, java.lang.String authority, java.lang.String permission)

Now, that should do it. I hope it helps in some way. For complete information about Permission Service API, you can visit this link. Til next time… 🙂

Get all the AccessPermissions that are set for anyone for the given node