Skip to content

Add default access permissions to all collections in PayloadCMS

Notifications You must be signed in to change notification settings

Orelo-Software/payload-default-roles

Repository files navigation

Payload Default Roles

Add default roles for access control on all collections.

Options

  • ignoredSlugs: string[] Optional

    An array of the slugs from the collections this plugin should leave untouched.

  • roles: string[] Optional

    An array of the roles this plugin should default access to.
    Default: ["admin", "executive"]

Example

// payload.config.ts
import { buildConfig } from 'payload/config';
import { defaultAccess } from '@orelo/payload-default-roles';

export default buildConfig({
  plugins: [
    defaultAccess(), // Pass nothing to use the default options
  ],
});

Example with Options

export default buildConfig({
  plugins: [
    defaultAccess({
      ignoredSlugs: ['cms-user', 'admin'],
      roles: ['administrator', 'moderator'],
    }),
  ],
});

About

Add default access permissions to all collections in PayloadCMS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published