Disable a specific user

20 views
Skip to first unread message

Lisa Riggle

unread,
Jun 13, 2017, 10:25:32 AM6/13/17
to LoopbackJS
Does loopback have a way to disable a user? I don't mean the users endpoint, I mean a specific user within the system. If not, how do manage that particular requirement in projects?

Thanks!
--Lisa

Francois Laforge

unread,
Jun 14, 2017, 11:03:37 AM6/14/17
to loopb...@googlegroups.com
There is no "active" or "enabled" property for the user by default.  Here's what you could do:

If you created custom roles in your application, you could just override the user model and add an "isActive" property, then check if is active when the role is called

Alternatively, create a middleware after authentication.  Loopback authenticates the user, then you catch the reply and do a 2nd authentication to see if the current user is active or not.  return an error if not.

Hope that helps

F
Reply all
Reply to author
Forward
0 new messages