Pārlūkot izejas kodu

產品分析、IOT統計追加AD授權認證、前端攔截器也追加認證Header資料

jeff 1 gadu atpakaļ
vecāks
revīzija
112b9b0ec7

+ 5 - 3
TEAMModelBI/ClientApp/src/until/http.js

@@ -21,8 +21,7 @@ axios.interceptors.request.use(
             config.url.indexOf('bizconfig') != -1 ||
             config.url.indexOf('paper') != -1 ||
             config.url.indexOf('notice') != -1 ||
-            config.url.indexOf('bizuser') != -1 ||
-            config.url.indexOf('prodanalysis') != -1 
+            config.url.indexOf('bizuser') != -1
         ) {
             config.headers = {
                 'Content-Type': 'application/json',
@@ -33,7 +32,10 @@ axios.interceptors.request.use(
                 'Content-Type': 'application/json',
                 // 'site': 'china'
             }
-        } else if (config.url.indexOf('ies5') != -1 || config.url.indexOf('tmidstics') != -1 || config.url.indexOf('/service/PushNotify') != -1) {
+        } else if (config.url.indexOf('ies5') != -1 ||
+            config.url.indexOf('tmid') != -1 ||
+            config.url.indexOf('/service/PushNotify') != -1 ||
+            config.url.indexOf('prodanalysis') != -1) {
             config.headers = {
                 'Content-Type': 'application/json',
                 'authorization': 'Bearer ' + JSON.parse(localStorage.access_token)

+ 3 - 2
TEAMModelBI/Controllers/BIProductAnalysis/ProductAnalysisController.cs

@@ -1,5 +1,6 @@
 using Azure.Cosmos;
 using DingTalk.Api.Request;
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Configuration;
@@ -55,7 +56,7 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "admin")]
+        [Authorize(Roles = "IES")]
         [HttpPost("get-iotstics")]
         public async Task<IActionResult> GetIotStics(JsonElement jsonElement)
         {
@@ -161,7 +162,7 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "admin")]
+        [Authorize(Roles = "IES")]
         [HttpPost("get-school")]
         public async Task<IActionResult> GetSchoolInfo(JsonElement jsonElement)
         {

+ 1 - 3
TEAMModelBI/Controllers/BITmid/TmidController.cs

@@ -50,7 +50,6 @@ namespace TEAMModelBI.Controllers.BITmid
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        //[AuthToken(Roles = "admin")]
         [Authorize(Roles = "IES")]
         [HttpPost("get-tmidstics")]
         public async Task<IActionResult> GetTmidStics(JsonElement jsonElement)
@@ -538,7 +537,7 @@ namespace TEAMModelBI.Controllers.BITmid
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        //[AuthToken(Roles = "admin")]
+        [Authorize(Roles = "IES")]
         [HttpPost("get-tmid-iot")]
         public async Task<IActionResult> GetTmidIot(JsonElement jsonElement)
         {
@@ -642,7 +641,6 @@ namespace TEAMModelBI.Controllers.BITmid
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        //[AuthToken(Roles = "admin")]
         [Authorize(Roles = "IES")]
         [HttpPost("get-tmid-useprod")]
         public async Task<IActionResult> GetTmidUseProd(JsonElement jsonElement)