23 min read

In this article by Piotr Filipowicz and Katarzyna Ziółkowska, authors of the book Liferay 6.x Portal Enterprise Intranets Cookbook, we will cover the basic functionalities that will allow us to manage the structure and users of the intranet. In this article, we will cover the following topics:

  • Managing an organization structure
  • Creating a new user group
  • Adding a new user
  • Assigning users to organizations
  • Assigning users to user groups
  • Exporting users

(For more resources related to this topic, see here.)

The first step in creating an intranet, beyond answering the question of who the users will be, is to determine its structure. The structure of the intranet is often a derivative of the organizational structure of the company or institution. Liferay Portal CMS provides several tools that allow mapping of a company’s structure in the system. The hierarchy is built by organizations that match functional or localization departments of the company. Each organization represents one department or localization and assembles users who represent employees of these departments. However, sometimes, there are other groups of employees in the company. These groups exist beyond the company’s organizational structure, and can be reflected in the system by the User Groups functionality.

Managing an organization structure

Building an organizational structure in Liferay resembles the process of managing folders on a computer drive. An organization may have its suborganizations and—except the first level organization—at the same time, it can be a suborganization of another one. This folder-similar mechanism allows you to create a tree structure of organizations.

Let’s imagine that we are obliged to create an intranet for a software development company. The company’s headquarter is located in London. There are also two other offices in Liverpool and Glasgow. The company is divided into finance, marketing, sales, IT, human resources, and legal departments. Employees from Glasgow and Liverpool belong to the IT department.

How to do it…

In order to create a structure described previously, these are the steps:

  1. Log in as an administrator and go to Admin | Control Panel | Users | Users and Organizations.
  2. Click on the Add button.
  3. Choose the type of organization you want to create (in our example, it will be a regular organization called software development company, but it is also possible to choose a location).

  4. Provide a name for the top-level organization.
  5. Choose the parent organization (if a top-level organization is created, this must be skipped).
  6. Click on the Save button:

  7. Click on the Change button and upload a file, with a graphic representation of your company (for example, logo).
  8. Use the right column menu to navigate to data sections you want to fill in with the information.
  9. Click on the Save button.
  10. Go back to the Users and Organizations list by clicking on the back icon (the left-arrow icon next to the Edit Software Development Company header).
  11. Click on the Actions button, located near the name of the newly created organization.
  12. Choose the Add Regular Organization option.
  13. Provide a name for the organization (in our example, it is IT).
  14. Click on the Save button.
  15. Go back to the Users and Organizations list by clicking on the back icon (left-arrow icon next to Edit IT header).
  16. Click on the Actions button, located near the name of the newly created organization (in our case, it is IT).
  17. Choose the Add Location option.
  18. Provide a name for the organization (for instance, IT Liverpool).
  19. Provide a country.
  20. Provide a region (if available).
  21. Click on the Save button.

How it works…

Let’s take a look at what we did throughout the previous recipe. In steps 1 through 6, we created a new top-level organization called software development company. With steps 7 through 9, we defined a set of attributes of the newly created organization. Starting from step 11, we created suborganizations: standard organization (IT) and its location (IT Liverpool).

Creating an organization

There are two types of organizations: regular organizations and locations. The regular organization provides the possibility to create a multilevel structure, each unit of which can have parent organizations and suborganizations (there is one exception: the top-level organization cannot have any parent organizations). The localization is a special kind of organization that allows us to provide some additional data, such as country and region. However, it does not enable us to create suborganizations. When creating the tree of organizations, it is possible to combine regular organizations and locations, where, for instance, the top-level organization will be the regular organization and, both locations and regular organizations will be used as child organizations.

When creating a new organization, it is very important to choose the organization type wisely, because it is the only organization parameter, which cannot be modified further.

As was described previously, organizations can be arranged in a tree structure. The position of the organization in a tree is determined by the parent organization parameter, which is set by creating a new organization or by editing an existing one. If the parent organization is not set, a top-level organization is always created.

There are two ways of creating a suborganization. It is possible to add a new organization by using the Add button and choosing a parent organization manually. The other way is to go to a specific organization’s action menu and choose the Add Regular Organization action. While creating a new organization using this option, the parent organization parameter will be set automatically.

