hsynlms / fastify-guard

A simple user role and scope check plugin to protect endpoints for Fastify
MIT License
49 stars 9 forks source link

Wrong documentation #13

Closed DesimirDimitrov closed 11 months ago

DesimirDimitrov commented 1 year ago

In the README.md

This code doesn't work:

{ preHandler: [fastify.guard.role(['cto', 'admin'])] },

Instead it should be without []

{ preHandler: [fastify.guard.role('cto', 'admin')] },

Pustinyak commented 1 year ago

role(['editor', 'admin']) - can only be called by users who have 'editor' AND 'admin' role role('editor', 'admin') - can only be called by users who have 'editor' OR 'admin' roles