---
title: UI page permission checks
related:
  - https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md
  - https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

This page covers how to add permissions to applications and evaluate them within UI pages. Access in the administration is governed by [role-based access control](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md), which works in layers:

- **Application permissions** apply to every application. Each application declares the permissions it evaluates, and roles are granted these permissions per application. See [Add and evaluate permissions for applications](#add-and-evaluate-permissions-for-applications).
- **Workspace permissions** apply on top of application permissions in applications scoped under [workspaces](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/workspaces.md). See [Add and evaluate permissions in workspace-scoped applications](#add-and-evaluate-permissions-in-workspace-scoped-applications).
- **Page permissions** apply on top of application permissions in [website channel applications](https://docs.kentico.com/documentation/business-users/website-content.md), where [page-level permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md) restrict access to individual pages in the content tree. See [Add and evaluate permissions in website channel applications](#add-and-evaluate-permissions-in-website-channel-applications).

## Add and evaluate permissions for applications

### Define the set of application permissions

Each application in the admin UI needs to declare the set of permissions it actively evaluates. This set is reflected when [assigning permissions to roles](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md#assign-permissions-to-roles) via the **Role management** application. Define the permissions by decorating [UI application pages](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-application-pages.md) with the `UIPermission` attribute and specifying permission names. The system's [default application permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md) (_VIEW_, _CREATE_, _DELETE_, _UPDATE_) are accessible via the `SystemPermissions` class.

```csharp title="Add permissions to UI applications"
using CMS.Membership;

using Kentico.Xperience.Admin.Base;

// Adds the default application permissions to the 'OfficeManagement' application
[UIPermission(SystemPermissions.VIEW)]
[UIPermission(SystemPermissions.CREATE)]
[UIPermission(SystemPermissions.DELETE)]
[UIPermission(SystemPermissions.UPDATE)]
// Adds a custom permission to the application
// Permission semantics are implementation-dependent
[UIPermission("Acme.HumanResources", "Human resources")]
public class OfficeManagementApplication : ApplicationPage
```

> **Note:** **Permission name requirements**
>
> Custom permission names must be:
>
> - **unique** – we recommend including a unique prefix, such as your company name.
> - **valid code names** – only alphanumeric characters, digits, underscores (`_`), hyphens (`-`), and periods (`.`). Periods cannot be consecutive, or the first/last character. No spaces or special characters.
> - at most **50 characters** long
>
> Using a permission name that breaks these requirements causes the administration application to crash at runtime.
>
> The requirements apply only to permission names (the first `[UIPermission]` attribute parameter), not to display names.

For applications without any permission requirements, use the `NoPermissionRequired` attribute. The attribute ensures global visibility and accessibility to all users, regardless of their roles or permissions.

```csharp
using Kentico.Xperience.Admin.Base;

// Ensures global visibility and accessibility to all users, regardless of their roles or permissions 
[NoPermissionRequired]
public class OfficeManagementApplication : ApplicationPage
```

### Require permissions to access UI pages

To place [UI pages](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md) behind permissions, use the `UIEvaluatePermission` attribute. This permission must be from the set defined for the corresponding application using the `UIPermission` attribute. Otherwise, you would be unable to [assign this permission to roles](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md#assign-permissions-to-roles) via **Role management**.

```csharp title="Place UI pages behind permissions"
using Kentico.Xperience.Admin.Base;

// Only roles with the 'Human resources' permission can access this page
[UIEvaluatePermission("Acme.HumanResources")]
public class OpenPositionListing : ListingPage
```

> **Info:** **Permission evaluation in UI page templates**
>
> The following [UI page templates](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/reference-ui-page-templates.md) provided by the API by default contain permission checks:
>
> - Listing pages – require VIEW to access.
> - Create pages – require CREATE to access.

Roles without proper permissions attempting to access such pages receive a forbidden (HTTP 403) response.

### Evaluate permissions within page commands

You can configure each [page command handler](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-page-commands.md#designate-command-handlers) to evaluate a single permission:

```csharp title="Page command permissions"
using System.Threading.Tasks;

using CMS.Membership;

using Kentico.Xperience.Admin.Base;

// ...

// Only roles with the 'CREATE' permission can call this command
[PageCommand(Permission = SystemPermissions.CREATE)]
public async Task<ICommandResponse<RowActionResult>> DoSomething()
{
    // Command logic
}
```

### Propagate permission information to client UI templates

You might need to send information about a user's permissions to the [client UI template](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md) to, for example, disable certain interactive elements. To check whether the current user has the required permissions, use `IUIPermissionEvaluator`:

```csharp title="Send permission information to the client"
using System.Threading.Tasks;

using Kentico.Xperience.Admin.Base;

public class HrPage(IUIPermissionEvaluator permissionEvaluator) : Page<PageClientProperties>
{
    // Sends the required data to the client. 
    // Based on this information, the logic within the template can, e.g., disable interactive elements
    public override async Task<PageClientProperties> ConfigureTemplateProperties(PageClientProperties properties)
    {
        var permissionResult = await permissionEvaluator.Evaluate("Acme.HumanResources");

        properties.HrPermission = permissionResult.Succeeded;

        return properties;
    }
}

public class PageClientProperties : TemplateClientProperties
{
    public bool HrPermission { get; set; }
}
```

## UI permission model and page extenders

If you need to add permissions to system pages or pages provided via third-party integrations where you cannot access the source code, you can do so via [UI page extenders](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-page-extenders.md):

```csharp title="Permission definition"
using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.UIPages;

// Adds a custom permission to the user listing page in the 'Users' application
[UIPermission("Acme.Permission")]
public class UserListExtender : PageExtender<UserList>
```

> **Note:** This applies only to application permissions that you can grant to roles via the **Role management** application. The set of [page permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md) of website channel applications (_Display_, _Read_, _Create_, _Update_, _Delete_, _Synchronize_) cannot be extended.

After annotating the extender class as demonstrated in the example above, you can work with the added permission as if it was assigned directly to the application. The following example [defines a new action](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-page-extenders.md#add-new-page-commands) on the users listing page from the **Users** application and places it behind the "_Acme.Permission_" permission.

```csharp title="Permission usage"
using System.Threading.Tasks;

using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.UIPages;

[UIPermission("Acme.Permission")]
public class UserListExtender : PageExtender<UserList>
{
    public override Task ConfigurePage()
    {
        ...
        configuration.TableActions
                    .AddCommand("Do something", nameof(DoSomething), Icons.ArrowsCrooked);
        ...
    }

    [PageCommand(Permission = "Acme.Permission")]
    public async Task<ICommandResponse<RowActionResult>> DoSomething()
    {
        // Command logic
    }
}
```

The added permission is now also [assignable](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md#assign-permissions-to-roles) via the **Role management** application.

![Role management application](https://docs.kentico.com/docsassets/documentation/ui-page-permission-checks/PageExtenderCustomPermission.png "Role management application")

## Add and evaluate permissions in workspace-scoped applications

Applications scoped under [workspaces](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/workspaces.md) use the workspace permission model, where [permissions can be set](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md#assign-permissions-to-roles) for each workspace separately. This model allows you to control access to UI pages and commands in a workspace-scoped application based on workspace-specific permissions.

### Require permissions to access workspace-scoped UI pages

To place [UI pages](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md) behind permissions of a given workspace, use the `WorkspaceEvaluatePermission` attribute.

```csharp title="Place UI pages behind permissions"
using CMS.Workspaces;

using Kentico.Xperience.Admin.Base;

// Only roles with the 'Create' permission can access this page
[WorkspaceEvaluatePermission(WorkspaceDataPermissions.CREATE)]
public class CustomListing : ListingPage
```

### Evaluate permissions with IWorkspacePermissionEvaluator

Use the `IWorkspacePermissionEvaluator` to granularly evaluate the permissions for a given workspace specified by the `WorkspaceId`. You can retrieve the `WorkspaceId` using the `GetContentItemMetadata` method of the [content item manager](https://docs.kentico.com/api/content-management/content-items.md#content-item-management) or directly from the URL of UI pages that use the `WorkspaceId` as a [parameter of a URL slug](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md#parameterized-url-slugs).

```csharp title="Use the IWorkspacePermissionEvaluator to evaluate permissions"
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

using CMS.ContentEngine;
using CMS.Workspaces;

using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.Authentication;
using Kentico.Xperience.Admin.Base.UIPages;

public class CustomPage(IWorkspacePermissionEvaluator workspacePermissionEvaluator,
                        IContentItemManagerFactory contentItemManagerFactory,
                        IAuthenticatedUserAccessor userAccessor,
                        IContentQueryExecutor contentQueryExecutor) : Page
{
    [PageCommand]
    public async Task<ICommandResponse> CommandHandler()
    {
        // Gets the ID of the item from which to retrieve the WorkspaceId
        const string STORE_CONTENT_TYPE = "Wonka.CandyStore";
        ContentItemQueryBuilder builder =
                new ContentItemQueryBuilder()
                        .ForContentType(STORE_CONTENT_TYPE, q =>
                        {
                            q.TopN(1)
                                .Where(w => w.WhereEquals("StoreName", "Prague-Hradcany"));
                        });

        var itemId = await contentQueryExecutor
                        .GetResult<int>(builder, rowData =>
                        {
                            var contentItemId = rowData.ContentItemID;
                            return contentItemId;
                        });

        var id = itemId.FirstOrDefault();

        // Gets the current user in the administration
        var user = await userAccessor.Get();

        // Creates an instance of the manager class facilitating content item operations
        var manager = contentItemManagerFactory.Create(user.UserID);

        // Retrieves ContentItemMetadata of a given content item
        var metadata = await manager.GetContentItemMetadata(id, CancellationToken.None);

        // Evaluates a given permission for the current user and the workspace specified by the WorkspaceId acquired from ContentItemMetadata
        // The Succeeded boolean property of IWorkspacePermissionEvaluator indicates the result of the evaluation
        if ((await workspacePermissionEvaluator.Evaluate(WorkspaceDataPermissions.VIEW, typeof(ContentHubApplication), metadata.WorkspaceId)).Succeeded)
        {
            // ...
        }

        // ...

        return Response();
    }
}
```

## Add and evaluate permissions in website channel applications

[Website channel applications](https://docs.kentico.com/documentation/business-users/website-content.md) control access on two levels:

| Level                                                                                                                                              | Permissions                                                                                                                                                                                             | Where you set them                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Application permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md)                     | _Access channel_ (`SystemPermissions.VIEW`)<br>_Manage permissions_ (`WebsiteChannelUIPermissions.MANAGE_PERMISSIONS`)<br>_Override content lock_ (`WebsiteChannelUIPermissions.OVERRIDE_CONTENT_LOCK`) | [Granted to roles](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management.md#assign-permissions-to-roles) in the **Role management** application.                                                                                                                                                                                                                                                                                 |
| [Page permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md) | _Display_<br>_Read_<br>_Create_<br>_Update_<br>_Delete_<br>_Synchronize_                                                                                                                                | Set in the form of an access-control list (ACL) for the [website's root](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md#allow-users-to-work-with-website-channel-content), [content tree sections](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md#edit-page-permissions), and individual pages and folders. |

UI pages that you add to items in the content tree of website channel applications need to respect both levels.

### Register UI pages for content tree items

Every item that users select in the content tree of a website channel application – the website's root, a folder, or a page – opens in the same layout page, `WebPageLayout`. The child pages of the layout form the item's page menu, which contains the system [view modes](https://docs.kentico.com/documentation/business-users/website-content.md#view-modes), the **Used in** and **URLs** tabs, and the [Properties](https://docs.kentico.com/documentation/business-users/website-content.md#properties) tab.

[Register](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md#register-ui-pages) your UI pages under one of the following parent pages, or under any of their child pages:

- `WebPageLayout` – adds a new tab to the page menu of all pages and folders, including pages and folders that are not translated to the selected language, and of the website's root.
- `WebPagePropertiesTab` – adds a new section to the **Properties** tab of pages and folders, next to system sections such as **Information** and [Membership access](https://docs.kentico.com/documentation/business-users/website-content/secure-pages.md).
- `RootPropertiesTab` – adds a new section to the **Properties** tab of the website's root, next to the system [Channel permissions](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md#allow-users-to-work-with-website-channel-content) section.

UI pages registered under these parent pages appear in the content tree of every website channel. You can't limit the registration to specific website channels.

### Evaluate page permissions in UI pages

To evaluate page permissions in UI pages registered for content tree items, inherit them from one of the following base classes (`Kentico.Xperience.Admin.Websites.UIPages` namespace):

- `WebPageModelEditPageBase<TModel>` – for [model-based edit pages](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-pages-with-forms.md#create-model-based-edit-pages). The class also requires the _Access channel_ application permission to access the page.
- `WebPageBase<TClientProperties>` – for pages with other client templates. The `TClientProperties` type needs to inherit from `WebPageBaseClientProperties`. If you override the `ConfigureTemplateProperties` method, call the base implementation, which sets the `WebPageState` property of the client properties.

The base classes read the website channel and the selected content tree item from the URL of `WebPageLayout`, so they work only for UI pages registered under `WebPageLayout` or its child pages. Both base classes:

- Bind the website channel and the selected item to the `ApplicationIdentifier` (`WebsiteChannelID`) and `WebPageIdentifier` (`WebPageItemID`, `LanguageName`) properties. You don't need to declare your own [page parameters](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md#parameterized-url-slugs). For the website's root, `WebPageIdentifier.WebPageItemID` is _0_.
- Check the _Read_ page permission in the [ConfigurePage](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages.md#configurepage) method. The system calls `ConfigurePage` when the page loads and before each [page command](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-page-commands.md), so users without the _Read_ page permission receive a forbidden (HTTP 403) response in both cases.
- Contain the protected `CheckAclPermission` method. Call it from your page's code to check whether the current user has a page permission for the specified page. Use the constants from the `WebPageAclPermissions` class (`CMS.Websites` namespace) for permission names. Users without the _Access channel_ application permission don't have any page permissions. Users with the _Administrator_ role or the _Manage permissions_ application permission have all page permissions.

If you override `ConfigurePage`, call the base implementation first so that the _Read_ page permission check runs before your code.

The following page derived from one of the base classes reads the bound properties and requires the _Update_ page permission for its command:

```csharp title="Evaluate page permissions in a UI page"
public override async Task ConfigurePage()
{
    // Checks the 'Read' page permission for the selected content tree item
    await base.ConfigurePage();

    // Properties bound from the URL of WebPageLayout
    int websiteChannelId = ApplicationIdentifier.WebsiteChannelID;
    int webPageItemId = WebPageIdentifier.WebPageItemID;
    string languageName = WebPageIdentifier.LanguageName;
}

// Requires only the 'Access channel' application permission
[PageCommand(Permission = SystemPermissions.VIEW)]
public async Task<ICommandResponse> CommandHandler()
{
    // Results in HTTP 403 if the user doesn't have the 'Update' page permission
    // for the content tree item selected in the website channel application
    await CheckAclPermission(WebPageIdentifier.WebPageItemID, WebPageAclPermissions.UPDATE);

    // Command logic
}
```

Compared to [regular UI pages](#add-and-evaluate-permissions-for-applications), such pages also need to [check page permissions in their page commands](#check-page-permissions-in-page-commands).

### Check page permissions in page commands

The base classes check only the _Read_ [page permission](https://docs.kentico.com/documentation/developers-and-admins/configuration/users/role-management/page-permission-management.md). The system doesn't evaluate any other page permission for your page commands. At the start of each command, call `CheckAclPermission` with the page permission that the command's operation requires. The method throws a `ForbiddenAccessException` when the user doesn't have the permission, which results in a forbidden (HTTP 403) response.

The [Permission property](#evaluate-permissions-within-page-commands) of the `PageCommand` attribute evaluates application permissions, not page permissions. In website channel applications, set it only to the _Access channel_ application permission (`SystemPermissions.VIEW`), and leave the operation-specific checks to `CheckAclPermission`.

In pages derived from `WebPageModelEditPageBase<TModel>`, override the `Submit` and `Change` [page commands](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/ui-pages/ui-page-commands.md):

- Set their `Permission` property to `SystemPermissions.VIEW`.
- Call `CheckAclPermission` with the _Update_ page permission before calling the base implementation.

`WebPageModelEditPageBase<TModel>` also evaluates the _Update_ page permission when preparing the form. Users without the _Update_ page permission see the form as read-only. This only adjusts the UI and doesn't protect the `Submit` or `Change` commands.

The following example adds a section to the [Properties](https://docs.kentico.com/documentation/business-users/website-content.md#properties) tab of pages and folders. The section uses the _Access channel_ application permission for its commands and requires the _Update_ page permission to submit or change the form. The order _200_ places the section between the system **Information** and [Membership access](https://docs.kentico.com/documentation/business-users/website-content/secure-pages.md) sections. The example omits loading and storing the section's data:

- To load the data, override `ConfigurePage`, call the base implementation first so that the _Read_ page permission check runs, and then fill the model with the stored values.
- To store the data, save the submitted model in `ProcessFormData` before calling the base implementation. The base implementation of `ProcessFormData` doesn't save any data. It only returns the success response to the client. To change the page or folder itself, use the `IWebPageManager` that `webPageManagerFactory.Create` returns.

```csharp title="Add a Properties section with page permission checks"
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

using CMS.Membership;
using CMS.Websites;

using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.Authentication;
using Kentico.Xperience.Admin.Base.FormAnnotations;
using Kentico.Xperience.Admin.Base.Forms;
using Kentico.Xperience.Admin.Websites.UIPages;

// Adds a section to the 'Properties' tab of pages and folders in website channel applications
[assembly: UIPage(
    parentType: typeof(WebPagePropertiesTab),
    slug: "review-notes",
    uiPageType: typeof(ReviewNotesSection),
    name: "Review notes",
    templateName: TemplateNames.EDIT,
    order: 200)]

public class ReviewNotesModel
{
    [TextAreaComponent(Label = "Notes")]
    public string Notes { get; set; }
}

public class ReviewNotesSection(
    IFormDataBinder formDataBinder,
    IWebPageManagerFactory webPageManagerFactory,
    IAuthenticatedUserAccessor authenticatedUserAccessor,
    IServiceProvider serviceProvider)
    : WebPageModelEditPageBase<ReviewNotesModel>(
        formDataBinder,
        webPageManagerFactory,
        authenticatedUserAccessor,
        serviceProvider)
{
    private ReviewNotesModel model;

    // Creates an empty model
    // Load the stored data of the page or folder into the model in ConfigurePage
    protected override ReviewNotesModel Model => model ??= new ReviewNotesModel();

    // Requires only the 'Access channel' application permission
    [PageCommand(Permission = SystemPermissions.VIEW)]
    public override async Task<ICommandResponse> Submit(FormSubmissionCommandArguments args)
    {
        // Results in HTTP 403 if the user doesn't have the 'Update' page permission
        await CheckAclPermission(WebPageIdentifier.WebPageItemID, WebPageAclPermissions.UPDATE);

        return await base.Submit(args);
    }

    [PageCommand(Permission = SystemPermissions.VIEW)]
    public override async Task<ICommandResponse<FormChangeResult>> Change(
        FormChangeCommandArguments args)
    {
        await CheckAclPermission(WebPageIdentifier.WebPageItemID, WebPageAclPermissions.UPDATE);

        return await base.Change(args);
    }

    protected override Task<ICommandResponse> ProcessFormData(
        ReviewNotesModel model,
        ICollection<IFormItem> formItems)
    {
        // Store the submitted model for the page or folder specified by WebPageIdentifier.WebPageItemID here
        // The base implementation doesn't save any data, it only returns the success response
        return base.ProcessFormData(model, formItems);
    }
}
```
