From be87adddc44f2dac419650fef6c2c8534e6c485f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 24 May 2020 02:41:23 +0100 Subject: [PATCH] Add administrative zone. --- Marechai.Database/Models/ApplicationRole.cs | 14 ++ Marechai/Marechai.csproj | 7 +- Marechai/Pages/Admin/Index.razor | 40 ++++++ .../Resources/Services/AdminService.es.resx | 133 ++++++++++++++++++ Marechai/Resources/Shared/NavMenu.es.resx | 4 + Marechai/Services/AdminService.cs | 34 +++++ Marechai/Services/Register.cs | 1 + Marechai/Shared/NavMenu.razor | 13 +- 8 files changed, 242 insertions(+), 4 deletions(-) create mode 100644 Marechai/Pages/Admin/Index.razor create mode 100644 Marechai/Resources/Services/AdminService.es.resx create mode 100644 Marechai/Services/AdminService.cs diff --git a/Marechai.Database/Models/ApplicationRole.cs b/Marechai.Database/Models/ApplicationRole.cs index 08a23bb9..5e60c29e 100644 --- a/Marechai.Database/Models/ApplicationRole.cs +++ b/Marechai.Database/Models/ApplicationRole.cs @@ -5,6 +5,20 @@ namespace Marechai.Database.Models { public class ApplicationRole : IdentityRole { + public const string ROLE_UBERADMIN = "UberAdmin"; + public const string ROLE_WRITER = "Writer"; + public const string ROLE_PROOFREADER = "Proofreader"; + public const string ROLE_TRANSLATOR = "Translator"; + public const string ROLE_SUPERTRANSLATOR = "SuperTranslator"; + public const string ROLE_COLLABORATOR = "Collaborator"; + public const string ROLE_CURATOR = "Curator"; + public const string ROLE_PHYSICALCURATOR = "PhysicalCurator"; + public const string ROLE_TECHNICIAN = "Technician"; + public const string ROLE_SUPERTECHNICIAN = "SuperTechnician"; + public const string ROLE_ADMIN = "Administrator"; + public const string ROLE_NONE = "NormalUser"; + + public ApplicationRole() => Created = DateTime.UtcNow; public ApplicationRole(string name) : base(name) diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index a18cb2a8..f942831d 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1036 + 3.0.99.1041 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -39,4 +39,9 @@ + + + true + + \ No newline at end of file diff --git a/Marechai/Pages/Admin/Index.razor b/Marechai/Pages/Admin/Index.razor new file mode 100644 index 00000000..252313e4 --- /dev/null +++ b/Marechai/Pages/Admin/Index.razor @@ -0,0 +1,40 @@ +@{ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Index.razor +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Index of administration area +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ +} + +@page "/admin" +@inherits OwningComponentBase +@inject IStringLocalizer L +@attribute [Authorize(Roles = "UberAdmin, Admin")] + +

@L["Administration area"]

+ +

@L["Welcome to the administration area. Act with care!"]

\ No newline at end of file diff --git a/Marechai/Resources/Services/AdminService.es.resx b/Marechai/Resources/Services/AdminService.es.resx new file mode 100644 index 00000000..dae29b8e --- /dev/null +++ b/Marechai/Resources/Services/AdminService.es.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cargando... + Loading message + + + Área de administración + Administration area + + + Bienvenido/a al área de administración. ¡Actúa con cuidado! + Welcome message. + + \ No newline at end of file diff --git a/Marechai/Resources/Shared/NavMenu.es.resx b/Marechai/Resources/Shared/NavMenu.es.resx index ce642b42..84e612a8 100644 --- a/Marechai/Resources/Shared/NavMenu.es.resx +++ b/Marechai/Resources/Shared/NavMenu.es.resx @@ -158,4 +158,8 @@ Consolas Videogame consoles + + Administración + Administration area + \ No newline at end of file diff --git a/Marechai/Services/AdminService.cs b/Marechai/Services/AdminService.cs new file mode 100644 index 00000000..c8610243 --- /dev/null +++ b/Marechai/Services/AdminService.cs @@ -0,0 +1,34 @@ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : AdminService.cs +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Administration service +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ + +namespace Marechai.Services +{ + public class AdminService { } +} \ No newline at end of file diff --git a/Marechai/Services/Register.cs b/Marechai/Services/Register.cs index cd289485..218921e3 100644 --- a/Marechai/Services/Register.cs +++ b/Marechai/Services/Register.cs @@ -46,6 +46,7 @@ namespace Marechai.Services services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); } } } \ No newline at end of file diff --git a/Marechai/Shared/NavMenu.razor b/Marechai/Shared/NavMenu.razor index 0cfe3655..e4d79abc 100644 --- a/Marechai/Shared/NavMenu.razor +++ b/Marechai/Shared/NavMenu.razor @@ -29,17 +29,24 @@  @L["Consoles"] + + + @code { - private bool collapseNavMenu = true; + private bool _collapseNavMenu = true; - private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; + private string NavMenuCssClass => _collapseNavMenu ? "collapse" : null; private void ToggleNavMenu() { - collapseNavMenu = !collapseNavMenu; + _collapseNavMenu = !_collapseNavMenu; } } \ No newline at end of file