Skip to content

Commit 68fb149

Browse files
author
Anthony Sendra
committed
Merge remote-tracking branch 'origin/release-2.0.2'
2 parents 1254420 + ebf9fd6 commit 68fb149

File tree

6 files changed

+48
-44
lines changed

6 files changed

+48
-44
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*__note:__ the # at the end of lines are the pull request numbers on GitHub*
22

3+
# 2.0.2
4+
5+
* https://github.com/kuzzleio/sdk-javascript/releases/tag/2.0.2
6+
37
# 2.0.0
48

59
* https://github.com/kuzzleio/sdk-javascript/releases/tag/2.0.0

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ then
88
git clone --quiet --branch=${TRAVIS_BRANCH} https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG} travis-build
99
cd travis-build
1010
ln -s ${TRAVIS_BUILD_DIR}/node_modules
11-
grunt
11+
npm run build
1212
git add dist/
1313
git commit -am "Travis CI - [ci skip] - automatic dist folder"
1414
git push origin ${TRAVIS_BRANCH}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kuzzle-sdk",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/security/kuzzleUser.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ KuzzleUser.prototype = Object.create(KuzzleSecurityDocument.prototype, {
4141
*
4242
* @returns {KuzzleUser} this
4343
*/
44-
KuzzleUser.prototype.setProfiles = function (profilesIds) {
45-
if (!Array.isArray(profilesIds) || typeof profilesIds[0] !== 'string') {
46-
throw new Error('Parameter "profilesIds" must be an array of strings');
44+
KuzzleUser.prototype.setProfiles = function (profileIds) {
45+
if (!Array.isArray(profileIds) || typeof profileIds[0] !== 'string') {
46+
throw new Error('Parameter "profileIds" must be an array of strings');
4747
}
4848

49-
this.content.profilesIds = profilesIds;
49+
this.content.profileIds = profileIds;
5050

5151
return this;
5252
};
@@ -62,12 +62,12 @@ KuzzleUser.prototype.addProfile = function (profileId) {
6262
throw new Error('Parameter "profileId" must be a string');
6363
}
6464

65-
if (!this.content.profilesIds) {
66-
this.content.profilesIds = [];
65+
if (!this.content.profileIds) {
66+
this.content.profileIds = [];
6767
}
6868

69-
if (this.content.profilesIds.indexOf(profileId) === -1) {
70-
this.content.profilesIds.push(profileId);
69+
if (this.content.profileIds.indexOf(profileId) === -1) {
70+
this.content.profileIds.push(profileId);
7171
}
7272

7373
return this;
@@ -131,7 +131,7 @@ KuzzleUser.prototype.serialize = function () {
131131
* @return {array} the associated profiles IDs
132132
*/
133133
KuzzleUser.prototype.getProfiles = function () {
134-
return this.content.profilesIds;
134+
return this.content.profileIds;
135135
};
136136

137137
module.exports = KuzzleUser;

test/security/kuzzleSecurity/userMethods.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('KuzzleSecurity user methods', function () {
4747
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
4848
kuzzle.query = queryStub;
4949
error = null;
50-
result = { result: {_id: 'foobar', _source: {profilesIds: ['profile']}}};
50+
result = { result: {_id: 'foobar', _source: {profileIds: ['profile']}}};
5151
expectedQuery = {
5252
action: 'getUser',
5353
controller: 'security',
@@ -60,8 +60,8 @@ describe('KuzzleSecurity user methods', function () {
6060
should(err).be.null();
6161
should(res).be.instanceof(KuzzleUser);
6262

63-
should(res.content.profilesIds).be.an.Array();
64-
should(res.content.profilesIds[0]).be.a.String();
63+
should(res.content.profileIds).be.an.Array();
64+
should(res.content.profileIds[0]).be.a.String();
6565

6666
done();
6767
}));
@@ -72,8 +72,8 @@ describe('KuzzleSecurity user methods', function () {
7272
should(err).be.null();
7373
should(res).be.instanceof(KuzzleUser);
7474

75-
should(res.content.profilesIds).be.an.Array();
76-
should(res.content.profilesIds[0]).be.a.String();
75+
should(res.content.profileIds).be.an.Array();
76+
should(res.content.profileIds[0]).be.a.String();
7777

7878
done();
7979
}));
@@ -104,7 +104,7 @@ describe('KuzzleSecurity user methods', function () {
104104
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
105105
kuzzle.query = queryStub;
106106
error = null;
107-
result = { result: { total: 123, hits: [ {_id: 'foobar', _source: {profilesIds : ['myProfile']}} ]}};
107+
result = { result: { total: 123, hits: [ {_id: 'foobar', _source: {profileIds : ['myProfile']}} ]}};
108108
expectedQuery = {
109109
action: 'searchUsers',
110110
controller: 'security'
@@ -129,8 +129,8 @@ describe('KuzzleSecurity user methods', function () {
129129
res.users.forEach(function (item) {
130130
should(item).be.instanceof(KuzzleUser);
131131

132-
should(item.content.profilesIds).be.an.Array();
133-
should(item.content.profilesIds[0]).be.a.String();
132+
should(item.content.profileIds).be.an.Array();
133+
should(item.content.profileIds[0]).be.a.String();
134134
});
135135

136136
done();
@@ -142,7 +142,7 @@ describe('KuzzleSecurity user methods', function () {
142142
filters = {};
143143

144144
result = { result: { total: 123, hits: [ {_id: 'foobar', _source: {
145-
profilesIds: ['myProfile']
145+
profileIds: ['myProfile']
146146
}}]}};
147147

148148
this.timeout(50);
@@ -159,8 +159,8 @@ describe('KuzzleSecurity user methods', function () {
159159
res.users.forEach(function (item) {
160160
should(item).be.instanceof(KuzzleUser);
161161

162-
should(item.content.profilesIds).be.an.Array();
163-
should(item.content.profilesIds[0]).be.a.String();
162+
should(item.content.profileIds).be.an.Array();
163+
should(item.content.profileIds[0]).be.a.String();
164164
});
165165

166166
done();
@@ -179,7 +179,7 @@ describe('KuzzleSecurity user methods', function () {
179179
filters = {};
180180

181181
result = { result: { total: 123, hits: [ {_id: 'foobar', _source: {
182-
profilesIds: ['myProfile']
182+
profileIds: ['myProfile']
183183
}}]}};
184184

185185
expectedQuery.body = filters;
@@ -199,7 +199,7 @@ describe('KuzzleSecurity user methods', function () {
199199
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
200200
kuzzle.query = queryStub;
201201
error = null;
202-
result = { result: {_id: 'foobar', _source: {profilesIds: ['myRole']}} };
202+
result = { result: {_id: 'foobar', _source: {profileIds: ['myRole']}} };
203203
expectedQuery = {
204204
action: 'createUser',
205205
controller: 'security'
@@ -271,7 +271,7 @@ describe('KuzzleSecurity user methods', function () {
271271
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
272272
kuzzle.query = queryStub;
273273
error = null;
274-
result = { result: {_id: 'foobar', _index: '%kuzzle', _type: 'users', _source: {profilesIds: ['foobar']} } };
274+
result = { result: {_id: 'foobar', _index: '%kuzzle', _type: 'users', _source: {profileIds: ['foobar']} } };
275275
expectedQuery = {
276276
action: 'updateUser',
277277
controller: 'security'
@@ -355,7 +355,7 @@ describe('KuzzleSecurity user methods', function () {
355355

356356
describe('#UserFactory', function () {
357357
it('should return an instance of Profile', function (done) {
358-
var user = kuzzle.security.userFactory('test', {profilesIds: ['myProfile']});
358+
var user = kuzzle.security.userFactory('test', {profileIds: ['myProfile']});
359359
should(user).instanceof(KuzzleUser);
360360
done();
361361
});

test/security/kuzzleUser/methods.test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,36 +151,36 @@ describe('KuzzleUser methods', function () {
151151
describe('#setProfiles', function () {
152152
beforeEach(function () {
153153
kuzzle = new Kuzzle('http://localhost:7512');
154-
kuzzleUser = new KuzzleUser(kuzzle.security, 'myUser', {profilesIds: ['profile1']});
154+
kuzzleUser = new KuzzleUser(kuzzle.security, 'myUser', {profileIds: ['profile1']});
155155
});
156156

157-
it('should throw an error if the profilesIds parameter is null', function (done) {
157+
it('should throw an error if the profileIds parameter is null', function (done) {
158158
should((function () {
159159
kuzzleUser.setProfiles(null);
160160
})).throw(Error);
161161

162162
done();
163163
});
164164

165-
it('should throw an error if the profilesIds parameter is not an array', function (done) {
165+
it('should throw an error if the profileIds parameter is not an array', function (done) {
166166
should((function () {
167167
kuzzleUser.setProfiles(1);
168168
})).throw(Error);
169169

170170
done();
171171
});
172172

173-
it('should throw an error if the profilesIds parameter is not an array of strings', function (done) {
173+
it('should throw an error if the profileIds parameter is not an array of strings', function (done) {
174174
should((function () {
175175
kuzzleUser.setProfiles([1]);
176176
})).throw(Error);
177177

178178
done();
179179
});
180180

181-
it('should add the rights profiles IDs in profilesIds', function (done) {
181+
it('should add the rights profiles IDs in profileIds', function (done) {
182182
kuzzleUser.setProfiles(['profile2']);
183-
should(kuzzleUser.content.profilesIds[0]).be.exactly('profile2');
183+
should(kuzzleUser.content.profileIds[0]).be.exactly('profile2');
184184
done();
185185
});
186186
});
@@ -189,7 +189,7 @@ describe('KuzzleUser methods', function () {
189189
describe('#addProfile', function () {
190190
beforeEach(function () {
191191
kuzzle = new Kuzzle('http://localhost:7512');
192-
kuzzleUser = new KuzzleUser(kuzzle.security, 'myUser', {profilesIds: ['profile1']});
192+
kuzzleUser = new KuzzleUser(kuzzle.security, 'myUser', {profileIds: ['profile1']});
193193
});
194194

195195
it('should throw an error if the profileId parameter is null', function (done) {
@@ -211,22 +211,22 @@ describe('KuzzleUser methods', function () {
211211
it('should add the profile if it does not already exists in list', function (done) {
212212
kuzzleUser.addProfile('profile2');
213213

214-
should(kuzzleUser.content.profilesIds).be.eql(['profile1', 'profile2']);
214+
should(kuzzleUser.content.profileIds).be.eql(['profile1', 'profile2']);
215215
done();
216216
});
217217

218218
it('should not add the profile if it already exists in list', function (done) {
219219
kuzzleUser.addProfile('profile1');
220220

221-
should(kuzzleUser.content.profilesIds).be.eql(['profile1']);
221+
should(kuzzleUser.content.profileIds).be.eql(['profile1']);
222222
done();
223223
});
224224

225-
it('should add the profile even if no profilesIds are currently set', function (done) {
226-
delete kuzzleUser.content.profilesIds;
225+
it('should add the profile even if no profileIds are currently set', function (done) {
226+
delete kuzzleUser.content.profileIds;
227227
kuzzleUser.addProfile('profile1');
228228

229-
should(kuzzleUser.content.profilesIds).be.eql(['profile1']);
229+
should(kuzzleUser.content.profileIds).be.eql(['profile1']);
230230
done();
231231
});
232232

@@ -235,14 +235,14 @@ describe('KuzzleUser methods', function () {
235235
describe('#serialize', function () {
236236
beforeEach(function () {
237237
kuzzle = new Kuzzle('http://localhost:7512');
238-
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profilesIds: ['profile']});
238+
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profileIds: ['profile']});
239239
});
240240

241241
it('should serialize with correct attributes', function (done) {
242242
var serialized = kuzzleUser.serialize();
243243

244244
should(serialized._id).be.exactly('user');
245-
should(serialized.body).be.match({some: 'content', profilesIds: ['profile']});
245+
should(serialized.body).be.match({some: 'content', profileIds: ['profile']});
246246
done();
247247
});
248248
});
@@ -254,7 +254,7 @@ describe('KuzzleUser methods', function () {
254254
error = false;
255255

256256
result = { result: {_id: 'user'} };
257-
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profilesIds: ['profile']});
257+
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profileIds: ['profile']});
258258
expectedQuery = {
259259
action: 'deleteUser',
260260
controller: 'security'
@@ -288,10 +288,10 @@ describe('KuzzleUser methods', function () {
288288

289289
describe('#getProfiles', function () {
290290
it('should return the associated profiles', function () {
291-
var profilesIds = ['profile'];
291+
var profileIds = ['profile'];
292292
kuzzle = new Kuzzle('http://localhost:7512');
293-
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profilesIds});
294-
should(kuzzleUser.getProfiles()).be.eql(profilesIds);
293+
kuzzleUser = new KuzzleUser(kuzzle.security, 'user', {some: 'content', profileIds});
294+
should(kuzzleUser.getProfiles()).be.eql(profileIds);
295295
});
296296
});
297297
});

0 commit comments

Comments
 (0)