Skip to content

Commit 7dd445f

Browse files
committed
Move RemediatR roles to Headway.RemediatR.Core #52
Move RemediatR roles to Headway.RemediatR.Core #52
1 parent 926cd33 commit 7dd445f

File tree

5 files changed

+29
-25
lines changed

5 files changed

+29
-25
lines changed

src/Headway.Core/Constants/Roles.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,5 @@ public static class Roles
55
public const string ADMIN = "Admin";
66
public const string HEADWAY_USER = "headwayuser";
77
public const string USER = "User";
8-
9-
// RemediatR
10-
public const string REMEDIATR_ADMIN = "remediatradmin";
11-
public const string REMEDIATR_CUSTOMER_READ = "remediatrcustomerread";
12-
public const string REMEDIATR_CUSTOMER_WRITE = "remediatrcustomerwrite";
13-
public const string REMEDIATR_REDRESS_READ = "remediatrredressread";
14-
public const string REMEDIATR_REDRESS_WRITE = "remediatrredresswrite";
158
}
169
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace Headway.RemediatR.Core.Constants
2+
{
3+
public static class RemediatRRoles
4+
{
5+
public const string REMEDIATR_ADMIN = "remediatradmin";
6+
public const string REMEDIATR_CUSTOMER_READ = "remediatrcustomerread";
7+
public const string REMEDIATR_CUSTOMER_WRITE = "remediatrcustomerwrite";
8+
public const string REMEDIATR_REDRESS_READ = "remediatrredressread";
9+
public const string REMEDIATR_REDRESS_WRITE = "remediatrredresswrite";
10+
}
11+
}

src/Headway.WebApi/Controllers/RemediatRCustomerController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Headway.Core.Attributes;
2-
using Headway.Core.Constants;
2+
using Headway.RemediatR.Core.Constants;
33
using Headway.RemediatR.Core.Interface;
44
using Headway.RemediatR.Core.Model;
55
using Microsoft.AspNetCore.Mvc;
@@ -24,7 +24,7 @@ public RemediatRCustomerController(
2424
[HttpGet]
2525
public async Task<IActionResult> Get()
2626
{
27-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_CUSTOMER_READ)
27+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_CUSTOMER_READ)
2828
.ConfigureAwait(false);
2929

3030
if (!authorised)
@@ -42,7 +42,7 @@ public async Task<IActionResult> Get()
4242
[HttpGet("{customerId}")]
4343
public async Task<IActionResult> Get(int customerId)
4444
{
45-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_CUSTOMER_READ)
45+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_CUSTOMER_READ)
4646
.ConfigureAwait(false);
4747

4848
if (!authorised)
@@ -60,7 +60,7 @@ public async Task<IActionResult> Get(int customerId)
6060
[HttpPost]
6161
public async Task<IActionResult> Post([FromBody] Customer customer)
6262
{
63-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_CUSTOMER_WRITE)
63+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_CUSTOMER_WRITE)
6464
.ConfigureAwait(false);
6565

6666
if (!authorised)
@@ -78,7 +78,7 @@ public async Task<IActionResult> Post([FromBody] Customer customer)
7878
[HttpPut]
7979
public async Task<IActionResult> Put([FromBody] Customer customer)
8080
{
81-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_CUSTOMER_WRITE)
81+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_CUSTOMER_WRITE)
8282
.ConfigureAwait(false);
8383

8484
if (!authorised)
@@ -96,7 +96,7 @@ public async Task<IActionResult> Put([FromBody] Customer customer)
9696
[HttpDelete("{customerId}")]
9797
public async Task<IActionResult> Delete(int customerId)
9898
{
99-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_CUSTOMER_WRITE)
99+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_CUSTOMER_WRITE)
100100
.ConfigureAwait(false);
101101

102102
if (!authorised)

src/Headway.WebApi/Controllers/RemediatRProgramController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Headway.Core.Attributes;
2-
using Headway.Core.Constants;
2+
using Headway.RemediatR.Core.Constants;
33
using Headway.RemediatR.Core.Interface;
44
using Microsoft.AspNetCore.Mvc;
55
using Microsoft.Extensions.Logging;
@@ -23,7 +23,7 @@ public RemediatRProgramController(
2323
[HttpGet]
2424
public async Task<IActionResult> Get()
2525
{
26-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_ADMIN)
26+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_ADMIN)
2727
.ConfigureAwait(false);
2828

