Learn / eZ Publish / Section Segmentation and User Permissions Part 1 of 2

Section Segmentation and User Permissions Part 1 of 2

This article is relevant for advanced content managers and webmasters responsible for setting up and managing sections in an eZ Publish site. This is important in situations such as defining structural content segmentation and setting up a protected area. It is useful when managing webshop discount rules, since one of the discount rule limitations is the Section limitation. Also, user permissions can be applied based on many criteria, of which sections is one of them.

Note that this article assumes that you have administrator-like permissions in order to access the Setup tab in the Administration Interface. For information about the general layout of the Administration Interface, see the eZ Publish Content Management Basics book. It also assumes that you have knowledge about the content node tree and the concept of multiple locations.

This article was written to be compatible with eZ Publish 4.0, although the concepts and procedures should be similar for other versions.

On its own, a section consists of only a section ID, a name and a navigation part. It is best to think about a section in terms of how its ID is used. Consequently, the most applicable definition is "a virtual collection of nodes that belong together". In other words, it is a logical hierarchy or structure, different than the content node tree but applied to the nodes within it, as shown in the illustration below.

Segmentation example

The following functionality is provided through the eZ Publish section mechanism:

  • Segmenting the content node tree into different subtrees, as shown above. Segmentation is usually a prerequisite for the other features listed below.
  • Setting up custom template override rules. By using sections in the configuration of when to use which template, it is possible to have only a few rules that apply to all nodes within a logical group, in contrast to having a large collection of special-case rules. For example, you could choose a different layout for news articles than for company articles, according to their section. If the class attributes are the same, there is no need to define multiple classes. This is described in the eZ Publish Basics book.
  • Limiting control and access to content. This is the focus of the second article in this series.
  • Specifying content that is to be subject to approval in the built-in collaboration system. This is discussed in eZ Publish Advanced Content Management but will not be elaborated upon in this article series.
  • Assigning discount rules to a group of products of the Webshop. This is discussed in eZ Publish Advanced Content Management but will not be elaborated upon in this article series.

Section properties

A section ID is an identification number that can be assigned to an object and denotes which section that object belongs to. It is stored in a special-purpose attribute within a content object, and you will not see this attribute in the main editing window. A section can be assigned to many objects, but a single object can have only one section.

It is the assignment of different section IDs to different objects that enables you to have a logical hierarchy in parallel with your sitemap-like content hierarchy. Your site can have as many virtual collections of nodes as you have section IDs.

Each section ID is also associated with a more user-friendly name, such as "Standard" or "Restricted", and a navigation part, such as the Content structure or Webshop tab. The name is used for easy identification of sections in the Administration Interface. The navigation part determines which main menu tab is accessed when you work with an object. In other words, when an object is requested in the Administration Interface, the system looks up the section that the object belongs to; the system then looks up the navigation part of that section and then displays the object in the tab as specified by the navigation part.

Built-in sections

eZ Publish comes with a set of built-in sections. The following list shows the built-in sections for sites with the Website Interface. Note that the first five sections correspond to the top-level nodes, although the section corresponding to the Content top-level node is named "Standard".

  • Standard
  • Media
  • Users
  • Setup
  • Design
  • Restricted

The Setup section is used to isolate configuration-related objects from ordinary content. This is achieved in conjunction with the permission and template systems. Similarly, the Design section is associated with the Design tab. It isolates template and look settings (such as the site title and URL, labels and footer text) from ordinary content and other configuration. The Restricted section is a protected area of the site, as achieved in conjunction with the permission system. By default, it is applied to a partner area, which can only be accessed by users in the Partner user group (or higher). Additional sections can be added as needed, as described later.

Section inheritance

When an object is first created, but is not yet published and thus has a "Draft" status, its section is set to the default Standard section. Recall that an object is not visible to site visitors, nor does it show up in the left menu of the Administration Interface, until it has been published. In other words, a Draft object does not have a location within the hierarchy, and it is only accessible to the user creating it. As a result, it does not matter what the section ID is at this time.

When the object is published, usually when you click the Send for publishing button, it automatically inherits the section ID assigned to the object encapsulated by its parent node. For example, if you create and publish a new object within a folder belonging to the Media section, the Media section is automatically assigned to the newly created object.

The picture is slightly more complicated when multiple locations exist for the parent node's encapsulated object. Cross-publishing is usually used only for non-container objects such as articles and documentation pages or product sheets, since adding a location does not include a node's subtree. In these cases, the section ID inheritance follows the main node of the object referenced by the parent node.

There are three windows that display the name of the section to which an object belongs. These are the Details, Sub items (with the detailed list type toggled) and Section windows.

Section name in Details window

The Details window is shown in the main area of the Administration Interface when viewing some content (and when the corresponding switch has been selected). This displays information about the selected node and the object that it encapsulates:

Details window

The entry in the third column shows the section name. Clicking it brings up the Section view interface, which displays information about the section, the roles, users, and user groups associated with the section, and the objects within the section.

Section name in Sub items window

The Sub items window is shown at the bottom of the main area of the Administration Interface when viewing some content. When the detailed list type is selected (in the top right of the window), the sixth column shows the section name for each of the children of the object being viewed. Clicking one of the names brings up the Section view interface, as previously described.

Sub items window

Section window shown in edit mode

The Section window is shown in the bottom left area of the Object Edit Interface. This displays the name of the currently assigned section, and lets you change it. The number in square brackets in the title bar shows how many available sections you can choose from.

Sections interface

The Sections interface is your most important tool for managing sections. From here you can bring up the Section editing interface and the Section view interface. You can open the Sections interface by clicking on the Sections link in the left menu of the Setup tab. This interface is shown below:

Sections interface

The Sections interface has a header bar showing how many unique sections there are; a main area listing the name and ID of these sections; and a toolbar at the bottom. If you have many sections, you can toggle the number of sections that are listed per page by clicking the numbers "10", "25" and "50" in the top left corner below the header bar. Section management tasks such as creating, editing, assigning and deleting are carried out by using the buttons on the toolbar and the right side of the listing, along with the checkboxes to the left of the section listing.

To create a new section, all you have to do is to provide a name and a navigation part, as explained in the procedure below:

1. Click the New section button in the Sections interface. This will take you to the Section editing interface for the new section:

Section editing interface

2. Enter a name for the new section in the Name input field.

3. Select a navigation part from the dropdown list. You will recognize the names of the Administration Interface main menu tabs within this list. Recall that the navigation part dictates which tab is accessed when working with objects in the section.

4. Click the OK button to create the section or the Cancel button to abort the procedure.

The newly created section will show up in the section listing. It will automatically be assigned the next unused section ID. As seen in the screenshot below, our new section is titled "My new section" and has an ID of "7".

Section added

Assigning a section

To assign a section to a subtree, follow the procedure below. Note that you cannot assign a section directly when creating or editing the section itself.

  1. Open the Sections interface (click the Sections link in the Setup tab).
  2. Click the Assign button to the right of the desired section.
    This will open the Browse interface within the navigation part you selected for the section. Navigate using the available tabs, the tree menu and the content list.
  3. Use the checkboxes to select a node to which to assign the section. You can select multiple nodes. Then, click the Select button. The assignment will be carried out for the selected node (or more accurately, its encapsulated object) and the corresponding subtree.

You can also assign a section to a subtree by opening the target object for editing and changing the section in the Section window before publishing a new version. However, if you are not going to make any content changes to the object, it is best to use the Sections interface.

This article has introduced the concept of sections and described how to work with them in the Administration Interface. In the next article, we will talk about managing users, user groups, roles, and policies, including an example on creating a protected section.

Resources