From e0642bea9392f5fdab92f70622e671f9fd7ee0c7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 11 Dec 2020 21:30:39 +0200 Subject: Renamed custom Roles class to UserRoles, fixing naming ambiguity --- API/Controllers/UserController.cs | 4 ++-- API/Database/DevHiveContext.cs | 2 +- API/Service/UserService.cs | 2 +- API/Startup.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'API') diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 922119e..187b4e9 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -5,7 +5,7 @@ using AutoMapper; using Microsoft.AspNetCore.Mvc; using Data.Models.DTOs; using Microsoft.AspNetCore.Authorization; - +using Data.Models.Classes; namespace API.Controllers { @@ -39,7 +39,7 @@ namespace API.Controllers //Read [HttpGet] - [Authorize(Roles = Data.Models.Classes.Roles.Admin)] + [Authorize(Roles = UserRoles.Admin)] public async Task GetById(int id) { return await this._service.GetUserById(id); diff --git a/API/Database/DevHiveContext.cs b/API/Database/DevHiveContext.cs index f8ddf83..7cb8f16 100644 --- a/API/Database/DevHiveContext.cs +++ b/API/Database/DevHiveContext.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Identity; namespace API.Database { - public class DevHiveContext : IdentityDbContext + public class DevHiveContext : IdentityDbContext { public DevHiveContext(DbContextOptions options) : base(options) { } diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index 453e5f4..b715f8c 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -60,7 +60,7 @@ namespace API.Service User user = this._userMapper.Map(userDTO); if (user.Role == null) - user.Role = Roles.User; + user.Role = UserRoles.User; await this._userDbRepository.AddAsync(user); diff --git a/API/Startup.cs b/API/Startup.cs index f5aeaad..d9388cf 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -35,7 +35,7 @@ namespace API services.AddDbContext(options => options.UseNpgsql(Configuration.GetConnectionString("DEV"))); - services.AddIdentity() + services.AddIdentity() .AddEntityFrameworkStores(); services.Configure(options => -- cgit v1.2.3