New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@availity/authorize

Package Overview
Dependencies
Maintainers
8
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@availity/authorize

Check user permissions to see if the current user is authorized to see your content.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
89
decreased by-55.5%
Maintainers
8
Weekly downloads
 
Created
Source

@availity/authorize

Check user permissions to see if the current user is authorized to see your content.

Installation

npm install @availity/authorize @availity/api-axios @availity/api-core axios --save

Usage

import React from 'react';
import Authorize from '@availity/authorize';
// ... 
<Authorize permissions="1234">
  {/* stuff to render if the user is authorized with permission indicated above */}
</Authorize>
// ...
Authorize (Default export)

Component which validates the user's permissions to determine if they should be able to see the children content.

Props
  • permissions: String, number, or an array containing strings/numbers or an array containing strings/numbers. Required.
    • string/number: The permission ID, eg: '1234'
    • array: The array can contain Permission ID strings as well as other arrays which contain permission ID strings/numbers, eg: ['1234', '2345', ['3456', '4567'], ['5678', '6789']]. The items in deep/nested array indicate permission IDs which must all be granted to the user to be consider authorized, they act as "and". The items in the top array act as 'or', if any are granted to the user the user would be consider authorized. The example ['1234', '2345', ['3456', '4567'], ['5678', '6789']] would be similar '1234' || '2345' || ('3456' && '4567') || ('5678' && '6789')
  • loader: Boolean or node. Optional, default: true. When true, BlockUi will be used when loading the permissions. When a node, that node will be render instead of BlockUi when loading the permissions. When false, nothing will be render when loading the permissions.
  • organizationId: String. Optional, when present, the permission will be validated to ensure it is assigned to the organization.
  • customerId: String. Optional, when present, the permission will be validated to ensure it is assigned to the customer. Note: Cannot be used in combination with the organizationId prop
  • region: String or boolean. Optional, default: true. When a string, the permission will be validated to ensure it is assigned in the region. When true, the current region will be used.
  • unauthorized: Node. Optional. The content which will be render when the user does not have the permissions required.
  • children: Node. Required. The content which will be render when the user does have the permissions required.
  • negate: Boolean. Optional, default false. negation the authorization (if the user does have the permissions specified, they will be "unauthorized" (shown the unauthorized prop content) and if the do not have the permissions specified, they will be "authorized" and able to see the children content)
Authorize Usage
import React from 'react';
import Authorize from '@availity/authorize';
// ... 
<Authorize permissions={['1234', '2345', ['3456', '4567'], ['5678', '6789']]} organizationId="1495">
  {/* ... */}
</Authorize>
// ...

Keywords

FAQs

Package last updated on 08 Feb 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