forked from MDCPS/DamageAssessment_Backend
		
	merged azure and user access changes to docker azure branch
This commit is contained in:
		| @ -1,4 +1,5 @@ | ||||
| using DamageAssesment.Api.Questions.Interfaces; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
|  | ||||
| namespace DamageAssesment.Api.Questions.Controllers | ||||
| @ -10,16 +11,13 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|  | ||||
|         public QuestionsController(IQuestionsProvider questionsProvider) | ||||
|         { | ||||
|  | ||||
|             this.questionsProvider = questionsProvider; | ||||
|  | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// GET request for retrieving questions. | ||||
|         /// </summary> | ||||
|  | ||||
|         // get all questions | ||||
|         //get all questions | ||||
|         [Authorize(Roles = "admin,survey,user,report")] | ||||
|         [Route("questions")] | ||||
|         [Route("questions/{language:alpha}")] | ||||
|         [HttpGet] | ||||
| @ -37,6 +35,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// <summary> | ||||
|         /// GET request for retrieving a question by ID. | ||||
|         /// </summary> | ||||
|         [Authorize(Roles = "admin,survey,user,report")] | ||||
|         [Route("questions/{id}/{language:alpha}")] | ||||
|         [Route("questions/{id:int}")] | ||||
|         [HttpGet] | ||||
| @ -55,6 +54,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// GET request for retrieving survey questions based on a survey ID. | ||||
|         /// Uri: {Optional language}/GetSurveyQuestions/{surveyId} :Default returns question in all languages  | ||||
|         /// </summary> | ||||
|         [Authorize(Roles = "admin,survey,user,report")] | ||||
|         [Route("questions/bysurvey/{surveyId:int}")] | ||||
|         [Route("questions/bysurvey/{surveyId:int}/{language:alpha}")] | ||||
|         [HttpGet] | ||||
| @ -71,6 +71,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// PUT request for updating a question (multilingual). | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpPut("questions")] | ||||
|         public async Task<IActionResult> UpdateQuestion(Models.Question question) | ||||
|         { | ||||
| @ -92,6 +93,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// POST request for creating a new question (multilingual). | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpPost("questions")] | ||||
|         public async Task<IActionResult> CreateQuestion(Models.Question question) | ||||
|         { | ||||
| @ -110,6 +112,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// DELETE request for deleting a question based on ID. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpDelete("questions/{id}")] | ||||
|         public async Task<IActionResult> DeleteQuestion(int id) | ||||
|         { | ||||
| @ -125,6 +128,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// GET request for retrieving question categories. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin,user,report")] | ||||
|         [HttpGet("questions/categories")] | ||||
|         [HttpGet("questions/categories/{language:alpha}")] | ||||
|         public async Task<IActionResult> GetQuestionCategoriesAsync(string? language) | ||||
| @ -139,7 +143,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// <summary> | ||||
|         /// GET request for retrieving a question category by ID. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin,report")] | ||||
|         [HttpGet("questions/categories/{id:int}")] | ||||
|         [HttpGet("questions/categories/{id:int}/{language:alpha}")] | ||||
|         public async Task<IActionResult> GetQuestionCategoryAsync(int id,string? language) | ||||
| @ -156,7 +160,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// <summary> | ||||
|         /// PUT request for updating a question category. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin,survey,report")] | ||||
|         [HttpPut("questions/categories")] | ||||
|         public async Task<IActionResult> UpdateQuestionCategory(Models.QuestionCategory questionCategory) | ||||
|         { | ||||
| @ -178,6 +182,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// POST request for creating a new question category. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpPost("questions/categories")] | ||||
|         public async Task<IActionResult> CreateQuestionCategory(Models.QuestionCategory questionCategory) | ||||
|         { | ||||
| @ -196,6 +201,7 @@ namespace DamageAssesment.Api.Questions.Controllers | ||||
|         /// DELETE request for deleting a question category based on ID. | ||||
|         /// </summary> | ||||
|  | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpDelete("questions/categories/{id}")] | ||||
|         public async Task<IActionResult> DeleteQuestionCategory(int id) | ||||
|         { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user