Middlewares

Definition

A middleware provide a convenient mechanism for filtering HTTP requests entering your application.

You can have more information about middleware in the Laravel official documentation.

CheckPermissions

This middleware checks if the user has the permission to access a route. It checks :

  • If the visiting module is active on the current domain

  • If the user has at least one role that gives him access to the module

  • If the user has the requested capacity or if he's admin

Use uccello.permissions:capbilityName to call this middleware.

Route::get($domainAndModuleParams.'/list', 'Core\ListController@process')
    ->middleware('uccello.permissions:retrieve');

Route::get($domainAndModuleParams.'/edit', 'Core\EditController@process')
    ->middlewre('uccello.permissions:retrieve');

Default capabilities

API capabilities

These capabilities are part of the uccello/uccello-api package but are managed natively by Uccello.

CheckSettingsPanel

This middleware checks if the user can access to the Settings Panel. An user can access to it if at least one of these conditions is true:

  • The user is admin: $user->is_admin === true

  • The user can admin at least one admin module.

Use uccello.settings to call this middleware.

Route::get($domainParam.'/settings/menu/manager', 'Settings\MenuManagerController@process')
    ->defaults('module', 'settings')
    ->middleware('uccello.settings');

Last updated