Please have a look at the B2BContextTrait first.

Why is the EmployeePermissionTrait useful for your individual extension?

With the EmployeePermissionTrait you can easily check in your PHP code whether the logged-in employee has the required rights.

What are the possible functions:



Check the permission of an employee: Example code: $this->checkB2bPlatformPermission([Permissions::EMPLOYEE_PERMISSION_VIEW_ALL_ORDERS], $context);


Return of the EmployeeRoleEntity, if a role is stored accordingly. Example:

$role= $this->getEmployeeRole($context);

Note (Alert): You must always pass the SalesChannelContext as a parameter. How to use the trait, please see the B2BContextTrait.