Skip to content

Commit 6085f57

Browse files
author
Jeff
committed
changes following @scottinet's remarks (bis)
1 parent 4213e73 commit 6085f57

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

dist/kuzzle.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,11 +4008,16 @@ KuzzleSecurity.prototype.roleFactory = function(id, content) {
40084008
* @param {string} id
40094009
* @param {responseCallback} cb - returns Kuzzle's response
40104010
*/
4011-
KuzzleSecurity.prototype.getProfile = function (id, cb) {
4011+
KuzzleSecurity.prototype.getProfile = function (id, options, cb) {
40124012
var
40134013
data,
40144014
self = this;
40154015

4016+
if (!cb && typeof options === 'function') {
4017+
cb = options;
4018+
options = null;
4019+
}
4020+
40164021
if (!id || typeof id !== 'string') {
40174022
throw new Error('Id parameter is mandatory for getProfile function');
40184023
}
@@ -4022,7 +4027,7 @@ KuzzleSecurity.prototype.getProfile = function (id, cb) {
40224027

40234028
self.kuzzle.callbackRequired('KuzzleSecurity.getProfile', cb);
40244029

4025-
self.kuzzle.query(this.buildQueryArgs('getProfile'), data, {}, function (error, response) {
4030+
self.kuzzle.query(this.buildQueryArgs('getProfile'), data, options, function (error, response) {
40264031
if (error) {
40274032
return cb(error);
40284033
}
@@ -4042,13 +4047,18 @@ KuzzleSecurity.prototype.getProfile = function (id, cb) {
40424047
* @param {Object} filters - this object can contains an array `roles` with a list of roles id, a integer `from` and a integer `size`
40434048
* @param {responseCallback} [cb] - returns Kuzzle's response
40444049
*/
4045-
KuzzleSecurity.prototype.searchProfiles = function (filters, cb) {
4050+
KuzzleSecurity.prototype.searchProfiles = function (filters, options, cb) {
40464051
var
40474052
self = this;
40484053

4054+
if (!cb && typeof options === 'function') {
4055+
cb = options;
4056+
options = null;
4057+
}
4058+
40494059
self.kuzzle.callbackRequired('KuzzleSecurity.searchProfiles', cb);
40504060

4051-
self.kuzzle.query(this.buildQueryArgs('searchProfiles'), {body: filters}, {}, function (error, response) {
4061+
self.kuzzle.query(this.buildQueryArgs('searchProfiles'), {body: filters}, options, function (error, response) {
40524062
var documents;
40534063

40544064
if (error) {
@@ -4252,6 +4262,11 @@ KuzzleSecurity.prototype.searchUsers = function (filters, options, cb) {
42524262
var
42534263
self = this;
42544264

4265+
if (!cb && typeof options === 'function') {
4266+
cb = options;
4267+
options = null;
4268+
}
4269+
42554270
self.kuzzle.callbackRequired('KuzzleSecurity.searchUsers', cb);
42564271

42574272
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, options, function (error, response) {

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: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,16 @@ KuzzleSecurity.prototype.roleFactory = function(id, content) {
256256
* @param {string} id
257257
* @param {responseCallback} cb - returns Kuzzle's response
258258
*/
259-
KuzzleSecurity.prototype.getProfile = function (id, cb) {
259+
KuzzleSecurity.prototype.getProfile = function (id, options, cb) {
260260
var
261261
data,
262262
self = this;
263263

264+
if (!cb && typeof options === 'function') {
265+
cb = options;
266+
options = null;
267+
}
268+
264269
if (!id || typeof id !== 'string') {
265270
throw new Error('Id parameter is mandatory for getProfile function');
266271
}
@@ -270,7 +275,7 @@ KuzzleSecurity.prototype.getProfile = function (id, cb) {
270275

271276
self.kuzzle.callbackRequired('KuzzleSecurity.getProfile', cb);
272277

273-
self.kuzzle.query(this.buildQueryArgs('getProfile'), data, {}, function (error, response) {
278+
self.kuzzle.query(this.buildQueryArgs('getProfile'), data, options, function (error, response) {
274279
if (error) {
275280
return cb(error);
276281
}
@@ -290,13 +295,18 @@ KuzzleSecurity.prototype.getProfile = function (id, cb) {
290295
* @param {Object} filters - this object can contains an array `roles` with a list of roles id, a integer `from` and a integer `size`
291296
* @param {responseCallback} [cb] - returns Kuzzle's response
292297
*/
293-
KuzzleSecurity.prototype.searchProfiles = function (filters, cb) {
298+
KuzzleSecurity.prototype.searchProfiles = function (filters, options, cb) {
294299
var
295300
self = this;
296301

302+
if (!cb && typeof options === 'function') {
303+
cb = options;
304+
options = null;
305+
}
306+
297307
self.kuzzle.callbackRequired('KuzzleSecurity.searchProfiles', cb);
298308

299-
self.kuzzle.query(this.buildQueryArgs('searchProfiles'), {body: filters}, {}, function (error, response) {
309+
self.kuzzle.query(this.buildQueryArgs('searchProfiles'), {body: filters}, options, function (error, response) {
300310
var documents;
301311

302312
if (error) {
@@ -504,7 +514,7 @@ KuzzleSecurity.prototype.searchUsers = function (filters, options, cb) {
504514
cb = options;
505515
options = null;
506516
}
507-
517+
508518
self.kuzzle.callbackRequired('KuzzleSecurity.searchUsers', cb);
509519

510520
self.kuzzle.query(this.buildQueryArgs('searchUsers'), {body: filters}, options, function (error, response) {

0 commit comments

Comments
 (0)