diff --git a/content/docs/details/custom-plugins/create-policy.png b/content/docs/details/custom-plugins/create-policy.png new file mode 100644 index 000000000..6880fe77f Binary files /dev/null and b/content/docs/details/custom-plugins/create-policy.png differ diff --git a/content/docs/details/custom-plugins/index.md b/content/docs/details/custom-plugins/index.md new file mode 100644 index 000000000..b5ef91005 --- /dev/null +++ b/content/docs/details/custom-plugins/index.md @@ -0,0 +1,52 @@ +--- +title: Using Permissions in Custom Plugins +publishedDate: '2024-12-18T21:00:00.0Z' +description: How to configure and manage permissions and policies for use in Custom Plugins in Roadie. +--- + +## Introduction + +**This feature is currently in the process of being rolled out. If you want access, please contact our support or sales teams.** + +You can choose to make use of custom permissions in Roadie as part of a custom plugin. This tutorial assumes you have already created and published a [custom plugin](/docs/custom-plugins/overview/). + +In order to make use of a custom permission: + +1. Add `@backstage/plugin-permission-react` and `@backstage/plugin-permission-common` to the plugin's `package.json` file. + +2. Add the following code to a React component. + +```tsx +import React from 'react'; +... +import { RequirePermission } from '@backstage/plugin-permission-react'; +import { createPermission } from '@backstage/plugin-permission-common'; + +const permission = createPermission({ + name: 'see-content', + attributes: { + action: "read" + } +}); + +export const ExampleComponent = () => ( + ... + + Not allowed to see-content. + + )}> + + Allowed to see content + + + ... +); +``` + +3. In the Roadie UI, click Administration > Settings > User Management > Policies and "Add Policy". Give the policy a name and description and set the permission to "see-content" as defined by the name in the code above and save. + +![Create policy](create-policy.png) + + +4. Assign the Policy to a role. diff --git a/content/docs/docs-nav.yaml b/content/docs/docs-nav.yaml index e09ea1b82..f89026de1 100644 --- a/content/docs/docs-nav.yaml +++ b/content/docs/docs-nav.yaml @@ -90,10 +90,11 @@ nav: - Accessing public resources: '/docs/details/backend-reading-allow-list/' - Allowlisting Roadie traffic: '/docs/details/allowlisting-roadie-traffic/' - How Roadie connects: '/docs/details/how-roadie-connects/' - - Permissions: + - Permissions: - Introduction: '/docs/details/permissions/' - Roles: '/docs/details/managing-roles/' - Policies: '/docs/details/managing-policies/' + - Custom Plugins: '/docs/details/custom-plugins/' - Proxy Creation: '/docs/details/create-proxy/' - Setting secrets: '/docs/details/setting-secrets/' - TechDocs: