2021-10-29 18:05:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Roles Routes
|
|
|
|
*/
|
|
|
|
return [
|
2022-08-31 16:08:03 +02:00
|
|
|
[
|
|
|
|
'pattern' => 'roles',
|
|
|
|
'method' => 'GET',
|
|
|
|
'action' => function () {
|
|
|
|
$kirby = $this->kirby();
|
|
|
|
|
2022-12-19 16:26:24 +01:00
|
|
|
return match ($kirby->request()->get('canBe')) {
|
|
|
|
'changed' => $kirby->roles()->canBeChanged(),
|
|
|
|
'created' => $kirby->roles()->canBeCreated(),
|
|
|
|
default => $kirby->roles()
|
|
|
|
};
|
2022-08-31 16:08:03 +02:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => 'roles/(:any)',
|
|
|
|
'method' => 'GET',
|
|
|
|
'action' => function (string $name) {
|
|
|
|
return $this->kirby()->roles()->find($name);
|
|
|
|
}
|
|
|
|
]
|
2021-10-29 18:05:46 +02:00
|
|
|
];
|