Skip to content

Commit

Permalink
SystemUserService
Browse files Browse the repository at this point in the history
  • Loading branch information
simen-rekkedal committed Nov 6, 2023
1 parent 41c58b3 commit 5b6df1c
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Authentication/Controllers/SystemUserController.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -59,10 +60,11 @@ public async Task<ActionResult> SetDeleteFlagOnSystemUser()
/// to ensure that there is no mismatch if the same partyId creates several new SystemUsers at the same time
/// </summary>
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status201Created)]
[Produces("application/json")]
[ProducesResponseType(typeof(SystemUserResponse), StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[HttpPost("systemuser/{partyId}/{createRequestId}")]
public async Task<ActionResult> CreateSystemUser()
public async Task<ActionResult<SystemUserResponse>> CreateSystemUser()
{
await Task.Delay(40);
return Ok();
Expand All @@ -74,6 +76,7 @@ public async Task<ActionResult> CreateSystemUser()
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[Consumes("application/x-www-form-urlencoded")]
[HttpPut("systemuser/{partyId}/{systemUserId}")]
public async Task<ActionResult> UpdateSystemUserById()
{
Expand Down
46 changes: 46 additions & 0 deletions src/Authentication/Services/Interfaces/ISystemUserService.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// The service that supports the System User CRUD APIcontroller
/// </summary>
public interface ISystemUserService
{
/// <summary>
/// Returns the list of SystemUsers this PartyID has registered
/// </summary>
/// <returns></returns>
Task<List<SystemUserResponse>> GetListOfSystemUsersPartyHas();

/// <summary>
/// Return a single SystemUser by PartyId and SystemUserId
/// </summary>
/// <returns></returns>
Task<SystemUserResponse> GetSingleSystemUserById();

/// <summary>
/// Set the Delete flag on the identified SystemUser
/// </summary>
/// <returns></returns>
Task SetDeleteFlagOnSystemUser();

/// <summary>
/// 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
/// </summary>
/// <returns></returns>
Task<SystemUserResponse> CreateSystemUser();

/// <summary>
/// Replaces the values for the existing system user with those from the update
/// </summary>
/// <returns></returns>
Task UpdateSystemUserById();
}
}
62 changes: 62 additions & 0 deletions src/Authentication/Services/SystemUserService.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// The service that supports the SystemUser CRUD APIcontroller
/// </summary>
public class SystemUserService : ISystemUserService
{
/// <summary>
/// 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
/// </summary>
/// <returns></returns>
public Task<SystemUserResponse> CreateSystemUser()
{
throw new System.NotImplementedException();
}

/// <summary>
/// Returns the list of SystemUsers this PartyID has registered
/// </summary>
/// <returns></returns>
public Task<List<SystemUserResponse>> GetListOfSystemUsersPartyHas()
{
throw new System.NotImplementedException();
}

/// <summary>
/// Return a single SystemUser by PartyId and SystemUserId
/// </summary>
/// <returns></returns>
public Task<SystemUserResponse> GetSingleSystemUserById()
{
throw new System.NotImplementedException();
}

/// <summary>
/// Set the Delete flag on the identified SystemUser
/// </summary>
/// <returns></returns>
public Task SetDeleteFlagOnSystemUser()
{
throw new System.NotImplementedException();
}

/// <summary>
/// Replaces the values for the existing system user with those from the update
/// </summary>
/// <returns></returns>
public Task UpdateSystemUserById()
{
throw new System.NotImplementedException();
}
}
}

0 comments on commit 5b6df1c

Please sign in to comment.