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

@contiamo/resource-role-assigner

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contiamo/resource-role-assigner

This project allows our UIs to assign roles for a given user, group or API token (called a _principal_) _on_ a given resource: like a Bundle in Labs or a Data Source in Pantheon.

  • 0.4.1
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
4
Weekly downloads
 
Created
Source

Resource Role Assigner

This project allows our UIs to assign roles for a given user, group or API token (called a principal) on a given resource: like a Bundle in Labs or a Data Source in Pantheon.

In essence, this tool (expressed as a Modal window), allows a user to "make Peter an Admin of Catalog 123" in a user-friendly way.

  • Getting Started
  • Contributing

Getting Started

  1. npm install @contiamo/resource-role-assigner
  2. Consider the following use-case from Pantheon
import React, { useState } from "react"
import ResourceRoleAssigner from "@contiamo/resource-role-assigner"

const MyComponent = ({ catalog, dataSource, me }) => {
    const [modalState, setModalState] = useState(false);
    const availableRoles: ["Reader", "Editor", "Viewer"] = ["Reader", "Editor", "Viewer];

    return (<ResourceRoleAssigner
        onClose={() => setModalState(false)}
        defaultRole="Editor"
        roles={availableRoles}
        resource={{
            name: catalog.name,
            permissionsUrl: `${getConfig("pantheon.backend")}/catalogs/${catalog.id}/dataSources/${dataSource.id}/permissions`,
            requestOptions: {
                headers: {
                    "x-double-cookie": Cookies.get("double-cookie"),
                },
                credentials: "include",
            },
        }}
        idp={{
            url: `${getConfig("auth")}/v2/${me.tenant.id}`,
            usersUrl: `${getConfig("auth")}/v2/tenants/${me.tenant.id}/users`,
            groupsUrl: `${getConfig( "auth")}/v2/tenants/${me.tenant.id}/realms/${catalog.id}/groups`,
        }}
    />)
}

Contributing

This project uses Operational Scripts and has a familiar tooling set up. To contribute to this project, simply:

  1. git clone this repo,
  2. cd resource-role-assigner
  3. npm install
  4. code . or vim or spin up your editor of choice.
  5. Go to town.

As usual, issues and pull requests are enabled in case any help is needed or discussions are to be had.

Happy coding!

FAQs

Package last updated on 25 Mar 2019

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