@can-it/operators-nested
Version:
[Documentation](https://can-it.github.io/packages/operators/nested)
28 lines (27 loc) • 1.49 kB
TypeScript
import { Comparator } from '@can-it/types';
import { NestedPattern } from '../types/nested-pattern';
/**
* Ri definition:
* - User X belongs to org Y, the ri would be: `orgs::Y::users::X`
* - Product Z belongs to user X: `orgs::Y::users::X::products::Z`
* - Org Y has payment section: `orgs::Y::payments::payment-id-94kd03`
* - Org Y has settings section: `orgs::Y::settings::setting-id-j8e84`
*
* Use cases and corresponding permissions:
* - Access settings at any organization, including all settings' children resources: `orgs::*::settings`
* - Access users at any organization, including all user's children resources: `orgs::*::users`
* - Access users and their resources on specific org ID: `orgs::Y::users`
* - Access user X on organization Y: `orgs::Y::users::X`
* - Access users, excluding user's children resources at any organization: `orgs::*::users::*`
* - Access users, excluding user's children resources at organization Y: `orgs::Y::users::*`
* - Access products of users at any organization: `orgs::*::users::*::products`
* - Access products of user X at organization Y: `orgs::*::users::X::products`
* - Access product Z of user X at organization Y: `orgs::Y::users::X::products::Z`
*/
export declare class NestedComparator implements Comparator {
private riPattern;
constructor(riPattern?: NestedPattern);
isAllowed(ri: string, permissionRi: string): boolean;
isDenied(reqRi: string, permRi: string): boolean;
private getTestableRi;
}