From 5b6df1c9f804892bc3c34e048e05a630cc431464 Mon Sep 17 00:00:00 2001 From: Simen Rekkedal <61084786+simen-rekkedal@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:40:29 +0100 Subject: [PATCH] SystemUserService --- .../Controllers/SystemUserController.cs | 7 ++- .../Services/Interfaces/ISystemUserService.cs | 46 ++++++++++++++ .../Services/SystemUserService.cs | 62 +++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 src/Authentication/Services/Interfaces/ISystemUserService.cs create mode 100644 src/Authentication/Services/SystemUserService.cs diff --git a/src/Authentication/Controllers/SystemUserController.cs b/src/Authentication/Controllers/SystemUserController.cs index 3555c7c8..49dd0a7d 100644 --- a/src/Authentication/Controllers/SystemUserController.cs +++ b/src/Authentication/Controllers/SystemUserController.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using Altinn.Platform.Authentication.Model; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -59,10 +60,11 @@ public async Task SetDeleteFlagOnSystemUser() /// to ensure that there is no mismatch if the same partyId creates several new SystemUsers at the same time /// /// - [ProducesResponseType(StatusCodes.Status201Created)] + [Produces("application/json")] + [ProducesResponseType(typeof(SystemUserResponse), StatusCodes.Status201Created)] [ProducesResponseType(StatusCodes.Status404NotFound)] [HttpPost("systemuser/{partyId}/{createRequestId}")] - public async Task CreateSystemUser() + public async Task> CreateSystemUser() { await Task.Delay(40); return Ok(); @@ -74,6 +76,7 @@ public async Task CreateSystemUser() /// [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] + [Consumes("application/x-www-form-urlencoded")] [HttpPut("systemuser/{partyId}/{systemUserId}")] public async Task UpdateSystemUserById() { diff --git a/src/Authentication/Services/Interfaces/ISystemUserService.cs b/src/Authentication/Services/Interfaces/ISystemUserService.cs new file mode 100644 index 00000000..ec7a3ed5 --- /dev/null +++ b/src/Authentication/Services/Interfaces/ISystemUserService.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Altinn.Platform.Authentication.Model; +using Microsoft.AspNetCore.Mvc; + +namespace Altinn.Platform.Authentication.Services.Interfaces +{ + /// + /// The service that supports the System User CRUD APIcontroller + /// + public interface ISystemUserService + { + /// + /// Returns the list of SystemUsers this PartyID has registered + /// + /// + Task> GetListOfSystemUsersPartyHas(); + + /// + /// Return a single SystemUser by PartyId and SystemUserId + /// + /// + Task GetSingleSystemUserById(); + + /// + /// Set the Delete flag on the identified SystemUser + /// + /// + Task SetDeleteFlagOnSystemUser(); + + /// + /// Creates a new SystemUser + /// The unique Id for the systemuser is handled by the db. + /// But the calling client may send a guid for the request of creating a new system user + /// to ensure that there is no mismatch if the same partyId creates several new SystemUsers at the same time + /// + /// + Task CreateSystemUser(); + + /// + /// Replaces the values for the existing system user with those from the update + /// + /// + Task UpdateSystemUserById(); + } +} diff --git a/src/Authentication/Services/SystemUserService.cs b/src/Authentication/Services/SystemUserService.cs new file mode 100644 index 00000000..2bc1aee9 --- /dev/null +++ b/src/Authentication/Services/SystemUserService.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +using Altinn.Platform.Authentication.Model; +using Altinn.Platform.Authentication.Services.Interfaces; + +namespace Altinn.Platform.Authentication.Services +{ + /// + /// The service that supports the SystemUser CRUD APIcontroller + /// + public class SystemUserService : ISystemUserService + { + /// + /// Creates a new SystemUser + /// The unique Id for the systemuser is handled by the db. + /// But the calling client may send a guid for the request of creating a new system user + /// to ensure that there is no mismatch if the same partyId creates several new SystemUsers at the same time + /// + /// + public Task CreateSystemUser() + { + throw new System.NotImplementedException(); + } + + /// + /// Returns the list of SystemUsers this PartyID has registered + /// + /// + public Task> GetListOfSystemUsersPartyHas() + { + throw new System.NotImplementedException(); + } + + /// + /// Return a single SystemUser by PartyId and SystemUserId + /// + /// + public Task GetSingleSystemUserById() + { + throw new System.NotImplementedException(); + } + + /// + /// Set the Delete flag on the identified SystemUser + /// + /// + public Task SetDeleteFlagOnSystemUser() + { + throw new System.NotImplementedException(); + } + + /// + /// Replaces the values for the existing system user with those from the update + /// + /// + public Task UpdateSystemUserById() + { + throw new System.NotImplementedException(); + } + } +}