Setting attributes

Similarly, just like its counterpart in reality, every organization in Liferay has a set of attributes that are grouped and can be modified through the organization profile form. This form is available after clicking on the Edit button from the organization’s action list (see the There’s more… section). All the available attributes are divided into the following groups:

  • The ORGANIZATION INFORMATION group, which contains the following sections:
    • The Details section, which allows us to change the organization name, parent organization, country, or region (available for locations only). The name of the organization is the only required organization parameter. It is used by the search mechanism to search for organizations. It is also a part of an URL address of the organization’s sites.
    • The Organization Sites section, which allows us to enable the private and public pages of the organization’s website.
    • The Categorization section, which provides tags and categories. They can be assigned to an organization.
  • IDENTIFICATION, which groups the Addresses, Phone Numbers, Additional Email Addresses, Websites, and Services sections.
  • MISCELLANEOUS, which consists of:
    • The Comments section, which allows us to manage an organization’s comments
    • The Reminder Queries section, in which reminder queries for different languages can be set
    • The Custom Fields section, which provides a tool to manage values of custom attributes defined for the organization

Customizing an organization functionalities

Liferay provides the possibility to customize an organization’s functionality. In the portal.properties file located in the portal-impl/src folder, there is a section called Organizations. All these settings can be overridden in the portal-ext.properties file. We mentioned that top-level organization cannot have any parent organizations. If we look deeper into portal settings, we can dig out the following properties:

organizations.rootable[regular-Organization]=true
organizations.rootable[location]=false

These properties determine which type of organization can be created as a root organization.

In many cases, users want to add a new organization’s type. To achieve this goal, it is necessary to set a few properties that describe a new type:

organizations.types=regular-Organization,location,my-Organization
organizations.rootable[my-organization]=false
organizations.children.types[my-organization]=location
organizations.country.enabled[my-organization]=false
organizations.country.required[my-organization]=false

The first property defines a list of available types. The second one denies the possibility to create an organization as a root. The next one specifies a list of types that we can create as children. In our case, this is only the location type. The last two properties turn off the country list in the creation process. This option is useful when the location is not important.

Another interesting feature is the ability to customize an organization’s profile form. It is possible to indicate which sections are available on the creation form and which are available on the modification form. The following properties aggregate this feature:

organizations.form.add.main=details,organization-site
organizations.form.add.identification=
organizations.form.add.miscellaneous=
 
organizations.form.update.main=details,organization-site,categorization
organizations.form.update.identification=addresses,phone-numbers,additional-email-addresses,websites,services
organizations.form.update.miscellaneous=comments,reminder-queries,custom-fields

There’s more…

It is also possible to modify an existing organization and its attributes and to manage its members using actions available in the organization Actions menu.

There are several possible actions that can be performed on an organization:

  • The Edit action allows us to modify the attributes of an organization.
  • The Manage Site action redirects the user to the Site Settings section in Control Panel and allows us to manage the organization’s public and private sites (if the organization site has been already created).
  • The Assign Organization Roles action allows us to set organization roles to members of an organization.
  • The Assign Users action allows us to assign users already existing in the Liferay database to the specific organization.
  • The Add User action allows us to create a new user, who will be automatically assigned to this specific organization.
  • The Add Regular Organization action enables us to create a new child regular organization (the current organization will be automatically set as a parent organization of a new one).
  • The Add Location action enables us to create a new location (the current organization will be automatically set as a parent organization of a new one).
  • The Delete action allows us to remove an organization. While removing an organization, all pages with portlets and content are also removed.

An organization cannot be removed if there are suborganizations or users assigned to it.

In order to edit an organization, assign or add users, create a new suborganization (regular organization or location) or delete an organization. Perform the following steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | Users and Organizations.
  2. Click on the Actions button, located near the name of the organization you want to modify.

  3. Click on the name of the chosen action.

Creating a new user group

