Code Monkey home page Code Monkey logo

strapi-plugin-record-locking's Introduction

Strapi plugin record-locking

This plugin provides the functionality to prevent data loss in cases where multiple users are simultaneously editing the same record within STRAPI v4.

When a user attempts to edit a record that is already being edited, a warning will be displayed.

πŸ™‰ What does the plugin do for you?

βœ… Safeguards against concurrent editing by restricting access to a record to a single user at a time.

βœ… Provides clear visibility of the current editing user, enabling you to easily identify who is working on the record.

πŸ§‘β€πŸ’» Installation

1. Install the plugin with your favourite package manager:

npm i @notum-cz/strapi-plugin-record-locking
yarn add @notum-cz/strapi-plugin-record-locking

2. Create or modify file config/plugins.js and include the following code snippet:

module.exports = ({ env }) => ({
 "record-locking": {
    enabled: true,
  },
});

We use websockets and you can determine the necessary transport yourself:

module.exports = ({ env }) => ({
 "record-locking": {
     enabled: true,
     config: {
         transports: ["websocket"]
     }
  },
});

If you do not specify a transport, the default parameters will be applied:

DEFAULT_TRANSPORTS: ["polling", "websocket", "webtransport"]

3. Enable websocket support by configuring the Strapi middleware.

In the config/middlewares.js file either replace 'strapi::security' with a middleware object (see the example below) or update your existing configuration accordingly.

  1. Ensure that contentSecurityPolicy.directives.connect-src array includes "ws:" and "wss:".
  2. Rebuild Strapi and test record locking features.
  3. You should not encounter any Content Security Policy errors in the console.
module.exports = [
  'strapi::errors',
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:", "ws:", "wss:", "http:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
          ],
          "media-src": ["'self'", "data:", "blob:"],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  'strapi::cors', ...

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


πŸ›£οΈ Road map

Are any of these features significant to you? Please show your support by giving a thumbs up on the linked issues. This will help us assess their priority on the roadmap.

πŸ› Bugs

We manage bugs through GitHub Issues.
If you're interested in helping us, you would be a rock ⭐.

πŸ§” Authors

The main star: Martin Čapek https://github.com/martincapek
Developer: Filip Janko https://github.com/fikoun
Maintainer: OndΕ™ej Mikulčík https://github.com/omikulcik
Project owner: OndΕ™ej JanoΕ‘Γ­k

πŸ’¬ Community

Join our Discord server to discuss new features, implementation challenges or anything related to this plugin.

πŸš€ Created with passion by Notum Technologies

  • Official STRAPI partner and Czech based custom development agency.
  • We're passionate about sharing our expertise with the open source community, which is why we developed this plugin. πŸ–€

βœ”οΈ 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 [email protected]. We're here to assist you!

πŸ”‘ Keywords

strapi-plugin-record-locking's People

Contributors

omikulcik avatar dependabot[bot] avatar martincapek avatar fikoun avatar moucznik avatar ondrej-janosik avatar ihmpavel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.