npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strapi-plugin-public-permissions

v0.2.2

Published

A plugin to automate the creation of public permissions for your chosen content types.

Downloads

982

Readme

Strapi Plugin: Public Permissions

A plugin to automate the creation of public permissions for your chosen API content types and plugins.

Installation

npm i strapi-plugin-public-permissions
yarn add strapi-plugin-public-permissions

Now, in your Strapi project, add the following in ./config/plugins.js:

module.exports = {
  "public-permissions": {
    enabled: true,
    config: {
      verbose: true,
      actions: {
        "*": ["find", "findOne"],
      },
      plugins: {
        "users-permissions.auth": ["callback", "connect", "register"],
        "users-permissions.permissions": [],
        "users-permissions.role": [],
        "users-permissions.user": ["me"],
      },
    },
  },
};

Configuration

actions

You can choose which permissions to apply to which content types by editing the actions object in the plugin config.

Set rules for all your custom content types (anything in ./src/api/) by using the wildcard *:

  {
    "actions": {
      "*": ["find", "findOne"],
    }
  }

You can also specify permissions for specific content types, which will override the wildcard rules. Use the singularName name for your content type, which is the name of its folder in ./src/api/, and is usually lower-kebab-case:

  {
    "actions": {
      "article": ["find", "findOne", "create", "update", "delete"],
      "category": ["find", "findOne"],
    }
  }

To remove public permissions for a content type, set the value to an empty array:

  {
    "actions": {
      "*": ["find", "findOne"],
      "private-content-type": [],
    }
  }

plugins

Plugins work similarly to actions, except there is no wildcard option.

To add a plugin permission, in the configuration you must specify the full model path, such as email.email, i18n.locales, users-permissions.auth, users-permissions.role, and so on.

Then, as for actions, you can specify an array of permissions to apply to that plugin.

For example:

  {
    "plugins": {
      "email.email": ["send"],
      "i18n.locales": ["listLocales"],
    }
  }

Note that any permissions not specified in the array for a particular model will be removed. So, in the above example, the email.email plugin will only have the send permission, and the i18n.locales plugin will only have the listLocales permission.

To remove all public permissions for a plugin, set the value to an empty array:

  {
    "plugins": {
      "email.email": [],
    }
  }

If you set one plugin's model to be an empty array, it will remove all permissions for that specific model, but the plugin’s other permissions will be unaffected. For example, if you set the users-permissions.permissions plugin to be an empty array, users-permissions.role will not be affected as that is a different model.

verbose

To see info logs from the plugin in your terminal, set verbose to true in the plugin config:

  {
    "verbose": true,
  }

The default value is false.

License

MIT License

Links