Sometimes, in addition to the hierarchy, within the company, there are other groups of people linked by common interests or occupations, such as people working on a specific project, people occupying the same post, and so on. Such groups in Liferay are represented by user groups. This functionality is similar to the LDAP users group where it is possible to set group permissions. One user can be assigned into many user groups.

How to do it…

In order to create a new user group, follow these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | User Groups.
  2. Click on the Add button.
  3. Provide Name (required) and Description of the user group.
  4. Leave the default values in the User Group Site section.

  5. Click on the Save button.

How it works…

The user groups functionality allows us to create a collection of users and provide them with a public and/or private site, which contain a bunch of tools for collaboration. Unlike the organization, the user group cannot be used to produce a multilevel structure. It enables us to create non-hierarchical groups of users, which can be used by other functionalities. For example, a user group can be used as an additional information targeting tool for the announcements portlet, which presents short messages sent by authorized users (the announcements portlet allows us to direct a message to all users from a specific organization or user group).

It is also possible to set permissions to a user group and decide which actions can be performed by which roles within this particular user group.

It is worth noting that user groups can assemble users who are already members of organizations. This mechanism is often used when, aside from the company organizational structure, there exist other groups of people who need a common place to store data or for information exchange.

There’s more…

It is also possible to modify an existing user group and its attributes and to manage its members using actions available in the user group Actions menu.

There are several possible actions that can be performed on a user group. They are as follows:

  • The Edit action allows us to modify attributes of a user group
  • The Permissions action allows us to decide which roles can assign members of this user group, delete the user group, manage announcements, set permissions, and update or view the user group
  • The Manage Site Pages action redirects the user to the site settings section in Control Panel and allows us to manage the user group’s public and private sites
  • The Go to the Site’s Public Pages action opens the user group’s public pages in a new window (if any public pages of User Group Site has been created)
  • The Go to the Site’s Private Pages action opens the user group’s private pages in a new window (if any public pages of User Group Site has been created)
  • The Assign Members action allows us to assign users already existing in the Liferay database to this specific user group
  • The Delete action allows us to delete a user group

A user group cannot be removed if there are users assigned to it.

In order to edit a user group, set permissions, assign members, manage site pages, or delete a user group, perform these steps:

  1. Go to Admin | Control panel | Users | User Groups.
  2. Click on the Actions button, located near the name of the user group you want to modify:

  3. Click on the name of the chosen action.

Adding a new user

Each system is created for users. Liferay Portal CMS provides a few different ways of adding users to the system that can be enabled or disabled depending on the requirements. The first way is to enable users by creating their own accounts via the Create Account form. This functionality allows all users who can enter the site containing the form to register and gain access to the designated content of the website. In this case, the system automatically assigns the default user account parameters, which indicate the range of activities that may be carried by them in the system. The second solution (which we presented in this recipe) is to reserve the users’ account creation to the administrators, who will decide what parameters should be assigned to each account.

How to do it…

To add a new user, you need to follow these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | Users and Organizations.
  2. Click on the Add button.
  3. Choose the User option.
  4. Fill in the form by providing the user’s details in the Email Address (Required), Title, First Name (Required), Middle Name, Last Name, Suffix, Birthday, and Job Title fields (if the Autogenerated User Screen Names option in the Portal Settings | Users section is disabled, the screen name field will be available):

  5. Click on the Save button:

  6. Using the right column menu, navigate to the data sections you want to fill in with the information.
  7. Click on the Save button.

How it works…

In steps 1 through 5, we created a new user. With steps 6 and 7, we defined a set of attributes of the newly created user. This user is active and can already perform activities according to their memberships and roles. To understand all the mechanisms that influence the user’s possible behavior in the system, we have to take a deeper look at these attributes.

User as a member of organizations, user groups, and sites

The first and most important thing to know about users is that they can be members of organizations, user groups, and sites. The range of activities performed by users within each organization, user group, or site they belong to is determined by the roles assigned to them. All the roles must be assigned for each user of an organization and site individually. This means it is possible, for instance, to make a user the administrator of one organization and only a power user of another.

User attributes

Each user in Liferay has a set of attributes that are grouped and can be modified through the user profile form. This form is available after clicking on the Edit button from the user’s actions list (see, the There’s more… section).

