diff --git a/REPORT_API_ver6/Controllers/ProjectAPI.cs b/REPORT_API_ver6/Controllers/ProjectAPI.cs index 1c85868..732b2fa 100644 --- a/REPORT_API_ver6/Controllers/ProjectAPI.cs +++ b/REPORT_API_ver6/Controllers/ProjectAPI.cs @@ -50,10 +50,10 @@ namespace REPORT_API_ver6.Controllers ) { var configuration = Common.GetConfiguration(); - var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; + var apikey = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token); - if (userInfo != null || !String.IsNullOrEmpty(value)) + if (userInfo != null || !String.IsNullOrEmpty(apikey)) { intranetCd = intranetCd.Split("_")[0]; Project project = new Project(); diff --git a/REPORT_API_ver6/Controllers/SecurityAPI.cs b/REPORT_API_ver6/Controllers/SecurityAPI.cs index 98a3d56..8bd3c90 100644 --- a/REPORT_API_ver6/Controllers/SecurityAPI.cs +++ b/REPORT_API_ver6/Controllers/SecurityAPI.cs @@ -28,10 +28,10 @@ namespace REPORT_API_ver6.Controllers hcAccessor.HttpContext.Response.ContentType = "text/plain"; var configuration = Common.GetConfiguration(); - var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; + var apikey = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token); - if (userInfo != null || !String.IsNullOrEmpty(value)) + if (userInfo != null || !String.IsNullOrEmpty(apikey)) { Project project = new Project(); if (project.getProjectInfo(pkey, Convert.ToInt32(iskiwi)).Rows.Count > 0) diff --git a/REPORT_API_ver6/Controllers/UriAPI.cs b/REPORT_API_ver6/Controllers/UriAPI.cs index 7f360d8..032a21c 100644 --- a/REPORT_API_ver6/Controllers/UriAPI.cs +++ b/REPORT_API_ver6/Controllers/UriAPI.cs @@ -30,19 +30,19 @@ namespace REPORT_API_ver6.Controllers hcAccessor.HttpContext.Response.ContentType = "text/plain"; var configuration = Common.GetConfiguration(); - var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; + var apikey = configuration.GetSection("X-API-Key")[xApiKey ?? ""]; UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token); - if (userInfo != null || !String.IsNullOrEmpty(value)) + if (userInfo != null || !String.IsNullOrEmpty(apikey)) { string okey = "REPORT"; - if(userInfo.ID == "KON" || userInfo.ID == "KIWI" || userInfo.ID == "NEWSSAK") + if(userInfo != null && (userInfo.ID == "KON" || userInfo.ID == "KIWI" || userInfo.ID == "NEWSSAK")) { okey = userInfo.ID; } - else if(!String.IsNullOrEmpty(value)) + else if(!String.IsNullOrEmpty(apikey)) { - okey = value; + okey = apikey; } PkeyInfo pkeyInfo = new PkeyInfo(skey); @@ -54,7 +54,7 @@ namespace REPORT_API_ver6.Controllers int mode = shortURLParam.Mode == "P" ? 1 : 0; string returnString = "https://kart.kric.com/External/" + URI.GetURIKey(shortURLParam.RealURI, mode, skey, proejctInfo.Rows[0]["title"].ToString(), okey); string cLogContent = "{ \"REAL_URI\": \"" + shortURLParam.RealURI + "\",\"MODE\": \"" + shortURLParam.Mode + "\", \"COPY_URI\": \"" + returnString + "\" }"; - Log.InsertSiteLog(userInfo.ID, pkeyInfo.Pkey, "URL Copy", cLogContent); + Log.InsertSiteLog(userInfo != null ? userInfo.ID : apikey, pkeyInfo.Pkey, "URL Copy", cLogContent); Response.StatusCode = (int)HttpStatusCode.OK; return Content(returnString);