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

@backstage/plugin-permission-common

Package Overview
Dependencies
Maintainers
3
Versions
483
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-permission-common

Isomorphic types and client for Backstage permissions and authorization

  • 0.0.0-nightly-20240817021759
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
194K
decreased by-7.93%
Maintainers
3
Weekly downloads
 
Created

What is @backstage/plugin-permission-common?

@backstage/plugin-permission-common is a package that provides common types and utilities for implementing permission-based access control in Backstage plugins. It helps in defining and managing permissions, rules, and policies to control access to various resources within a Backstage application.

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

Defining Permissions

This feature allows you to define custom permissions for your Backstage plugins. The `createPermission` function is used to create a new permission with a specified name and attributes.

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

const myPermission = createPermission({
  name: 'my-plugin.my-permission',
  attributes: { action: 'read' },
});

Creating Permission Rules

This feature allows you to create rules that determine whether a user has a specific permission. The `createPermissionRule` function is used to define a rule with a name, description, and an apply function that contains the logic for the rule.

const { createPermissionRule } = require('@backstage/plugin-permission-common');

const isUserAdmin = createPermissionRule({
  name: 'is-user-admin',
  description: 'Checks if the user is an admin',
  apply: (resource, user) => user.isAdmin,
});

Evaluating Permissions

This feature allows you to evaluate whether a user has a specific permission for a given resource. The `evaluatePermission` function takes a permission, user, and resource as arguments and returns the evaluation result.

const { evaluatePermission } = require('@backstage/plugin-permission-common');

const result = evaluatePermission(myPermission, user, resource);
console.log(result);

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

Keywords

FAQs

Package last updated on 17 Aug 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