2022-06-17 17:51:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Roles Routes
|
|
|
|
*/
|
|
|
|
return [
|
2022-08-31 15:02:43 +02:00
|
|
|
[
|
|
|
|
'pattern' => 'roles',
|
|
|
|
'method' => 'GET',
|
|
|
|
'action' => function () {
|
|
|
|
$kirby = $this->kirby();
|
|
|
|
|
2022-12-19 14:56:05 +01:00
|
|
|
return match ($kirby->request()->get('canBe')) {
|
|
|
|
'changed' => $kirby->roles()->canBeChanged(),
|
|
|
|
'created' => $kirby->roles()->canBeCreated(),
|
|
|
|
default => $kirby->roles()
|
|
|
|
};
|
2022-08-31 15:02:43 +02:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => 'roles/(:any)',
|
|
|
|
'method' => 'GET',
|
|
|
|
'action' => function (string $name) {
|
|
|
|
return $this->kirby()->roles()->find($name);
|
|
|
|
}
|
|
|
|
]
|
2022-06-17 17:51:59 +02:00
|
|
|
];
|