Navigation and 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.

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 

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:

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

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

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).

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 

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

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

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

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

OpenAPI x-access 

Every operation of the API contract declares the same actors in x-access (see API):

workingTimeModels:
  get:
    operationId: listWorkingTimeModels
    x-access:
    - anyEmployee
    - hr
    - admin
Copied!

An API route declares exactly the actors its operation lists.

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]:

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,
        // ...
    ) {}
}
Copied!

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:

DirectoryEntry:
  type: object
  properties:
    displayName:
      type: string
      x-data-category: directory
Copied!