2929
if (!authorised)
@@ -41,7 +41,7 @@ public async Task<IActionResult> Get()
4141
[HttpGet("{programId}")]
4242
public async Task<IActionResult> Get(int programId)
4343
{
44-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_ADMIN)
44+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_ADMIN)
4545
.ConfigureAwait(false);
4646

4747
if (!authorised)
@@ -59,7 +59,7 @@ public async Task<IActionResult> Get(int programId)
5959
[HttpPost]
6060
public async Task<IActionResult> Post([FromBody] RemediatR.Core.Model.Program program)
6161
{
62-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_ADMIN)
62+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_ADMIN)
6363
.ConfigureAwait(false);
6464

6565
if (!authorised)
@@ -77,7 +77,7 @@ public async Task<IActionResult> Post([FromBody] RemediatR.Core.Model.Program pr
7777
[HttpPut]
7878
public async Task<IActionResult> Put([FromBody] RemediatR.Core.Model.Program program)
7979
{
80-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_ADMIN)
80+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_ADMIN)
8181
.ConfigureAwait(false);
8282

8383
if (!authorised)
@@ -95,7 +95,7 @@ public async Task<IActionResult> Put([FromBody] RemediatR.Core.Model.Program pro
9595
[HttpDelete("{programId}")]
9696
public async Task<IActionResult> Delete(int programId)
9797
{
98-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_ADMIN)
98+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_ADMIN)
9999
.ConfigureAwait(false);
100100

101101
if (!authorised)

src/Headway.WebApi/Controllers/RemediatRRedressController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Headway.Core.Attributes;
2-
using Headway.Core.Constants;
2+
using Headway.RemediatR.Core.Constants;
33
using Headway.RemediatR.Core.Interface;
44
using Headway.RemediatR.Core.Model;
55
using Microsoft.AspNetCore.Mvc;
@@ -24,7 +24,7 @@ public RemediatRRedressController(
2424
[HttpGet]
2525
public async Task<IActionResult> Get()
2626
{
27-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_REDRESS_READ)
27+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_REDRESS_READ)
2828
.ConfigureAwait(false);
2929

3030
if (!authorised)
@@ -42,7 +42,7 @@ public async Task<IActionResult> Get()
4242
[HttpGet("{redressId}")]
4343
public async Task<IActionResult> Get(int redressId)
4444
{
45-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_REDRESS_READ)
45+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_REDRESS_READ)
4646
.ConfigureAwait(false);
4747

4848
if (!authorised)
@@ -60,7 +60,7 @@ public async Task<IActionResult> Get(int redressId)
6060
[HttpPost]
6161
public async Task<IActionResult> Post([FromBody] Redress redress)
6262
{
63-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_REDRESS_WRITE)
63+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_REDRESS_WRITE)
6464
.ConfigureAwait(false);
6565

6666
if (!authorised)
@@ -78,7 +78,7 @@ public async Task<IActionResult> Post([FromBody] Redress redress)
7878
[HttpPut]
7979
public async Task<IActionResult> Put([FromBody] Redress redress)
8080
{
81-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_REDRESS_WRITE)
81+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_REDRESS_WRITE)
8282
.ConfigureAwait(false);
8383

8484
if (!authorised)
@@ -96,7 +96,7 @@ public async Task<IActionResult> Put([FromBody] Redress redress)
9696
[HttpDelete("{redressId}")]
9797
public async Task<IActionResult> Delete(int redressId)
9898
{
99-
var authorised = await IsAuthorisedAsync(Roles.REMEDIATR_REDRESS_WRITE)
99+
var authorised = await IsAuthorisedAsync(RemediatRRoles.REMEDIATR_REDRESS_WRITE)
100100
.ConfigureAwait(false);
101101

102102
if (!authorised)

0 commit comments

Comments
 (0)