Changeset 1db5673 for Farmatiko/Controllers
- Timestamp:
- 11/14/20 12:27:30 (4 years ago)
- Branches:
- master
- Children:
- 68454c6
- Parents:
- ad60966
- Location:
- Farmatiko/Controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/Controllers/AdminController.cs
rad60966 r1db5673 11 11 { 12 12 [ApiController] 13 [Authorize(Roles = " PharmacyHead")]13 [Authorize(Roles = "Admin")] 14 14 public class AdminController : Controller 15 15 { -
Farmatiko/Controllers/FarmatikoController.cs
rad60966 r1db5673 27 27 //_JSONservice.GetProcessedHealthFacilitiesFromJSON(); 28 28 //_JSONservice.GetProcessedMedicinesFromJSON(); 29 //_JSONservice.GetProcessedPandemicsFromJSONApi();29 _JSONservice.GetProcessedPandemicsFromJSONApi(); 30 30 } 31 31 [HttpGet] -
Farmatiko/Controllers/LoginController.cs
rad60966 r1db5673 61 61 Role = role, 62 62 AccessToken = jwtResult.AccessToken, 63 RefreshToken = jwtResult.RefreshToken.TokenString, 63 RefreshToken = jwtResult.RefreshToken.TokenString, 64 64 Head = _pHService.GetPharmacyHead(request.UserName) 65 65 }); … … 110 110 return Ok(new LoginResult 111 111 { 112 /*UserName = userName, 113 114 Role = User.FindFirst(ClaimTypes.Role)?.Value ?? string.Empty, 115 AccessToken = jwtResult.AccessToken, 116 RefreshToken = jwtResult.RefreshToken.TokenString*/ 117 112 118 UserName = userName, 113 119 Role = User.FindFirst(ClaimTypes.Role)?.Value ?? string.Empty, 114 120 AccessToken = jwtResult.AccessToken, 115 RefreshToken = jwtResult.RefreshToken.TokenString 121 RefreshToken = jwtResult.RefreshToken.TokenString, 122 Head = _pHService.GetPharmacyHead(userName) 116 123 }); 117 124 } … … 156 163 OriginalUserName = userName, 157 164 AccessToken = jwtResult.AccessToken, 158 RefreshToken = jwtResult.RefreshToken.TokenString 165 RefreshToken = jwtResult.RefreshToken.TokenString, 166 Head = _pHService.GetPharmacyHead(userName) 159 167 }); 160 168 } … … 186 194 OriginalUserName = null, 187 195 AccessToken = jwtResult.AccessToken, 188 RefreshToken = jwtResult.RefreshToken.TokenString 196 RefreshToken = jwtResult.RefreshToken.TokenString, 197 Head = _pHService.GetPharmacyHead(userName) 189 198 }); 190 199 } … … 204 213 public class LoginResult 205 214 { 206 [JsonPropertyName("user name")]215 [JsonPropertyName("userName")] 207 216 public string UserName { get; set; } 208 217 … … 219 228 public string RefreshToken { get; set; } 220 229 [JsonPropertyName("head")] 221 public PharmacyHeadHead { get; set; }230 public object Head { get; set; } 222 231 } 223 232 … … 230 239 public class ImpersonationRequest 231 240 { 232 [JsonPropertyName("user name")]241 [JsonPropertyName("userName")] 233 242 public string UserName { get; set; } 234 243 } -
Farmatiko/Controllers/PharmacyHeadController.cs
rad60966 r1db5673 19 19 20 20 //GET 21 /*[HttpGet] 21 /* 22 [HttpGet] 22 23 [Route("api/pharmacyhead")] 23 24 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo() … … 26 27 return PHeads; 27 28 }*/ 29 28 30 [HttpGet] 29 31 [Route("api/pharmacyhead/{Id}")] … … 34 36 } 35 37 //POST 38 /* 36 39 [HttpPost] 37 40 [Route("api/pharmacyhead/add")] … … 40 43 bool Success = await _PHService.Add(pharmacyHead); 41 44 return Ok(Success); 42 } 45 }*/ 43 46 44 47 /*[HttpPost] … … 49 52 }*/ 50 53 [HttpPut] 51 [Route("api/pharmacyhead/{Id}")] 54 [Route("api/pharmacyhead")] 55 [Authorize(Roles = "Admin")] 56 [Authorize(Roles = "PharmacyHead")] 52 57 public async Task UpdatePharmacyHead([FromBody]PharmacyHead pharmacyHead) 53 58 {
Note:
See TracChangeset
for help on using the changeset viewer.