# 2/18 顧問輔導 for WebHRM Bruce Chen (i@kkbruce.tw) #### 1. Foreign key table schema design for code first implementation (DBMigrator) 與問題2(issue25)有關連, 想請教顧問使用code first實作時該怎麼處理foreign key 應該可行。 #### 2. Usage for QueryFilter and corresponding design (through Interface fhttps://hackmd.io/6QR18dRvQvWLnaeBx7_5eQ?bothor Entity object)因為要做到跨資料表篩選, 需要去處理問題1(issue#24)的Foreign key, 想請教顧問是否可以這樣使用, 或者有更好的方式 應該可行。 #### 3. Concept of ASP.NET Core Antiforgery, and usage to prevent CSRF attacks, 目前開發階段已不太常看到此訊息所以不易重現問題, 但想了解Antiforgery的運作跟使用時機 已於會議回答。 #### 4. Deal with exception for GetHealthReport (health status)這是否為.NET的元件, 想確認專案health status時該如何避免, 以及抓取exception時做到user friendly exception,(補充:附圖只有在上到product iis環境時才會遇到,在本機運作正常,猜測是路徑設定問題) 訊息是路徑問題沒錯。 #### 5. Invalid request for login (token) 在處理登入認證時使用OIDC(OpenID Connect協議), 目前用abp可以拿到client id, 但應該怎麼處理api和api之間的認證/資料授權, 而設計類似SSO(SingleSignOn)的機制在登入後要如何grant可使用那些系統或叫用api的權限(考慮多租戶), 想請教顧問是否有較好的設計方式可建議(補充:前提是想要藉由某個系統間接api服務,當grant_type為client_credentials時,有沒有方式是能拿到在系統某個人的角色權限) 這範圍比較大,需要瞭解OAuth,已安排教學說明。 # ### issue24 [Ef core foreign key](https://github.com/JBJOB-DEV/JBHRIS.HRM/issues/24) *目前有一個需求 Employee與Family設有relation FK:Employee.Id = Family.EmployeeId 當在Family中設定Employee為延伸的屬性時 透過migrations卻會再產生出一個Family.EmployeeId1的欄位 如果我只是希望實際使用Family的時候 可以透過Family.Employee直接使用Employee的其他欄位 且不希望額外產生我非預期的欄位要怎麼做* * - [ ] 1. foreign key table schema design for code first implementation(DBMigrator) ### issue25 [QueryFilter跨資料表篩選](https://github.com/JBJOB-DEV/JBHRIS.HRM/issues/25) *目前有一個需求 當有使用到EmployeeId的欄位(關聯到Employee.Id) 可以透過EmployeeSetting這個資料表判斷當前使用者(IdentityUser)有沒有權限可以存取此筆資料 如果沒有的就篩選掉 是否可以透過QueryFilter進行預設排除 以及此判斷是否可以透過Entity繼承某Interface方式來進行判斷* * - [ ] 2.1 usage for QueryFilter * - [ ] 2.2 corresponding design (through Interface for Entity object) ### issue26 [ASP.NET Core Antiforgery觀念](https://github.com/JBJOB-DEV/JBHRIS.HRM/issues/26) *最近開始進行專案時 常常會有同事會在呼叫api時 得到400的錯誤 看後端的log得到的方向是Antiforgery造成 有看到一些建議的解法是清除掉cookie 也確實可以解決問題 但是偶而就會再發生 希望可以清楚了解一下此架構的運作原理規則* * - [ ] 3. concept of ASP.NET Core Antiforgery ### issue58 [GetHealthReport threw an exception when trying to get report from /health-status configured with name HRM Health Status](https://github.com/JBJOB-DEV/JBHRIS.HRM/issues/58) ![](https://i.imgur.com/77MZ15V.png) ![](https://i.imgur.com/TgKLgd4.png) ![](https://i.imgur.com/VK0onZd.png) * - [ ] 4. deal with exception for GetHealthReport (health status) ### issue59 [登入問題](https://github.com/JBJOB-DEV/JBHRIS.HRM/issues/59) *https://192.168.1.46/JbWebHrHrmApi/connect/token* *https://documentation.openiddict.com/errors/ID2084* ![](https://i.imgur.com/sqRMHub.png) * - [ ] 5. invalid request for login (token)