Skip to content

Commit 383de9f

Browse files
author
ballinette
committed
Merge pull request #92 from kuzzleio/fix-91-kuzzle-profile-format
[release-1.9.1] Fix #91: format correctly roles within profile definition
2 parents a02b5e0 + 0c6199b commit 383de9f

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
*__note:__ the # at the end of lines are the pull request numbers on GitHub*
2+
3+
# 1.9.1
4+
5+
* Fix issue #91
6+
17
# 1.9.0
28

39
## Features

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": "1.9.0",
3+
"version": "1.9.1",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/security/kuzzleSecurity.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,15 @@ KuzzleSecurity.prototype.getProfile = function (id, options, cb) {
289289

290290
if (!hydrate) {
291291
response.result._source.roles = response.result._source.roles.map(function (role) {
292-
return role._id;
292+
var formattedRole = {_id: role._id};
293+
if (role._source.restrictedTo !== undefined) {
294+
formattedRole.restrictedTo = role._source.restrictedTo;
295+
}
296+
if (role._source.allowInternalIndex !== undefined) {
297+
formattedRole.allowInternalIndex = role._source.allowInternalIndex;
298+
}
299+
300+
return formattedRole;
293301
});
294302
}
295303

test/security/kuzzleSecurity/profilesMethods.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('KuzzleSecurity profiles methods', function () {
7878
should(res.content.roles).not.be.empty();
7979

8080
res.content.roles.forEach(function (role) {
81-
should(role).be.a.String();
81+
should(role._id).not.be.empty().and.be.a.String();
8282
});
8383
done();
8484
}));

0 commit comments

Comments
 (0)