All the available attributes are divided into the following groups:

  • USER INFORMATION, which contains the following sections:
    • The Details section enables us to provide basic user information, such as Screen Name, Email Address, Title, First Name, Middle Name, Last Name, Suffix, Birthday, Job Title, and Avatar
    • The Password section allows us to set a new password or force a user to change their current password
    • The Organizations section enables us to choose the organizations of which the user is a member
    • The Sites section enables us to choose the sites of which the user is a member
    • The User Groups section enables us to choose user groups of which the user is a member
    • The Roles tab allows us to assign user roles
    • The Personal Site section helps direct the public and private sites to the user
    • The Categorization section provides tags and categories, which can be assigned to a user
  • IDENTIFICATION allows us to to set additional user information, such as Addresses, Phone Numbers, Additional Email Addresses, Websites, Instant Messenger, Social Network, SMS, and OpenID
  • MISCELLANEOUS, which contains the following sections:
    • The Announcements section allows us to set the delivery options for alerts and announcements
    • The Display Settings section covers the Language, Time Zone, and Greeting text options
    • The Comments section allows us to manage the user’s comments
    • The Custom Fields section provides a tool to manage values of custom attributes defined for the user

User site

As it was mentioned earlier, each user in Liferay may have access to different kinds of sites: organization sites, user group sites, and standalone sites. In addition to these, however, users may also have their own public and private sites, which can be managed by them. The user’s public and private sites can be reached from the user’s menu located on the dockbar (the My Profile and My Dashboard links). It is also possible to enter these sites using their addresses, which are /web/username/home and /user/username/home, respectively.

Customizing users

Liferay gives us a whole bunch of settings in portal.properties under the Users section. If you want to override some of the properties, put them into the portal-ext.properties file.

It is possible to deny deleting a user by setting the following property:

users.delete=false

As in the case of organizations, there is a functionality that lets us customize sections on the creation or modification form:

users.form.add.main=details,Organizations,personal-site
users.form.add.identification=
users.form.add.miscellaneous=
 
users.form.update.main=details,password,Organizations,sites,user-groups,roles,personal-site,categorization
users.form.update.identification=addresses,phone-numbers,additional-email-addresses,websites,instant-messenger,social-network,sms,open-id
users.form.update.miscellaneous=announcements,display-settings,comments,custom-fields

There are many other properties, but we will not discuss all of them. In portal.properties, located in the portal-impl/src folder, under the Users section, it is possible to find all the settings, and every line is documented by comment.

There’s more…

Each user in the system can be active or inactive. An active user can log into their user account and use all resources available for them within their roles and memberships. Inactive user cannot enter his account, access places and perform activities, which are reserved for authorized and authenticated users only.

It is worth noticing that active users cannot be deleted. In order to remove a user from Liferay, you need to to deactivate them first.

To deactivate a user, follow these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | Users and Organizations.
  2. Click on the Actions button located near the name of the user.
  3. Go to the All Users tab.
  4. Find the active user you want to deactivate.
  5. Click on the Deactivate button.
  6. Confirm this action by clicking on the Ok button.

To activate a user, follow these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | Users and Organizations.
  2. Go to the All Users tab.
  3. Find the inactive user you want to activate.
  4. Click on the Actions button located near the name of the user.
  5. Click on the Activate button.

Sometimes, when using the system, users report some irregularities or get a little confused and require assistance. You need to look at the page through the user’s eyes. Liferay provides a very useful functionality that allows authorized users to impersonate another user. In order to use this functionality, perform these steps:

  1. Log in as an administrator and go to Control Panel | Users | Users and Organizations.
  2. Click on the Actions button located near the name of the user.
  3. Click on the Impersonate user button.

See also

  • For more information on managing users, refer to the Exporting users recipe from this article

Assigning users to organizations

There are several ways a user can be assigned to an organization. It can be done by editing the user account that has already been created (see the User attributes section in Adding a new user recipe) or using the Assign Users action from the organization actions menu. In this recipe, we will show you how to assign a user to an organization using the option available in the organization actions menu.

Getting ready

