Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/plugin-permission-node

Package Overview
Dependencies
Maintainers
3
Versions
1081
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-permission-node

Common permission and authorization utilities for backend plugins

  • 0.8.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @backstage/plugin-permission-node?

@backstage/plugin-permission-node is a plugin for the Backstage platform that provides a framework for managing permissions and access control within a Backstage application. It allows developers to define and enforce permissions for various resources and actions, ensuring that only authorized users can perform certain operations.

What are @backstage/plugin-permission-node's main functionalities?

Defining Permissions

This feature allows you to define permissions for specific actions or resources. In this example, a 'read' permission is created for a resource type 'example-resource'.

const { createPermission } = require('@backstage/plugin-permission-node');

const readPermission = createPermission({
  name: 'read',
  attributes: { resourceType: 'example-resource' },
});

Enforcing Permissions

This feature allows you to enforce permissions by checking if a user is authorized to perform a specific action. The 'authorize' function is used to determine if the user has the required permission.

const { authorize } = require('@backstage/plugin-permission-node');

async function checkPermission(user, action) {
  const result = await authorize(user, action);
  if (result.allowed) {
    console.log('Permission granted');
  } else {
    console.log('Permission denied');
  }
}

Permission Policies

This feature allows you to create policies that group multiple permissions together. In this example, an 'admin' policy is created that grants both 'read' and 'write' permissions for the 'example-resource' resource type.

const { createPolicy } = require('@backstage/plugin-permission-node');

const adminPolicy = createPolicy({
  name: 'admin',
  description: 'Admin policy with full access',
  rules: [
    { action: 'read', resourceType: 'example-resource' },
    { action: 'write', resourceType: 'example-resource' },
  ],
});

Other packages similar to @backstage/plugin-permission-node

Keywords

FAQs

Package last updated on 19 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc