Skip to content

Commit

Permalink
Merge pull request #308 from smbc-digital/develop
Browse files Browse the repository at this point in the history
feat(UserAdminGateway): endpoints and BaseUserRequest model
  • Loading branch information
JonathonWarwick authored Jul 11, 2024
2 parents e3913a8 + e3b7d35 commit 9abddba
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/BookingServiceAdmin/IBookingServiceAdminGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ public interface IBookingServiceAdminGateway
Task<HttpResponseMessage> GetUserById(Guid id);
Task<HttpResponseMessage> GetUserByUsername(string username);
Task<HttpResponseMessage> GetUsersByUsernameFuzzy(string username);
Task<HttpResponseMessage> MakeUserSuperuser(BaseUserRequest request);
Task<HttpResponseMessage> RemoveSuperuserPermission(BaseUserRequest request);
Task<HttpResponseMessage> ActivateUser(BaseUserRequest request);
Task<HttpResponseMessage> DeactivateUser(BaseUserRequest request);
Task<HttpResponseMessage> RemoveUserContextPermissions(BaseUserRequest request);

#endregion
}
Expand Down
16 changes: 16 additions & 0 deletions src/BookingServiceAdmin/UserAdminGateway.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using StockportGovUK.NetStandard.Gateways.Models.Booking.Request;

namespace StockportGovUK.NetStandard.Gateways.BookingServiceAdmin
{
Expand All @@ -16,5 +17,20 @@ public async Task<HttpResponseMessage> GetUserByUsername(string username) =>

public async Task<HttpResponseMessage> GetUsersByUsernameFuzzy(string username) =>
await GetAsync($"{UserEndpoint}/fuzzy/{username}");

public async Task<HttpResponseMessage> MakeUserSuperuser(BaseUserRequest request) =>
await PatchAsync($"{UserEndpoint}/make-superuser", request);

public async Task<HttpResponseMessage> RemoveSuperuserPermission(BaseUserRequest request) =>
await PatchAsync($"{UserEndpoint}/remove-superuser", request);

public async Task<HttpResponseMessage> ActivateUser(BaseUserRequest request) =>
await PatchAsync($"{UserEndpoint}/activate", request);

public async Task<HttpResponseMessage> DeactivateUser(BaseUserRequest request) =>
await PatchAsync($"{UserEndpoint}/deactivate", request);

public async Task<HttpResponseMessage> RemoveUserContextPermissions(BaseUserRequest request) =>
await PatchAsync($"{UserEndpoint}/remove-context-permissions", request);
}
}
7 changes: 7 additions & 0 deletions src/Models/Booking/Request/BaseUserRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System;

namespace StockportGovUK.NetStandard.Gateways.Models.Booking.Request;
public class BaseUserRequest
{
public Guid UserId { get; set; }
}
2 changes: 1 addition & 1 deletion src/StockportGovUK.NetStandard.Gateways.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<Title>A package that provides base gateways using HttpClient</Title>
<VersionPrefix>13.25.1</VersionPrefix>
<VersionPrefix>13.26.0</VersionPrefix>
<LangVersion>10</LangVersion>
<Authors>Colin Lees, Jon Chiles, Jon Hadley</Authors>
<Company>Stockport Council</Company>
Expand Down

0 comments on commit 9abddba

Please sign in to comment.