studiobosco / wn-lockrecords-plugin
WinterCMS LockRecords Plugin
Requires
- php: >=8.1
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-12-17 12:32:42 UTC
README
Provides lockable records in the backend. Lockabe records can only be edited by a single backend user at the same time. Locked records can be unlocked manually or will be unlocked automatically after a certain amount of time if no editing form is opened.
Usage
This plugin provides the StudioBosco\LockRecords\Traits\Lockable
Model Trait and the StudioBosco\LockRecords\Behaviors\LockRecordsController
controller behavior.
To make a model lockable
- Just add the trait or the behavior:
class MyModel {
use \StudioBosco\LockRecords\Traits\Lockable;
// or
public $implement = [
\StudioBosco\LockRecords\Behaviors\LockableModel::class,
];
...
}
- Add the behavior to the backend controller. It should contain the form and list behaviors.
class MyController extends Backend\Classes\Controller {
/**
* @var array Behaviors that are implemented by this controller.
*/
public $implement = [
\Backend.Behaviors.FormController::class,
\Backend.Behaviors.ListController::class,
\StudioBosco\LockRecords\Behaviors\LockRecordsController::class,
];
...
}
Customize the duration after which records get unlocked automatically by visiting
backend/system/settings/update/studiobosco/lockrecords/settings
. It is 10 minutes by default.Set permissions to manually unlock records if desired.