S
S
Sergiy Voytovych2016-02-10 10:55:37
Node.js
Sergiy Voytovych, 2016-02-10 10:55:37

Sails.js different model attribute validation for different user roles?

How to make the model attribute validated differently for the admin and a simple user.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Lewman, 2016-03-24
@ImLoaD

At any level, it is possible to do validation, the rules of which will change depending on which user enters the data.
Firstly, the admin can be shown one form, the user another, seemingly identical but different in front-end validation.
Secondly, you can intercept the data in the controller and, depending on the user in the session, check one way or another.
There is no access to sessions in the model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question