2.0.3 • Published 2 years ago

@permify/permify-service-js v2.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@permify/permify-service-js

npm Twitter URL

Javascript service of Permify for checking access controls in applications/modules that are connected with Permify.

Installation

Use npm to install:

npm install @permify/permify-service-js

How to use

isAuthorizedPermify(policyName, resourceId, resourceType)

isAuthorizedPermify is a function that returns a Promise which resolves with true if the user is authorized for action with the given parameters, if not it resolves with false.

Parameters

  • policyName (mandatory) \ Custom permify policy name.

  • resourceId (optional) \ Id of resource, mandatory if any resource used or accessed when creating a rule.

  • resourceType (optional) \ Type or name of resource, mandatory if any resource used or accessed when creating a rule.

import { PermifyService } from "@permify/permify-service-js";

// initialize the service
const permifyService = new PermifyService();

permifyService.isAuthorizedPermify('post-edit', '91', 'post')
    .then(() => {
        // user is authorized
    });

Or using with async/await:

import { PermifyService } from "@permify/permify-service-js";

// initialize the service
const permifyService = new PermifyService();

if (await permifyService.isAuthorizedPermify('post-edit', '91', 'post')) {
    // user is authorized
}

Documentation

https://docs.permify.co/docs/intro

Contact Us

info@permify.co \ hello@permify.co

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.0.2

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago