Add app.isAuthEnabled.

The flag is set by `app.enableAuth` and can be used to detect
whether the access control is enabled.
This commit is contained in:
Miroslav Bajtoš 2014-02-05 18:46:22 +01:00
parent d2adda5f29
commit 38f4748021
2 changed files with 11 additions and 1 deletions

View File

@ -305,7 +305,9 @@ app.enableAuth = function() {
next();
}
});
}
this.isAuthEnabled = true;
};
/**
* Initialize an application from an options object or a set of JSON and JavaScript files.

View File

@ -400,6 +400,14 @@ describe('app', function() {
});
});
describe('enableAuth', function() {
it('should set app.isAuthEnabled to true', function() {
expect(app.isAuthEnabled).to.not.equal(true);
app.enableAuth();
expect(app.isAuthEnabled).to.equal(true);
});
});
describe('app.get("/", loopback.status())', function () {
it('should return the status of the application', function (done) {
var app = loopback();