-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from strongloop/feature/hidden-properties
Feature/hidden properties
- Loading branch information
Showing
7 changed files
with
61 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ var properties = { | |
}; | ||
|
||
var options = { | ||
hidden: ['password'], | ||
acls: [ | ||
{ | ||
principalType: ACL.ROLE, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var loopback = require('../'); | ||
|
||
describe('hidden properties', function () { | ||
beforeEach(function (done) { | ||
var app = this.app = loopback(); | ||
var Product = this.Product = app.model('product', { | ||
options: {hidden: ['secret']}, | ||
dataSource: loopback.memory() | ||
}); | ||
app.use(loopback.rest()); | ||
|
||
Product.create( | ||
{name: 'pencil', secret: 'secret'}, | ||
done | ||
); | ||
}); | ||
|
||
it('should hide a property remotely', function (done) { | ||
request(this.app) | ||
.get('/products') | ||
.expect('Content-Type', /json/) | ||
.expect(200) | ||
.end(function(err, res){ | ||
if(err) return done(err); | ||
var product = res.body[0]; | ||
assert.equal(product.secret, undefined); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,5 +66,4 @@ describe('remoting - integration', function () { | |
}); | ||
}); | ||
|
||
}) | ||
; | ||
}); |