Skip to content

Commit

Permalink
Remove defunct site admin management
Browse files Browse the repository at this point in the history
The Adminsitrator Service has become defunct because site admins are now managed via security group. I removed the unused controller, the last other usage of the service (which was broken because it used the database table that is no longer a source of truth for stie admin privileges) and the service and database mapping.
  • Loading branch information
EjPlatzer committed Feb 22, 2024
1 parent b4d9a01 commit 4533420
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 227 deletions.
73 changes: 0 additions & 73 deletions Gordon360/Controllers/AdminsController.cs

This file was deleted.

8 changes: 5 additions & 3 deletions Gordon360/Controllers/HousingController.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using Gordon360.Authorization;
using Gordon360.Enums;
using Gordon360.Models.CCT.Context;
using Gordon360.Models.ViewModels;
using Gordon360.Services;
using Gordon360.Static.Methods;
using Gordon360.Static.Names;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Security.Claims;

namespace Gordon360.Controllers;

[Route("api/[controller]")]
public class HousingController(CCTContext context, IProfileService profileService, IHousingService housingService, IAccountService accountService, IAdministratorService administratorService) : GordonControllerBase
public class HousingController(CCTContext context, IProfileService profileService, IHousingService housingService) : GordonControllerBase
{

/// <summary>
Expand Down Expand Up @@ -190,10 +192,10 @@ public ActionResult<ApartmentApplicationViewModel> GetApartmentApplication(int a
{
//get token data from context, username is the username of current logged in person
var authenticatedUserUsername = AuthUtils.GetUsername(User);
var authGroups = AuthUtils.GetGroups(User);

var siteAdmin = administratorService.GetByUsername(authenticatedUserUsername);
var isHousingAdmin = housingService.CheckIfHousingAdmin(authenticatedUserUsername);
bool isAdmin = siteAdmin != null || isHousingAdmin;
bool isAdmin = authGroups.Contains(AuthGroup.SiteAdmin) || isHousingAdmin;

ApartmentApplicationViewModel result = housingService.GetApartmentApplication(applicationID, isAdmin);
if (result != null)
Expand Down
7 changes: 0 additions & 7 deletions Gordon360/Models/CCT/Context/CCTContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public CCTContext(DbContextOptions<CCTContext> options)

public virtual DbSet<ACT_INFO> ACT_INFO { get; set; }

public virtual DbSet<ADMIN> ADMIN { get; set; }

public virtual DbSet<AccountPhotoURL> AccountPhotoURL { get; set; }

public virtual DbSet<Activity> Activity { get; set; }
Expand Down Expand Up @@ -165,11 +163,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.ACT_TYPE_DESC).IsFixedLength();
});

modelBuilder.Entity<ADMIN>(entity =>
{
entity.HasKey(e => e.ADMIN_ID).HasName("PK_Admin");
});

modelBuilder.Entity<AccountPhotoURL>(entity =>
{
entity.ToView("AccountPhotoURL");
Expand Down
7 changes: 2 additions & 5 deletions Gordon360/Models/CCT/Context/efpt.CCT.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"Name": "[dbo].[ACT_INFO]",
"ObjectType": 0
},
{
"Name": "[dbo].[ADMIN]",
"ObjectType": 0
},
{
"Name": "[dbo].[Clifton_Strengths]",
"ObjectType": 0
Expand Down Expand Up @@ -360,7 +356,7 @@
"ObjectType": 1
}
],
"UiHint": "SQLTrain1.CCT",
"UiHint": "sqltrain1.CCT.dbo",
"UncountableWords": null,
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": true,
Expand All @@ -378,6 +374,7 @@
"UseNoObjectFilter": false,
"UseNodaTime": false,
"UseNullableReferences": false,
"UsePrefixNavigationNaming": false,
"UseSchemaFolders": true,
"UseSchemaNamespaces": false,
"UseSpatial": false,
Expand Down
29 changes: 0 additions & 29 deletions Gordon360/Models/CCT/dbo/ADMIN.cs

This file was deleted.

101 changes: 0 additions & 101 deletions Gordon360/Services/AdministratorService.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Gordon360/Services/ServiceInterfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ public interface IActivityInfoService
IEnumerable<ActivityInfoViewModel> GetAll();
}

public interface IAdministratorService
{
IEnumerable<AdminViewModel?> GetAll();
AdminViewModel? GetByUsername(string username);
AdminViewModel Add(AdminViewModel admin);
AdminViewModel Delete(string username);
}

public interface IEmailService
{
IEnumerable<EmailViewModel> GetEmailsForActivity(string activityCode, string? sessionCode = null, List<string>? participationTypes = null);
Expand Down
1 change: 0 additions & 1 deletion Gordon360/Services/ServicesExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static IServiceCollection Add360Services(this IServiceCollection services
services.AddScoped<IAccountService, AccountService>();
services.AddScoped<IActivityService, ActivityService>();
services.AddScoped<IAddressesService, AddressesService>();
services.AddScoped<IAdministratorService, AdministratorService>();
services.AddScoped<IContentManagementService, ContentManagementService>();
services.AddScoped<IDiningService, DiningService>();
services.AddScoped<IEmailService, EmailService>();
Expand Down

0 comments on commit 4533420

Please sign in to comment.