---
title: "Navigation and Access"
manual: "adsum by web-vision"
version: "main"
permalink: "https://docs.typo3.org/permalink/web-vision/adsum-monorepo:extending-navigation-access@main"
source: "Extending/NavigationAndAccess.rst"
rendered: "2026-11-07T02:01:32+00:00"
---

# Navigation and Access {#extending-navigation-access}

A package adds its pages to the navigation in the left sidebar. Every route, API operation and navigation entry names
the actors that may use it; a request without such a declaration is denied.

## Navigation entries {#navigation-entries}

Implement `NavigationEntries` and return the entries. The navigation of the attendance package:

```php
use WebVision\Adsum\Core\Shared\Navigation\NavigationEntries;
use WebVision\Adsum\Core\Shared\Navigation\NavigationEntry;

final readonly class AttendanceNavigation implements NavigationEntries
{
    public function entries(): iterable
    {
        yield new NavigationEntry('myDays', 'myTime', 5, 'nav.myDays', 'clock', 'app_my_days', ['self']);
        yield new NavigationEntry('teamDays', 'team', 30, 'nav.teamDays', 'list-checks', 'app_team_days', ['managerInScope', 'hr']);
    }
}
```

The constructor arguments of `NavigationEntry` are, in this order:

-   **`key`**

    A unique key of the entry.

-   **`group`**

    The group the entry belongs to.

-   **`order`**

    The position in the group. Lower numbers come first; entries with the same number are sorted by key.

-   **`labelKey`**

    The translation key of the label, for example `nav.myDays` (see [Translations and Icons](https://docs.typo3.org/permalink/web-vision/adsum-monorepo:extending-translations-icons@main)).

-   **`icon`**

    The name of an icon in the icon set of a package (see [Translations and Icons](https://docs.typo3.org/permalink/web-vision/adsum-monorepo:extending-translations-icons@main)).

-   **`route`**

    The route name of the page.

-   **`access`**

    The actors that see the entry.

A reader sees an entry only if admitted by its `access`, and a group only if it has a visible entry. Give an entry
the same access as its page.

## Groups {#groups}

The groups are fixed and shown in this order:

-   `home`, shown as **Overview**
-   `myTime`, shown as **My time**
-   `team`, shown as **Team**
-   `organisation`, shown as **Organisation**
-   `administration`, shown as **Administration**

Choose the group by the audience of the page.

## Top bar items {#top-bar-items}

A package can add custom elements to the top bar, left of the notification bell, such as the clock of the attendance
package. Implement `TopBarItems` and return the tag names:

```php
use WebVision\Adsum\Core\Shared\Navigation\TopBarItems;

final readonly class ClockTopBar implements TopBarItems
{
    public function itemsFor(User $reader, CompanyId $companyId): iterable
    {
        yield 'tt-clock';
    }
}
```

The class decides whether its elements apply to the reader in that company. Define the custom element in the entry
module of the package (see [Frontend](https://docs.typo3.org/permalink/web-vision/adsum-monorepo:extending-frontend@main)).

## Actors {#actors}

These actors are valid in `#[Access]`, in `x-access` of the API contract and in navigation entries:

-   **`public`**

    Anyone, without login.

-   **`anyEmployee`**

    Any logged-in employee of the company.

-   **`self`**

    A logged-in user acting on their own data.

-   **`participant`, `managerInScope`, `approver`**

    A logged-in user related to the subject: a participant of the record, a manager of the person in their reporting
    line, or an approver of the request. The action checks the relationship in a voter or a scoped query.

-   **Derived actors of packages, such as `projectManager`**

    Registered with `#[AsAccessActor(name: 'projectManager', package: 'adsum-projects')]` on the class that
    decides it from current data. A name may be registered once and must not be a core actor; an actor no installed
    package registers is refused. Core operations use core actors only.

-   **`hr`, `admin`**

    Holders of the role in the company of the request. The role is checked before the action runs.

## The `#[Access]` attribute {#the-access-attribute}

Every controller action declares who may call it with `#[Access]`:

```php
use WebVision\Adsum\Core\Shared\Security\Access;

#[Route('/team/roster', name: 'app_roster', methods: ['GET'])]
#[Access('managerInScope', 'hr')]
public function roster(): Response
{
    // ...
}
```

The attribute goes on a class or a method and takes one or more actors. An action without `#[Access]` answers
403.

## OpenAPI `x-access` {#openapi-x-access}

Every operation of the API contract declares the same actors in `x-access` (see [API](https://docs.typo3.org/permalink/web-vision/adsum-monorepo:extending-api@main)):

```yaml
workingTimeModels:
  get:
    operationId: listWorkingTimeModels
    x-access:
    - anyEmployee
    - hr
    - admin
```

An API route declares exactly the actors its operation lists.

## Data categories of person fields {#data-categories-of-person-fields}

A class that describes a person, such as an API resource, an export or a report row, is marked with
`#[PersonResource]`. Each of its properties carries a `#[DataCategory]`:

```php
use WebVision\Adsum\Core\Shared\Security\Category;
use WebVision\Adsum\Core\Shared\Security\DataCategory;
use WebVision\Adsum\Core\Shared\Security\PersonResource;

#[PersonResource]
final readonly class DirectoryEntryResource
{
    public function __construct(
        #[DataCategory(Category::Directory)]
        public string $displayName,
        // ...
    ) {}
}
```

The category decides who may read a property:

-   **`directory`**

    Everyone in the company.

-   **`workData`**

    The person, their managers in scope and HR.

-   **`personal`**

    The person and HR.

-   **`hrInternal`**

    HR only.

The schema in the OpenAPI contract names the same category with `x-data-category`:

```yaml
DirectoryEntry:
  type: object
  properties:
    displayName:
      type: string
      x-data-category: directory
```
