No description
  • PHP 96.3%
  • JavaScript 3.3%
  • CSS 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-03-24 14:45:38 +01:00
assets/css locks and unlocks records with open update form 2023-07-11 18:27:03 +02:00
behaviors applies jsonable fix and saveWithoutLock to behaviour 2025-03-24 14:45:38 +01:00
lang WIP: implementing pending changes 2024-09-09 15:20:07 +02:00
models makes pending changes actually work 2024-09-10 10:28:08 +02:00
partials adds unlock record button 2023-07-12 18:00:54 +02:00
traits correctly stores jsonable attributes in pending changes 2025-03-21 08:12:22 +01:00
updates fixes errors with to long table indexes 2024-09-10 13:11:41 +02:00
composer.json adds compose json 2023-09-06 10:22:16 +02:00
Plugin.php makes max age setting adjustable using system settings 2023-07-13 10:16:10 +02:00
README.md typo fix in readme 2023-09-11 13:40:23 +02:00

Lock Records plugin for WinterCMS

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

  1. Just add the trait or the behavior:
class MyModel {
    use \StudioBosco\LockRecords\Traits\Lockable;

    // or

    public $implement = [
        \StudioBosco\LockRecords\Behaviors\LockableModel::class,
    ];

    ...
}
  1. 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,
    ];

    ...
}
  1. Customize the duration after which records get unlocked automatically by visiting backend/system/settings/update/studiobosco/lockrecords/settings. It is 10 minutes by default.

  2. Set permissions to manually unlock records if desired.