To go through this recipe, you will need an organization and a user (refer to Managing an organization structure and Adding a new user recipes from this article).

How to do it…

In order to assign a user to an organization from the organization menu, follow these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | Users and Organizations.
  2. Click on the Actions button located near the name of the organization to which you want to assign the user.
  3. Choose the Assign Users option.
  4. Click on the Available tab.
  5. Mark a user or group of users you want to assign.

  6. Click on the Update Associations button.

How it works…

Each user in Liferay can be assigned to as many regular organizations as required and to exactly one location. When a user is assigned to the organization, they appear on the list of users of the organization. They become members of the organization and gain access to the organization’s public and private pages according to the assigned roles and permissions. As was shown in the previous recipe, while editing the list of assigned users in the organization menu, it is possible to assign multiple users.

It is worth noting that an administrator can assign the users of the organizations and suborganizations tasks that she or he can manage. To allow any administrator of an organization to be able to assign any user to that organization, set the following property in the portal-ext.properties file:

Organizations.assignment.strict=true

In many cases, when our organizations have a tree structure, it is not necessary that a member of a child organization has access to the ancestral ones. To disable this structure set the following property:

Organizations.membership.strict=true

See also

  • For information on how to create user accounts, refer to the Adding a new user recipe from this article
  • For information on assigning users to user groups, refer to the Assigning users to a user group recipe from this article

Assigning users to a user group

In addition to being a member of the organization, each user can be a member of one or more user groups. As a member of a user group, a user can profit by getting access to the user group’s sites or other information directed exclusively to its members, for instance, messages sent by the Announcements portlet. A user becomes a member of the group when they are assigned to it. This assignment can be done by editing the user account that has already been created (see the User attributes description in Adding a new user recipe) or using the Assign Members action from the User Groups actions menu. In this recipe, we will show you how to assign a user to a user group using the option available in the User Groups actions menu.

Getting ready

To step through this recipe, first, you have to create a user group and a user (see the Creating a new user group and Adding a new user recipes).

How to do it…

In order to assign a user to a user group from the User Groups menu, perform these steps:

  1. Log in as an administrator and go to Admin | Control panel | Users | User Groups.
  2. Click on the Actions button located near the name of the user group to which you want to assign the user.
  3. Click on the Assign Members button.
  4. Click on the Available tab.

  5. Mark a user or group of users you want to assign.
  6. Click on the Update Associations button.

How it works…

As was shown in this recipe, one or more users can be assigned to a user group by editing the list of assigned users in the user group menu. Each user assigned to a user group becomes a member of this group and gains access to the user group’s public and private pages according to assigned roles and permissions.

See also

  • For information on how to create user accounts, refer to the Adding a new user recipe from this article
  • For information about assigning users to organization, refer to the Assigning users to organizations recipe from this article

Exporting users

Liferay Portal CMS provides a simple export mechanism, which allows us to export a list of all the users stored in the database or a list of all the users from a specific organization to a file.

How to do it…

In order to export the list of all users from the database to a file, follow these steps:

  1. Log in as an administrator and go to Admin | Control Panel | Users | Users and Organizations.
  2. Click on the Export Users button.

In order to export the list of all users from the specific organization to a file, follow these steps:

  1. Log in as an administrator and go to Admin | Control Panel | Users | Users and Organizations.
  2. Click on the All Organizations tab.
  3. Click on the name of an organization to which the users are supposed to be exported.
  4. Click on the Export Users button.

How it works…

As mentioned previously, Liferay allows us to export users from a particular organization to a .csv file. The .csv file contains a list of user names and corresponding e-mail addresses. It is also possible to export all the users by clicking on the Export Users button located on the All Users tab. You will find this tab by going to Admin | Control panel | Users | Users and Organizations.

See also

  • For information on how to create user accounts, refer to the Adding a new user recipe from this article
  • For information on how to assign users to organizations, refer to the Assigning users to organizations recipe from this article

Summary

In this article, you have learnt how to manage an organization structure by creating users and assigning them to organizations and user groups. You have also learnt how to export users using Liferay’s export mechanism.

Resources for Article:


Further resources on this subject:


1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here