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:
parent
f5acf6aebd
commit
32bdeccebf
|
@ -316,8 +316,10 @@ app.enableAuth = function(options) {
|
||||||
g.f('Authentication requires model %s to be defined.', m));
|
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) {
|
for (var name in appModels) {
|
||||||
var candidate = appModels[name];
|
var candidate = appModels[name];
|
||||||
var isSubclass = candidate.prototype instanceof Model;
|
var isSubclass = candidate.prototype instanceof Model;
|
||||||
|
|
Loading…
Reference in New Issue