Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@blackbox-vision/ra-rbac
Advanced tools
Role based Access Control for React Admin
.
You can install this library via NPM or YARN.
npm i @blackbox-vision/ra-rbac
yarn add @blackbox-vision/ra-rbac
You need to have fine grained permissions over your React Admin
app.
The usage is really simple:
canActivate
function like the following:// canActivate.ts
import { Permission } from "@blackbox-vision/ra-rbac";
export const canActivate = (
permissions: Permission[] | any,
resource: string,
action: string,
field?: string
) => {
// Your can activate logic
return true;
};
RbacProvider
and RbacResource
and wrap your React Admin
with it:// App.tsx
import React from "react";
import { Admin } from "react-admin";
import jsonServerProvider from "ra-data-json-server";
import {
RbacProvider,
RbacResource as Resource,
} from "@blackbox-vision/ra-rbac";
import { canActivate } from "./canActivate";
export const App = () => {
const dataProvider = jsonServerProvider(
"https://jsonplaceholder.typicode.com"
);
return (
<RbacProvider canActivate={canActivate}>
<Admin dataProvider={dataProvider}>
<Resource name="users" list={ListGuesser} />
</Admin>
</RbacProvider>
);
};
App.displayName = "App";
RbacProvider
has the following props:
Properties | Types | Default Value | Description |
---|---|---|---|
canActivate | Function | (p, r, a, f) => true | Logic to test if a user can perform an specific action or visualize an specific field |
RbacResource
has the same props as RA Resource
.
Please, open an issue following one of the issues templates. We will do our best to fix them.
If you want to contribute to this project see contributing for more information.
Distributed under the MIT license. See LICENSE for more information.
FAQs
RBAC support for React Admin
The npm package @blackbox-vision/ra-rbac receives a total of 10 weekly downloads. As such, @blackbox-vision/ra-rbac popularity was classified as not popular.
We found that @blackbox-vision/ra-rbac demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.