Skip to content

Commit

Permalink
JAM POR role updates
Browse files Browse the repository at this point in the history
  • Loading branch information
leewrigh committed Dec 4, 2024
1 parent 6a19d4b commit 036a0f2
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 14 deletions.
8 changes: 4 additions & 4 deletions backend/JAMService/Data/JAMServiceDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
var app = modelBuilder.Entity<Application>().HasData(
new Application { Id = -1, Name = "JAM_POR", Description = "JUSTIN Protection Order Registry", GroupPath = "/JAM/POR", ValidIDPs = ["azuread"], JUSTINAppName = "POR" });

modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -1, IsRealmGroup = true, Description = "Read-only: Current protection orders and expired", SourceRoles = ["POS_VIEW_ALL_USER", "POS_USER"], TargetRoles = ["POR_READ_ONLY"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -2, IsRealmGroup = true, Description = "Read-only: Current protection orders and expired", SourceRoles = ["POS_SEL_USER", "POS_USER"], TargetRoles = ["POR_READ_ONLY"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -1, IsRealmGroup = true, Description = "Read-only: Current protection orders and expired", SourceRoles = ["POS_VIEW_ALL_USER", "POS_USER"], TargetRoles = ["POR_READ_EXPIRED_ORDERS"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -2, IsRealmGroup = true, Description = "Read-only: Current protection orders only", SourceRoles = ["POS_SEL_USER", "POS_USER"], TargetRoles = ["POR_READ_VALID_ONLY"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -3, IsRealmGroup = true, Description = "Regular user: Admin without remove orders permission", SourceRoles = ["POS_USER"], TargetRoles = ["POR_READ_WRITE"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -4, IsRealmGroup = true, Description = "Admin with remove orders permission", SourceRoles = ["POS_USER", "POS_REMOVE_USER"], TargetRoles = ["POR_READ_WRITE", "POR_DELETE_ORDER"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -5, IsRealmGroup = true, Description = "BAE Roles, ability to see results on sealed orders queries", SourceRoles = ["POS_USER", "POS_REMOVE_USER", "POS_JUSTIN"], TargetRoles = ["POR_READ_WRITE", "POR_DELETE_ORDER"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -4, IsRealmGroup = true, Description = "Admin with remove orders permission", SourceRoles = ["POS_USER", "POS_DEL_USER"], TargetRoles = ["POR_ADMIN_WITH_SEALING"] });
modelBuilder.Entity<AppRoleMapping>().HasData(new AppRoleMapping { ApplicationId = -1, Id = -5, IsRealmGroup = true, Description = "Ability to seal protection orders and mark as removed", SourceRoles = ["POS_USER", "POS_REMOVE_USER"], TargetRoles = ["POR_ADMIN_WITH_SEALING"] });


var mapping = modelBuilder.Entity<IDPMapper>().HasData(
Expand Down
2 changes: 2 additions & 0 deletions backend/JAMService/JAMService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<ProjectReference Include="..\CommonModels\CommonModels.csproj" />
<PackageReference Include="Keycloak.Net.Core" Version="1.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.11" />

</ItemGroup>

<ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 036a0f2

Please sign in to comment.