Skip to content

Commit 4213e73

Browse files
author
Jeff
committed
changes following @scottinet's remarks
1 parent 58d2f20 commit 4213e73

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

dist/kuzzle.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4211,7 +4211,7 @@ KuzzleSecurity.prototype.profileFactory = function(id, content) {
42114211
* @param {string} id
42124212
* @param {responseCallback} cb - returns Kuzzle's response
42134213
*/
4214-
KuzzleSecurity.prototype.getUser = function (id, cb) {
4214+
KuzzleSecurity.prototype.getUser = function (id, options, cb) {
42154215
var
42164216
data,
42174217
self = this;
@@ -4220,11 +4220,16 @@ KuzzleSecurity.prototype.getUser = function (id, cb) {
42204220
throw new Error('Id parameter is mandatory for getUser function');
42214221
}
42224222

4223+
if (!cb && typeof options === 'function') {
4224+
cb = options;
4225+
options = null;
4226+
}
4227+
42234228
data = {_id: id};
42244229

42254230
self.kuzzle.callbackRequired('KuzzleSecurity.getUser', cb);
42264231

4227-
self.kuzzle.query(this.buildQueryArgs('getUser'), data, {}, function (err, response) {
4232+
self.kuzzle.query(this.buildQueryArgs('getUser'), data, options, function (err, response) {
42284233
if (err) {
42294234
return cb(err);
42304235
}
@@ -4243,15 +4248,13 @@ KuzzleSecurity.prototype.getUser = function (id, cb) {
42434248
* @param {Object} filters - same filters as documents filters
42444249
* @param {responseCallback} [cb] - returns Kuzzle's response
42454250
*/
4246-
KuzzleSecurity.prototype.searchUsers = function (filters, cb) {
4251+
KuzzleSecurity.prototype.searchUsers = function (filters, options, cb) {
42474252
var
42484253
self = this;
42494254

4250-
filters.hydrate = true;
4251-
42524255
self.kuzzle.callbackRequired('KuzzleSecurity.searchUsers', cb);
42534256

4254-
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, {}, function (error, response) {
4257+
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, options, function (error, response) {
42554258
var documents;
42564259

42574260
if (error) {

dist/kuzzle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/kuzzle.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/security/kuzzleSecurity.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ KuzzleSecurity.prototype.profileFactory = function(id, content) {
459459
* @param {string} id
460460
* @param {responseCallback} cb - returns Kuzzle's response
461461
*/
462-
KuzzleSecurity.prototype.getUser = function (id, cb) {
462+
KuzzleSecurity.prototype.getUser = function (id, options, cb) {
463463
var
464464
data,
465465
self = this;
@@ -468,11 +468,16 @@ KuzzleSecurity.prototype.getUser = function (id, cb) {
468468
throw new Error('Id parameter is mandatory for getUser function');
469469
}
470470

471+
if (!cb && typeof options === 'function') {
472+
cb = options;
473+
options = null;
474+
}
475+
471476
data = {_id: id};
472477

473478
self.kuzzle.callbackRequired('KuzzleSecurity.getUser', cb);
474479

475-
self.kuzzle.query(this.buildQueryArgs('getUser'), data, {}, function (err, response) {
480+
self.kuzzle.query(this.buildQueryArgs('getUser'), data, options, function (err, response) {
476481
if (err) {
477482
return cb(err);
478483
}
@@ -491,15 +496,18 @@ KuzzleSecurity.prototype.getUser = function (id, cb) {
491496
* @param {Object} filters - same filters as documents filters
492497
* @param {responseCallback} [cb] - returns Kuzzle's response
493498
*/
494-
KuzzleSecurity.prototype.searchUsers = function (filters, cb) {
499+
KuzzleSecurity.prototype.searchUsers = function (filters, options, cb) {
495500
var
496501
self = this;
497502

498-
filters.hydrate = true;
499-
503+
if (!cb && typeof options === 'function') {
504+
cb = options;
505+
options = null;
506+
}
507+
500508
self.kuzzle.callbackRequired('KuzzleSecurity.searchUsers', cb);
501509

502-
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, {}, function (error, response) {
510+
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, options, function (error, response) {
503511
var documents;
504512

505513
if (error) {

0 commit comments

Comments
 (0)