51黑料不打烊

Configurations and the Configuration Browser configuration-browser

51黑料不打烊 Experience Manager (AEM) configurations serve to manage settings in AEM and serve as workspaces.

What is a Configuration? what-is-a-configuration

A configuration can be considered from two different viewpoints.

  • An administrator uses configurations as workspaces within AEM to define and manage groups of settings.
  • A developer uses the underlying configuration mechanism that implements configurations to persist and look up settings in AEM.

In summary: from an administrator鈥檚 point of view, configurations are how you create workspaces to manage settings in AEM, whereas the developer should understand how AEM uses and manages these configurations within the repository.

Regardless from your perspective, configurations serve two main purposes in AEM:

  • Configurations enable certain features for certain groups of users.
  • Configurations define access rights for those features.

Configurations as an Administrator configurations-administrator

The AEM administrator and authors can consider configurations as workspaces. These workspaces can be used to gather groups of settings and their associated content for organizational purposes by implementing access rights for those features.

Configurations can be created for many different features within AEM.

Example administrator-example

For example, an administrator may create two configurations for Editable Templates.

  • WKND-General
  • WKND-Magazine

The admin can then create general page templates using the WKND-General configuration and then templates specific to the magazine under WKND-Magazine.

The admin can then associate the WKND-General with all content of the WKND site. However the WKND-Magazine configuration would be associated only with the magazine site.

By doing this:

  • When a content author creates a page for the magazine, the author can choose from general templates (WKND-General) or magazine templates (WKND-Magazine).
  • When a content author creates a page for another part of the site that is not the magazine, the author can only choose from the general templates (WKND-General).

Similar setups are possible not only for Editable Templates but also for Cloud Configurations, ContextHub Segments, and Content Fragment Models.

Using the Configuration Browser using-configuration-browser

The Configuration Browser allows an administrator to easily create, manage, and configure access rights to configurations in AEM.

NOTE
It is only possible to create configurations using the Configuration Browser, if your user has admin rights. Such admin rights are also required to assign access rights to the configuration or otherwise modify a configuration.

Creating a Configuration creating-a-configuration

It is simple to create a configuration in AEM using the Configuration Browser.

  1. Log into AEM as a Cloud Service and from the main menu select Tools > General > Configuration Browser.

  2. Select Create.

  3. Provide a Title and a Name for your configuration.

    Create configuration

    • The Title should be descriptive.

    • The Name becomes the node name in the repository.

      • It is automatically generated based on the title and adjusted according to AEM naming conventions.
      • It can be adjusted if necessary.
  4. Check the type of configurations that you want to allow.

  5. Select Create.

TIP
Configurations may be nested.

Editing Configurations and Their Access Rights access-rights

If you think of configurations as workspaces, access rights can be set on those configurations to enforce who may and may not access those workspaces.

  1. Log into AEM as a Cloud Service and from the main menu select Tools > General > Configuration Browser.

  2. Select the configuration that you want to edit, and then select Properties in the tool bar.

  3. Select any additional features that you want to add to the configuration.

    note note
    NOTE
    It is not possible to unselect a feature once the configuration has been created.
  4. Use the Effective Permissions button to view a matrix of roles and what permissions they are currently granted to configurations.
    Effective permissions window

  5. To assign new permissions, enter the user or group name in the Select user or group field in the Add New Permissions section.

    • The Select user or group field offers auto-completion based on existing users and roles.
  6. Select the appropriate user or role from the auto-complete results.

    • You can select more than one user or role.
  7. Check the access options that one or more selected users or roles should have and click Add.
    Add access rights to a configuration

  8. Repeat the steps so you can select users or roles and assign additional access rights as necessary.

  9. Select Save & Close when finished.

Configurations as a Developer configurations-developer

As a developer, it is important to know how AEM as a Cloud Service works with configurations and how it processes configuration resolution.

Separation of Configuration and Content separation-of-config-and-content

Although the administrator and users may think of configurations as workplaces to manage different settings and content, it is important to understand that configurations and content are stored and managed separately by AEM in the repository.

  • /content is home to all content.
  • /conf is home to all configuration.

Content references its associated configuration by way of a cq:conf property. AEM performs a lookup based on the content and its contextual cq:conf property to find the appropriate configuration.

Example developer-example

For this example, let鈥檚 assume you have some application code that is interested in DAM settings.

Conf conf = resource.adaptTo(Conf.class);
ValueMap imageServerSettings = conf.getItem("dam/imageserver");
String bgkcolor = imageServerSettings.get("bgkcolor", "FFFFFF");

The starting point of all configuration lookup is a content resource somewhere under /content. This could be a page, a component inside a page, an asset, or a DAM folder. This is the actual content for which you are looking for the right configuration that applies in this context.

Now with the Conf object in hand, you can retrieve the specific configuration item that you are interested in. In this case, it is dam/imageserver, which is a collection of settings related to the imageserver. The getItem call returns a ValueMap. You then read a bgkcolor string property and provide a default value of 鈥淔FFFFF鈥 in case the property (or entire config item) is not present.

Now let鈥檚 have a look at the corresponding JCR content:

/content/dam/wknd
    + jcr:content
      - cq:conf = "/conf/wknd"
    + image.png [dam:Asset]

/conf/wknd
    + settings
      + dam
        + imageserver [cq:Page]
          + jcr:content
            - bgkcolor = "FF0000"

In this example, you can assume a WKND-specific DAM folder here and a corresponding configuration. Starting at that folder /content/dam/wknd, you can see that there is a string property that is named cq:conf that references the configuration that applies to the subtree. The property is set on the jcr:content of an asset folder or page. These conf links are explicit, so it is easy to follow them by just looking at the content in CRXDE.