diff --git a/packages/backend/src/services/DetailProviderService.js b/packages/backend/src/services/DetailProviderService.js index 2907fdc8..3d5d2074 100644 --- a/packages/backend/src/services/DetailProviderService.js +++ b/packages/backend/src/services/DetailProviderService.js @@ -14,15 +14,14 @@ class DetailProviderService extends BaseService { this.providers_.push(fn); } - async get_details (context) { - const details = {}; + async get_details (context, out) { + out = out || {}; for (const provider of this.providers_) { - const out = await provider(context); - Object.assign(details, out); + await provider(context, out); } - return details; + return out; } } diff --git a/packages/backend/src/services/GetUserService.js b/packages/backend/src/services/GetUserService.js index 9c3e695e..802573aa 100644 --- a/packages/backend/src/services/GetUserService.js +++ b/packages/backend/src/services/GetUserService.js @@ -26,6 +26,14 @@ class GetUserService extends BaseService { async _init () { } async get_user (options) { + const user = await this.get_user_(options); + if ( ! user ) return null; + + const svc_whoami = this.services.get('whoami'); + await svc_whoami.get_details({ user }, user); + return user; + } + async get_user_ (options) { const services = this.services; /** @type BaseDatabaseAccessService */