Commit Graph

3 Commits

Author SHA1 Message Date
Eric 9fe084fffd Enable multiple user models
Allow LoopBack applications to configure multiple User models and share
the same AccessToken model.

To enable this feature:

1) In your custom AccessToken model:

 - add a new property "principalType" of type "string".
 - configure the relation "belongsTo user" as polymorphic,
   using "principalType" as the discriminator

2) In your User models:

 - Configure the "hasMany accessTokens" relation as polymorphic,
   using "principalType" as the discriminator

When creating custom Role and Principal instances, set your
User model's name as the value of "prinicipalType".
2017-02-02 09:42:30 +01:00
Simon Ho dcc58a9d50 Need index on principalId for performance. (#2883) 2016-10-21 16:13:16 -07:00
Miroslav Bajtoš e9c86163aa models: move RoleMapping def into its own files 2014-10-14 09:04:43 +02:00