app.enableAuth: correctly detect attached models

Fix a typo in "app.enableAuth" that caused the method to not detect
the situation when e.g. the built-in User model is already attached
to a datasource.
This commit is contained in:
Miroslav Bajtoš 2016-08-31 15:21:39 +02:00
parent f5acf6aebd
commit 32bdeccebf
1 changed files with 3 additions and 1 deletions

View File

@ -316,8 +316,10 @@ app.enableAuth = function(options) {
g.f('Authentication requires model %s to be defined.', m));
}
if (m.dataSource || m.app) return;
if (Model.dataSource || Model.app) return;
// Find descendants of Model that are attached,
// for example "Customer" extending "User" model
for (var name in appModels) {
var candidate = appModels[name];
var isSubclass = candidate.prototype instanceof Model;