2021-10-29 18:05:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Content Lock Routes
|
|
|
|
*/
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/lock',
|
|
|
|
'method' => 'GET',
|
2021-11-18 17:44:47 +01:00
|
|
|
/**
|
|
|
|
* @deprecated 3.6.0
|
|
|
|
* @todo Remove in 3.7.0
|
|
|
|
*/
|
2021-10-29 18:05:46 +02:00
|
|
|
'action' => function (string $path) {
|
2021-11-18 17:44:47 +01:00
|
|
|
deprecated('The `GET (:all)/lock` API endpoint has been deprecated and will be removed in 3.7.0');
|
|
|
|
|
2021-10-29 18:05:46 +02:00
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return [
|
|
|
|
'supported' => true,
|
|
|
|
'locked' => $lock->get()
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
|
|
|
'supported' => false,
|
|
|
|
'locked' => null
|
|
|
|
];
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/lock',
|
|
|
|
'method' => 'PATCH',
|
|
|
|
'action' => function (string $path) {
|
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return $lock->create();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/lock',
|
|
|
|
'method' => 'DELETE',
|
|
|
|
'action' => function (string $path) {
|
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return $lock->remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/unlock',
|
|
|
|
'method' => 'GET',
|
2021-11-18 17:44:47 +01:00
|
|
|
/**
|
|
|
|
* @deprecated 3.6.0
|
|
|
|
* @todo Remove in 3.7.0
|
|
|
|
*/
|
2021-10-29 18:05:46 +02:00
|
|
|
'action' => function (string $path) {
|
2021-11-18 17:44:47 +01:00
|
|
|
deprecated('The `GET (:all)/unlock` API endpoint has been deprecated and will be removed in 3.7.0');
|
|
|
|
|
|
|
|
|
2021-10-29 18:05:46 +02:00
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return [
|
|
|
|
'supported' => true,
|
|
|
|
'unlocked' => $lock->isUnlocked()
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
|
|
|
'supported' => false,
|
|
|
|
'unlocked' => null
|
|
|
|
];
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/unlock',
|
|
|
|
'method' => 'PATCH',
|
|
|
|
'action' => function (string $path) {
|
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return $lock->unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'pattern' => '(:all)/unlock',
|
|
|
|
'method' => 'DELETE',
|
|
|
|
'action' => function (string $path) {
|
|
|
|
if ($lock = $this->parent($path)->lock()) {
|
|
|
|
return $lock->resolve();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
];
|