Skip to content

Commit d991cce

Browse files
author
Travis CI
committed
Travis CI - [ci skip] - automatic dist folder
1 parent e44f641 commit d991cce

File tree

3 files changed

+178
-6
lines changed

3 files changed

+178
-6
lines changed

dist/kuzzle.js

Lines changed: 174 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,13 @@ Kuzzle.prototype.checkToken = function (token, callback) {
773773

774774
this.callbackRequired('Kuzzle.checkToken', callback);
775775

776-
this.query({controller: 'auth', action: 'checkToken'}, request, {}, callback);
776+
this.query({controller: 'auth', action: 'checkToken'}, request, {queuable: false}, function (err, response) {
777+
if (err) {
778+
return callback(err);
779+
}
780+
781+
callback(null, response.result);
782+
});
777783

778784
return self;
779785
};
@@ -2891,6 +2897,9 @@ function KuzzleProfile(kuzzleSecurity, id, content) {
28912897
// private properties
28922898
deleteActionName: {
28932899
value: 'deleteProfile'
2900+
},
2901+
updateActionName: {
2902+
value: 'updateProfile'
28942903
}
28952904
});
28962905

@@ -3090,6 +3099,9 @@ function KuzzleRole(kuzzleSecurity, id, content) {
30903099
// private properties
30913100
deleteActionName: {
30923101
value: 'deleteRole'
3102+
},
3103+
updateActionName: {
3104+
value: 'updateRole'
30933105
}
30943106
});
30953107

@@ -3311,6 +3323,46 @@ KuzzleSecurity.prototype.createRole = function (id, content, options, cb) {
33113323
}
33123324
};
33133325

