This commit is contained in:
parent
8347b10401
commit
8cd1e10cd7
@ -22,7 +22,6 @@ namespace HanyadikHetVan.Controllers.V1
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("json")]
|
[HttpGet("json")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
|
||||||
[Produces(MediaTypeNames.Application.Json)]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public HanyadikHetVanDTO GetJson()
|
public HanyadikHetVanDTO GetJson()
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net.Mime;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace HanyadikHetVan.Controllers.V1
|
namespace HanyadikHetVan.Controllers.V1
|
||||||
@ -19,7 +20,7 @@ namespace HanyadikHetVan.Controllers.V1
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("unprotected")]
|
[HttpGet("unprotected")]
|
||||||
[Produces("application/json")]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public string Unprotected()
|
public string Unprotected()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -28,10 +29,18 @@ namespace HanyadikHetVan.Controllers.V1
|
|||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpGet("protected")]
|
[HttpGet("protected")]
|
||||||
[Produces("application/json")]
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
public string Protected()
|
public string Protected()
|
||||||
{
|
{
|
||||||
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize(Roles = "admin")]
|
||||||
|
[HttpGet("roleprotected")]
|
||||||
|
[Produces(MediaTypeNames.Application.Json)]
|
||||||
|
public string RoleProtected()
|
||||||
|
{
|
||||||
|
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpDelete("{pauseId}")]
|
[HttpDelete("{pauseId}")]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
@ -58,7 +58,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
[Consumes(MediaTypeNames.Application.Json)]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PauseDTO))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PauseDTO))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
@ -24,7 +24,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{userId}")]
|
[HttpPut("{userId}")]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
[Consumes(MediaTypeNames.Application.Json)]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
@ -43,7 +43,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{userId}")]
|
[HttpGet("{userId}")]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
@ -41,7 +41,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpDelete("{weeklyTimeSpanId}")]
|
[HttpDelete("{weeklyTimeSpanId}")]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
@ -58,7 +58,7 @@ namespace HanyadikHetVan.Controllers.V2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[Authorize]
|
[Authorize(Roles = "admin")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
[Consumes(MediaTypeNames.Application.Json)]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
Loading…
Reference in New Issue
Block a user