E
E
E-em2017-06-22 13:04:25
MongoDB
E-em, 2017-06-22 13:04:25

How to make roles for nodejs users?

I’m just starting to learn express, nodejs, and I don’t know how best to create roles for users, I want to do something like on upwork, that is, a client or a freelancer, the client has one interface, the freelancer has another. Maybe there are some tutorials on this topic or your repositories with a similar implementation, if it's not difficult to share :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Volintsev, 2017-06-22
@E-em

In the settings of a specific user, save the sign of his role, and in the middleware check this sign for the current authorized user and change the output for different roles
Here are two examples
https://www.npmjs.com/package/express-roles
https://gist.github .com/joshnuss/37ebaf958fe65a18d4ff

K
kostia_dev, 2017-06-22
@kostia_dev

I think here it is necessary to use middleware
In general, the implementation of roles and rights is not tied to a language or a framework. She is the same everywhere. Look at the packages for the same Laravel and migrate. Or find Express-ready

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question