@@ -66,7 +66,7 @@ Security.prototype.fetchRole = function (id, options, cb) {
6666  self . kuzzle . callbackRequired ( 'Security.fetchRole' ,  cb ) ; 
6767
6868  self . kuzzle . query ( this . buildQueryArgs ( 'getRole' ) ,  data ,  options ,  function  ( err ,  response )  { 
69-     cb ( err ,  err  ? undefined  : new  Role ( self ,  response . result . _id ,  response . result . _source ) ) ; 
69+     cb ( err ,  err  ? undefined  : new  Role ( self ,  response . result . _id ,  response . result . _source ,   response . result . _meta ) ) ; 
7070  } ) ; 
7171} ; 
7272
@@ -101,7 +101,7 @@ Security.prototype.searchRoles = function (filters, options, cb) {
101101    } 
102102
103103    documents  =  result . result . hits . map ( function  ( doc )  { 
104-       return  new  Role ( self ,  doc . _id ,  doc . _source ) ; 
104+       return  new  Role ( self ,  doc . _id ,  doc . _source ,   doc . _meta ) ; 
105105    } ) ; 
106106
107107    cb ( null ,  {  total : result . result . total ,  roles : documents  } ) ; 
@@ -144,7 +144,7 @@ Security.prototype.createRole = function (id, content, options, cb) {
144144  } 
145145
146146  self . kuzzle . query ( this . buildQueryArgs ( action ) ,  data ,  options ,  cb  &&  function  ( err ,  res )  { 
147-     cb ( err ,  err  ? undefined  : new  Role ( self ,  res . result . _id ,  res . result . _source ) ) ; 
147+     cb ( err ,  err  ? undefined  : new  Role ( self ,  res . result . _id ,  res . result . _source ,   res . result . _meta ) ) ; 
148148  } ) ; 
149149} ; 
150150
@@ -173,8 +173,8 @@ Security.prototype.updateRole = function (id, content, options, cb) {
173173    options  =  null ; 
174174  } 
175175
176-   self . kuzzle . query ( this . buildQueryArgs ( action ) ,  data ,  options ,  cb  &&  function  ( err )  { 
177-     cb ( err ,  err  ? undefined  : new  Role ( self ,  id ,  content ) ) ; 
176+   self . kuzzle . query ( this . buildQueryArgs ( action ) ,  data ,  options ,  cb  &&  function  ( err ,   res )  { 
177+     cb ( err ,  err  ? undefined  : new  Role ( self ,  id ,  content ,   res . result . _meta ) ) ; 
178178  } ) ; 
179179
180180  return  this ; 
@@ -214,10 +214,11 @@ Security.prototype.deleteRole = function (id, options, cb) {
214214 * 
215215 * @param  {string } id - role id 
216216 * @param  {object } content - role content 
217+  * @param  {object } meta - role metadata 
217218 * @constructor  
218219 */ 
219- Security . prototype . role  =  function ( id ,  content )  { 
220-   return  new  Role ( this ,  id ,  content ) ; 
220+ Security . prototype . role  =  function ( id ,  content ,   meta )  { 
221+   return  new  Role ( this ,  id ,  content ,   meta ) ; 
221222} ; 
222223
223224
@@ -249,7 +250,7 @@ Security.prototype.fetchProfile = function (id, options, cb) {
249250  self . kuzzle . callbackRequired ( 'Security.fetchProfile' ,  cb ) ; 
250251
251252  self . kuzzle . query ( this . buildQueryArgs ( 'getProfile' ) ,  data ,  options ,  function  ( error ,  response )  { 
252-     cb ( error ,  error  ? undefined  : new  Profile ( self ,  response . result . _id ,  response . result . _source ) ) ; 
253+     cb ( error ,  error  ? undefined  : new  Profile ( self ,  response . result . _id ,  response . result . _source ,   response . result . _meta ) ) ; 
253254  } ) ; 
254255} ; 
255256
@@ -286,7 +287,7 @@ Security.prototype.searchProfiles = function (filters, options, cb) {
286287    } 
287288
288289    documents  =  response . result . hits . map ( function  ( doc )  { 
289-       return  new  Profile ( self ,  doc . _id ,  doc . _source ) ; 
290+       return  new  Profile ( self ,  doc . _id ,  doc . _source ,   doc . _meta ) ; 
290291    } ) ; 
291292
292293    if  ( response . result . scrollId )  { 
@@ -336,7 +337,7 @@ Security.prototype.createProfile = function (id, policies, options, cb) {
336337  } 
337338
338339  self . kuzzle . query ( this . buildQueryArgs ( action ) ,  data ,  options ,  cb  &&  function  ( err ,  res )  { 
339-     cb ( err ,  err  ? undefined  : new  Profile ( self ,  res . result . _id ,  res . result . _source ) ) ; 
340+     cb ( err ,  err  ? undefined  : new  Profile ( self ,  res . result . _id ,  res . result . _source ,   res . result . _meta ) ) ; 
340341  } ) ; 
341342} ; 
342343
@@ -382,7 +383,7 @@ Security.prototype.updateProfile = function (id, policies, options, cb) {
382383      updatedContent [ property ]  =  res . result . _source [ property ] ; 
383384    } ) ; 
384385
385-     cb ( null ,  new  Profile ( self ,  res . result . _id ,  updatedContent ) ) ; 
386+     cb ( null ,  new  Profile ( self ,  res . result . _id ,  updatedContent ,   res . result . _meta ) ) ; 
386387  } ) ; 
387388
388389  return  this ; 
@@ -451,7 +452,7 @@ Security.prototype.scrollProfiles = function (scrollId, options, cb) {
451452    } 
452453
453454    result . result . hits . forEach ( function  ( profile )  { 
454-       var  newProfile  =  new  Profile ( self ,  profile . _id ,  profile . _source ) ; 
455+       var  newProfile  =  new  Profile ( self ,  profile . _id ,  profile . _source ,   profile . _meta ) ; 
455456
456457      newProfile . version  =  profile . _version ; 
457458
@@ -472,10 +473,11 @@ Security.prototype.scrollProfiles = function (scrollId, options, cb) {
472473 * 
473474 * @param  {string } id - profile id 
474475 * @param  {object } content - profile content 
476+  * @param  {object } meta - profile metadata 
475477 * @constructor  
476478 */ 
477- Security . prototype . profile  =  function ( id ,  content )  { 
478-   return  new  Profile ( this ,  id ,  content ) ; 
479+ Security . prototype . profile  =  function ( id ,  content ,   meta )  { 
480+   return  new  Profile ( this ,  id ,  content ,   meta ) ; 
479481} ; 
480482
481483/** 
@@ -502,7 +504,7 @@ Security.prototype.fetchUser = function (id, options, cb) {
502504  self . kuzzle . callbackRequired ( 'Security.fetchUser' ,  cb ) ; 
503505
504506  self . kuzzle . query ( this . buildQueryArgs ( 'getUser' ) ,  data ,  options ,  function  ( err ,  response )  { 
505-     cb ( err ,  err  ? undefined  : new  User ( self ,  response . result . _id ,  response . result . _source ) ) ; 
507+     cb ( err ,  err  ? undefined  : new  User ( self ,  response . result . _id ,  response . result . _source ,   response . result . _meta ) ) ; 
506508  } ) ; 
507509} ; 
508510
@@ -538,7 +540,7 @@ Security.prototype.searchUsers = function (filters, options, cb) {
538540    } 
539541
540542    documents  =  response . result . hits . map ( function  ( doc )  { 
541-       return  new  User ( self ,  doc . _id ,  doc . _source ) ; 
543+       return  new  User ( self ,  doc . _id ,  doc . _source ,   doc . _meta ) ; 
542544    } ) ; 
543545
544546    if  ( response . result . scrollId )  { 
@@ -568,7 +570,7 @@ Security.prototype.createUser = function (id, content, options, cb) {
568570  } 
569571
570572  self . kuzzle . query ( self . buildQueryArgs ( 'createUser' ) ,  data ,  null ,  cb  &&  function  ( err ,  res )  { 
571-     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ) ) ; 
573+     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ,   res . result . _meta ) ) ; 
572574  } ) ; 
573575} ; 
574576
@@ -595,7 +597,7 @@ Security.prototype.replaceUser = function (id, content, options, cb) {
595597  } 
596598
597599  self . kuzzle . query ( this . buildQueryArgs ( 'replaceUser' ) ,  data ,  options ,  cb  &&  function  ( err ,  res )  { 
598-     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ) ) ; 
600+     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ,   res . result . _meta ) ) ; 
599601  } ) ; 
600602} ; 
601603
@@ -658,7 +660,7 @@ Security.prototype.updateUser = function (id, content, options, cb) {
658660  data . body  =  content ; 
659661
660662  self . kuzzle . query ( this . buildQueryArgs ( action ) ,  data ,  options ,  cb  &&  function  ( err ,  res )  { 
661-     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ) ) ; 
663+     cb ( err ,  err  ? undefined  : new  User ( self ,  res . result . _id ,  res . result . _source ,   res . result . _meta ) ) ; 
662664  } ) ; 
663665
664666  return  this ; 
@@ -727,7 +729,7 @@ Security.prototype.scrollUsers = function (scrollId, options, cb) {
727729    } 
728730
729731    result . result . hits . forEach ( function  ( user )  { 
730-       var  newUser  =  new  User ( self ,  user . _id ,  user . _source ) ; 
732+       var  newUser  =  new  User ( self ,  user . _id ,  user . _source ,   user . _meta ) ; 
731733
732734      newUser . version  =  user . _version ; 
733735
@@ -750,10 +752,11 @@ Security.prototype.scrollUsers = function (scrollId, options, cb) {
750752 * 
751753 * @param  {string } id - user id 
752754 * @param  {object } content - user content 
755+  * @param  {object } meta - user metadata 
753756 * @constructor  
754757 */ 
755- Security . prototype . user  =  function ( id ,  content )  { 
756-   return  new  User ( this ,  id ,  content ) ; 
758+ Security . prototype . user  =  function ( id ,  content ,   meta )  { 
759+   return  new  User ( this ,  id ,  content ,   meta ) ; 
757760} ; 
758761
759762/** 
0 commit comments