citeright-sdk-js
Version:
An SDK to connect to the CiteRight API.
42 lines (41 loc) • 1.36 kB
TypeScript
export declare class ACL {
private rules;
/**
* This will get a string of abilities as a JSON encoded object. You can safely store this and use it later
* in "importAbilities" to reconstitute an ACL with abilities.
*
* @returns {string}
*/
exportAbilities(): string;
/**
* Use this to reconstitute a users abilities from a string that was exported from "exportAbilities".
*
* @param {string} abilities
*/
importAbilities(abilities: string): void;
/**
* Use this to verify that a use has an ability.
*
* @param {string} action
* @param {string} subject
* @param filter
* @returns {boolean}
*/
can(action: string, subject: string, filter: any): boolean;
/**
* Use this to get an array of security roles available to the connected user.
*
* @returns {string[]}
*/
getManagableRoles(): any[];
/**
* Use this if you want to throw an error upon failure of a ACL ability check. You can optionally provide a custom
* message. In any case, an Error is thrown.
*
* @param {string} action
* @param {string} subject
* @param filter
* @param {string} message
*/
throwUnless(action: string, subject: string, filter: any, message?: string): void;
}