-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from davewalker5/per-user-default-location
Support User Attributes
- Loading branch information
Showing
31 changed files
with
1,010 additions
and
71 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mcr.microsoft.com/dotnet/core/aspnet:latest | ||
COPY flightrecorder.api-1.9.1.0 /opt/flightrecorder.api-1.9.1.0 | ||
WORKDIR /opt/flightrecorder.api-1.9.1.0/bin | ||
COPY flightrecorder.api-1.10.0.0 /opt/flightrecorder.api-1.10.0.0 | ||
WORKDIR /opt/flightrecorder.api-1.10.0.0/bin | ||
ENTRYPOINT [ "./FlightRecorder.Api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mcr.microsoft.com/dotnet/aspnet:latest AS runtime | ||
COPY flightrecorder.mvc-1.9.1.0 /opt/flightrecorder.mvc-1.9.1.0 | ||
WORKDIR /opt/flightrecorder.mvc-1.9.1.0/bin | ||
COPY flightrecorder.mvc-1.10.0.0 /opt/flightrecorder.mvc-1.10.0.0 | ||
WORKDIR /opt/flightrecorder.mvc-1.10.0.0/bin | ||
ENTRYPOINT [ "./FlightRecorder.Mvc" ] |
59 changes: 59 additions & 0 deletions
59
src/FlightRecorder.Api/Controllers/UserAttributesController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using FlightRecorder.BusinessLogic.Factory; | ||
using FlightRecorder.Entities.Db; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace FlightRecorder.Api.Controllers | ||
{ | ||
[Authorize] | ||
[ApiController] | ||
[ApiConventionType(typeof(DefaultApiConventions))] | ||
[Route("[controller]")] | ||
public class UserAttributesController : Controller | ||
{ | ||
private readonly FlightRecorderFactory _factory; | ||
|
||
public UserAttributesController(FlightRecorderFactory factory) | ||
{ | ||
_factory = factory; | ||
} | ||
|
||
[HttpGet] | ||
[Route("id/{userId:int}")] | ||
public async Task<ActionResult<List<UserAttributeValue>>> GetUserAttributeValuesAsync(int userId) | ||
{ | ||
var user = await _factory.Users.GetUserAsync(userId); | ||
|
||
if (user == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
if ((user.Attributes == null) || (user.Attributes.Count == 0)) | ||
{ | ||
return NoContent(); | ||
} | ||
|
||
return user.Attributes.ToList(); | ||
} | ||
|
||
[HttpGet] | ||
[Route("name/{userName}")] | ||
public async Task<ActionResult<List<UserAttributeValue>>> GetUserAttributeValuesAsync(string userName) | ||
{ | ||
var user = await _factory.Users.GetUserAsync(userName); | ||
|
||
if (user == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
if ((user.Attributes == null) || (user.Attributes.Count == 0)) | ||
{ | ||
return NoContent(); | ||
} | ||
|
||
return user.Attributes.ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.