✨ We just launched fimo.ai - an AI Website Builder to create websites in minutes - Try it now

Strapi plugin logo for Record Locking

Record Locking

Plugin for locking records so only one user can edit them at same time.

Notum Logo

Record Locking Plugin for Strapi

Avoid concurrent edits on the same record in Strapi. Notify users when a record is being edited by another user, with an optional takeover feature.

contributors last update open issues license

Report Bug or Request Feature


Table of Contents

About the Project

Features

  • Let users know when a record is being edited by another user
  • Prevent concurrent edits on the same record
  • Takeover an entry being edited by another user (optional)

Screenshots

Record Locking Screen Capture

Supported Versions

This plugin is compatible with Strapi v5.x.x and Strapi v4.x.x.

Strapi V5.x.x

This is the primary and recommended version of Strapi. If using Strapi V5, use 2.x.x versions of this plugin. The latest plugin version has been tested with Strapi v5.34.0.

Strapi V4.x.x

If you are using Strapi V4, please use the 1.x.x versions of this plugin. Note that Strapi V4 has reached its end of life and is no longer actively maintained.

We will continue providing critical bug fixes through community contributions, but new features and improvements will be focused on Strapi V5.

Getting Started

Installation

1. Install the plugin via npm or yarn

# NPM
npm i @notum-cz/strapi-plugin-record-locking

# Yarn
yarn add @notum-cz/strapi-plugin-record-locking

2. Enable the plugin in your Strapi config/plugins.[js|ts] file

// config/plugins.ts
export default () => ({
  // -- your other plugins configs --

  'record-locking': {
    enabled: true,
  },
});

3. Update Strapi middleware to enable websocket communication

If you are using websockets for real-time communication, you will need to update Strapi's security middleware. Update your config/middlewares.[js|ts]:

export default [
  'strapi::logger',
  'strapi::errors',
  // Replace `strapi::security` entry with the following configuration:
  // ---- security middleware start ----
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:', 'ws:', 'wss:', 'http:'], // update with your preferred transport
          'img-src': ["'self'", 'data:', 'blob:'],
          'media-src': ["'self'", 'data:', 'blob:'],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ---- security middleware end ----
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];

While optional, it is highly recommended to implement this step to prevent Socket.io from falling back to the HTTP protocol and generating the following error in the web console.

Refused to connect to <protocol>://<url> because it does not appear in the connect-src directive of the Content Security Policy

4. Rebuild Strapi and test the plugin

  yarn build
  yarn start

Plugin Configuration

This plugin has an optional config attribute. Below are the available configuration options:

transports

Array of transport methods for real-time communication. Defaults to ['polling', 'websocket', 'webtransport'] (see transports.ts).

Example:

export default () => ({
  // -- your other plugins configs --

  'record-locking': {
    enabled: true,
    config: {
      transports: ['websocket'],
    },
  },
});

showTakeoverButton

Boolean to show or hide the takeover button in the UI. Defaults to false.

If enabled, the notification dialog will include a "Takeover" button, allowing users to forcibly take over the record being edited by another user. Record Locking Plugin Takeover Feature - Before Takeover

Clicking the button will change the lock ownership. The user who was previously editing the record will be notified that they have lost the lock. Record Locking Plugin Takeover Feature - After Takeover

Example:

export default () => ({
  // -- your other plugins configs --

  'record-locking': {
    enabled: true,
    config: {
      showTakeoverButton: true,
    },
  },
});

include and exclude options

This plugin allows you to specify which content types should have record locking enabled or disabled using include and exclude options. All content types have record locking enabled by default.

  • include: An array of content type UIDs to enable record locking for. If specified, only these content types will have record locking enabled.
  • exclude: An array of content type UIDs to disable record locking for. If specified, these content types will not have record locking enabled.

!IMPORTANT These options are mutually exclusive. You can only use one of them at a time. If you specify both, the include option will take precedence and the exclude option will be ignored.

Example:

export default () => ({
  // -- your other plugins configs --

  'record-locking': {
    enabled: true,
    config: {
      include: ['api::article.article', 'api::blog.blog'], // only these content types will have record locking enabled
      // exclude: ['plugin::users-permissions.user'] // this option will be ignored if `include` is specified
    },
  },
});

Roadmap

We're currently revising the roadmap for this plugin. Stay tuned for updates!

Community

This plugin is maintained by Notum Technologies, a Czech-based Strapi Enterprise Partner.

We're a software agency specializing in custom solutions based on Strapi. We're passionate about sharing our expertise with the open-source community.

This plugin is overseen by Ondřej Jánošík and it has been originally developed by Martin Čapek.

Current maintainer

Dominik Juriga

Contributors

This plugin has been brought to you thanks to the following contributors:

How can Notum help you with your STRAPI project?

✔️ We offer valuable assistance in developing custom STRAPI, web, and mobile apps to fulfill your requirements and goals..
✔️ With a track record of 100+ projects, our open communication and exceptional project management skills provide us with the necessary tools to get your project across the finish line.

To initiate a discussion about your Strapi project, feel free to reach out to us via email at sales@notum.cz. We're here to assist you!

Contributing

Contributions are always welcome! Please follow these steps to contribute:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Install now

npm install @notum-cz/strapi-plugin-record-locking

STATS

25 GitHub stars177 weekly downloads

Last updated

11 days ago

Strapi Version

5.4.0 and above

Author

github profile image for Notum Technologies s.r.o.
Notum Technologies s.r.o.

Useful links

Create your own plugin

Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.