npm.io
3.1.5 • Published 2 years ago

@types/easy-rbac

Licence
MIT
Version
3.1.5
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/easy-rbac

Summary

This package contains type definitions for easy-rbac (https://github.com/DeadAlready/easy-rbac).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/easy-rbac.

index.d.ts

interface RoleObject {
    name: string;
    when: (params: object) => Promise<boolean>;
}

interface Roles {
    [key: string]: {
        can: Array<string | RoleObject>;
        inherits?: string[] | undefined;
    };
}

type Options = Roles | (() => Promise<Roles>) | Promise<Roles>;

declare class RBAC {
    constructor(opts: Options);
    can(role: string | string[] | Roles[], operation: string, params?: object): Promise<boolean>;
    static create(opts: Options): RBAC;
}

export = RBAC;

Additional Details

  • Last updated: Mon, 06 Nov 2023 2205 GMT
  • Dependencies: none

Credits

These definitions were written by .