3326+
3327+
/**
3328+
* Update a role in Kuzzle.
3329+
*
3330+
* @param {string} id - role identifier
3331+
* @param {object} content - a plain javascript object representing the role's modification
3332+
* @param {object} [options] - (optional) arguments
3333+
* @param {responseCallback} [cb] - (optional) Handles the query response
3334+
*/
3335+
KuzzleSecurity.prototype.updateRole = function (id, content, options, cb) {
3336+
var
3337+
self = this,
3338+
data = {},
3339+
action = 'updateRole';
3340+
3341+
if (!id || typeof id !== 'string') {
3342+
throw new Error('KuzzleSecurity.updateRole: cannot update a role without a role ID');
3343+
}
3344+
3345+
if (!cb && typeof options === 'function') {
3346+
cb = options;
3347+
options = null;
3348+
}
3349+
3350+
data._id = id;
3351+
data.body = content;
3352+
3353+
if (cb) {
3354+
self.kuzzle.query(this.buildQueryArgs(action), data, options, function (err, res) {
3355+
if (err) {
3356+
return cb(err);
3357+
}
3358+
3359+
cb(null, res.result._id);
3360+
});
3361+
} else {
3362+
self.kuzzle.query(this.buildQueryArgs(action), data);
3363+
}
3364+
};
3365+
33143366
/**
33153367
* Delete role.
33163368
*
@@ -3503,6 +3555,46 @@ KuzzleSecurity.prototype.createProfile = function (id, content, options, cb) {
35033555
}
35043556
};
35053557

3558+
3559+
/**
3560+
* Update a profile in Kuzzle.
3561+
*
3562+
* @param {string} id - profile identifier
3563+
* @param {object} content - a plain javascript object representing the profile's modification
3564+
* @param {object} [options] - (optional) arguments
3565+
* @param {responseCallback} [cb] - (optional) Handles the query response
3566+
*/
3567+
KuzzleSecurity.prototype.updateProfile = function (id, content, options, cb) {
3568+
var
3569+
self = this,
3570+
data = {},
3571+
action = 'updateProfile';
3572+
3573+
if (!id || typeof id !== 'string') {
3574+
throw new Error('KuzzleSecurity.updateProfile: cannot update a profile without a profile ID');
3575+
}
3576+
3577+
if (!cb && typeof options === 'function') {
3578+
cb = options;
3579+
options = null;
3580+
}
3581+
3582+
data._id = id;
3583+
data.body = content;
3584+
3585+
if (cb) {
3586+
self.kuzzle.query(this.buildQueryArgs(action), data, options, function (err, res) {
3587+
if (err) {
3588+
return cb(err);
3589+
}
3590+
3591+
cb(null, res.result._id);
3592+
});
3593+
} else {
3594+
self.kuzzle.query(this.buildQueryArgs(action), data);
3595+
}
3596+
};
3597+
35063598
/**
35073599
* Delete profile.
35083600
*
@@ -3692,6 +3784,46 @@ KuzzleSecurity.prototype.createUser = function (id, content, options, cb) {
36923784
}
36933785
};
36943786

3787+
3788+
/**
3789+
* Update an user in Kuzzle.
3790+
*
3791+
* @param {string} id - user identifier
3792+
* @param {object} content - a plain javascript object representing the user's modification
3793+
* @param {object} [options] - (optional) arguments
3794+
* @param {responseCallback} [cb] - (optional) Handles the query response
3795+
*/
3796+
KuzzleSecurity.prototype.updateUser = function (id, content, options, cb) {
3797+
var
3798+
self = this,
3799+
data = {},
3800+
action = 'updateUser';
3801+
3802+
if (!id || typeof id !== 'string') {
3803+
throw new Error('KuzzleSecurity.updateUser: cannot update an user without an user ID');
3804+
}
3805+
3806+
if (!cb && typeof options === 'function') {
3807+
cb = options;
3808+
options = null;
3809+
}
3810+
3811+
data._id = id;
3812+
data.body = content;
3813+
3814+
if (cb) {
3815+
self.kuzzle.query(this.buildQueryArgs(action), data, options, function (err, res) {
3816+
if (err) {
3817+
return cb(err);
3818+
}
3819+
3820+
cb(null, res.result._id);
3821+
});
3822+
} else {
3823+
self.kuzzle.query(this.buildQueryArgs(action), data);
3824+
}
3825+
};
3826+
36953827
/**
36963828
* Delete user.
36973829
*
@@ -3777,7 +3909,7 @@ function KuzzleSecurityDocument(kuzzleSecurity, id, content) {
37773909
return kuzzleSecurity.kuzzle.bluebird.promisifyAll(this, {
37783910
suffix: 'Promise',
37793911
filter: function (name, func, target, passes) {
3780-
var whitelist = ['delete'];
3912+
var whitelist = ['delete', 'update'];
37813913

37823914
return passes && whitelist.indexOf(name) !== -1;
37833915
}
@@ -3853,6 +3985,43 @@ KuzzleSecurityDocument.prototype.delete = function (options, cb) {
38533985
});
38543986
};
38553987

3988+
/**
3989+
* Update the current KuzzleSecurityDocument into Kuzzle.
3990+
*
3991+
* @param {object} content - Content to add to KuzzleSecurityDocument
3992+
* @param {object} [options] - Optional parameters
3993+
* @param {responseCallback} [cb] - Handles the query response
3994+
*/
3995+
KuzzleSecurityDocument.prototype.update = function (content, options, cb) {
3996+
var
3997+
data = {},
3998+
self = this;
3999+
4000+
if (typeof content !== 'object') {
4001+
throw new Error('Parameter "content" must be a object');
4002+
}
4003+
4004+
if (options && cb === undefined && typeof options === 'function') {
4005+
cb = options;
4006+
options = null;
4007+
}
4008+
4009+
data._id = self.id;
4010+
data.body = content;
4011+
4012+
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs(this.updateActionName), data, options, function (error) {
4013+
if (error) {
4014+
return cb ? cb(error) : false;
4015+
}
4016+
4017+
self.setContent(content, false);
4018+
4019+
if (cb) {
4020+
cb(null, self);
4021+
}
4022+
});
4023+
};
4024+
38564025
module.exports = KuzzleSecurityDocument;
38574026
},{}],11:[function(require,module,exports){
38584027
var
@@ -3873,6 +4042,9 @@ function KuzzleUser(kuzzleSecurity, id, content) {
38734042
// private properties
38744043
deleteActionName: {
38754044
value: 'deleteUser'
4045+
},
4046+
updateActionName: {
4047+
value: 'updateUser'
38764048
}
38774049
});
38784050

0 commit comments

Comments
 (0)