App Plugins Reference

security-scopes-list

Summary

Security roles consist of security scopes, which can be selected via the multi-select autocomplete in the Roles form (located at the /admin/roles path in the Admin app):

Scopes Multi Autocomplete

This plugin enables adding custom security scopes to the multi-select autocomplete component in the Roles form.

Type

type SecurityScopesListPluginScope = {
title: any;
description: any;
scope: string;
};
type SecurityScopesListPlugin = Plugin & {
type: "security-scopes-list";
scopes:
| SecurityScopesListPluginScope[]
| (() => SecurityScopesListPluginScope[])
| (() => Promise<SecurityScopesListPluginScope[]>);
};

Example

{
type: "security-scopes-list",
name: "security-scopes-list-my-app",
scopes: [
{
scope: "myapp:animals:crud",
title: t`Animals CRUD`,
description: t`Allows the user to perform CRUD operations on animals.`
}
]
}

secure-route-error

Summary

When using a SecureRoute React Component to prevent rendering if the user does not have the appropriate security roles or security scopes, you can create a secure-route-error plugin.

This plugin allows you to customize what will render when a user does not have the permissions required to view a SecureRoute Component.

Type

type SecureRouteErrorPlugin = Plugin & {
render(): React.ReactElement;
};

Example

{
type: "secure-route-error",
name: "secure-route-error-message",
render() {
return <h2>You are not authorized to access this page.</h2>;
}
}
Last updated on by Pavel Denisjuk