Closed xbill82 closed 8 years ago
I cannot reproduce the issue here :(
On which branch are you ? And which version of Elasticsearch container ?
The result we see in your environment is very strange. We should see something like that:
{
"action": "getUser",
"controller": "security",
"error": null,
"metadata": {},
"requestId": "7223fd3c-f7e5-489a-9e9e-371c9bc86395",
"result": {
"_id": "dummy-user",
"username": "dummy-user"
"profile": {
"_id": "dummy-profile",
"_source": {
"roles": [
// (profile's roles)
]
}
}
}
},
"status": 200
}
I don't undestand where following data come from:
"_index": "%kuzzle",
"_source": {
"profile": "dummy-profile",
"username": "dummy-user"
},
"_type": "users",
"_version": 1,
"found": true,
We should have a look at userRepository.js and repository.js code within lib/api/code/models/repositories, and specially trace in which format is the result of "this.readEngine.get" (within Repository.prototype.loadOneFromDatabase).
This seems to be solved by #312
If I create a user associated with a profile
dummy-profile
that actually exists, then I get the user by id, I see the right profile in the_source
attribute, but I see theprofile
attribute in theresult
contains thedefault
one.Computing the rights array associated with the user (via the
~security::getUserRights
method) confirms this, since the resulting rights are clearly issued from thedefault
profile.Note that this happens both when creating the User from a
fixtures.json
file and when creating it via the REST API.