uml pdf, announcements auth page, winforms dashboard perms

This commit is contained in:
Dimitar Byalkov
2023-03-31 14:31:04 +02:00
parent cd3a375b62
commit 3eabc9c64d
6 changed files with 15 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using StudentHouseDashboard.Managers;
namespace WebApp.Pages
{
[Authorize]
public class AnnouncementModel : PageModel
{
public void OnGet(int id)

View File

@@ -1,9 +1,11 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using StudentHouseDashboard.Managers;
namespace WebApp.Pages
{
[Authorize]
public class AnnouncementsModel : PageModel
{
public AnnouncementManager AnnouncementManager { get; set; }

View File

@@ -28,6 +28,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Login">Login</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Register">Register</a>
</li>
</ul>
</div>
</div>

View File

@@ -31,6 +31,7 @@ namespace WebApp
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();

View File

@@ -20,7 +20,13 @@ namespace WinForms
this.loginForm = loginForm;
InitializeComponent();
lblUserStatus.Text = $"Logged in as: {user.Role} {user.Name}";
if (user.Role == UserRole.ADMIN || user.Role == UserRole.MANAGER)
if (user.Role == UserRole.MANAGER)
{
btnCreateUser.Enabled = false;
btnDeleteUser.Enabled = false;
btnUpdateUser.Enabled = true;
}
else if (user.Role == UserRole.ADMIN)
{
btnCreateUser.Enabled = true;
btnDeleteUser.Enabled = true;

Binary file not shown.