DAP後端如何取得租戶與使用者相關訊息? |
|
問答
緊急程度
最佳答案1.請確認請求訊息的header中有傳入使用者token
2.在程式碼中使用 DWServiceContext.getContext().getProfile().get(key);來取得相關資訊。
key可以為:
tenantSid: 租戶sid
tenantId: 租戶id
tenantName: 租戶名稱
userId: 使用者id
userName: 使用者名稱
可參考以下範例程式碼:
// 取出服務上下文
DWServiceContext context = DWServiceContext.getContext();
Map<String, Object> tProfile = DWServiceContext.getContext( ...
| |