Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
iatsuta committed Nov 18, 2024
1 parent 67ef46d commit a938f3d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public static class SampleSystemSecurityRole
public static SecurityRole TestVirtualRole2 { get; } = new(nameof(TestVirtualRole2));

public static SecurityRole PermissionAdministrator { get; } = new(nameof(PermissionAdministrator));

public static SecurityRole TestPerformance { get; } = new(nameof(TestPerformance));
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static ISecuritySystemSettings RegisterMainDomainSecurityServices(this I
.SetPath(SecurityPath<TestRootSecurityObj>.Create(v => v.BusinessUnit).And(v => v.Location)))

.Add<TestPerformanceObject>(
b => b.SetView(SampleSystemSecurityOperation.EmployeeView)
b => b.SetView(SampleSystemSecurityRole.TestPerformance)
.SetPath(
SecurityPath<TestPerformanceObject>.Create(v => v.Location, SingleSecurityMode.Strictly)
.And(v => v.Employee, SingleSecurityMode.Strictly)
Expand All @@ -123,7 +123,7 @@ private static ISecuritySystemSettings RegisterMainDomainSecurityServices(this I
SecurityPath<TestItemAuthObject>.Create(i => i.BusinessUnit).And(i => i.ManagementUnit)))))

.Add<AuthPerformanceObject>(
b => b.SetView(SampleSystemSecurityOperation.BusinessUnitView)
b => b.SetView(SampleSystemSecurityRole.TestPerformance)
.SetPath(
SecurityPath<AuthPerformanceObject>.Create(v => v.BusinessUnit)
.And(v => v.ManagementUnit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public static ISecuritySystemSettings AddSecurityRoles(this ISecuritySystemSetti
SampleSystemSecurityRole.TestVirtualRole2,
new SecurityRoleInfo(new Guid("{649DE6F3-A943-46A3-9E81-AA056D24B52D}")) { IsVirtual = true, })

.AddSecurityRole(
SampleSystemSecurityRole.TestPerformance,
new SecurityRoleInfo(new Guid("{B1A5B1B6-F92D-4367-B7EC-200179E80308}")))

.AddSecurityRole(
SampleSystemSecurityRole.PermissionAdministrator,
new SecurityRoleInfo(new Guid("{1E101597-E722-4650-BED1-5A1025540897}")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using SampleSystem.Domain;
using SampleSystem.Generated.DTO;
using SampleSystem.IntegrationTests.__Support.TestData;
using SampleSystem.Security;

namespace SampleSystem.IntegrationTests;

Expand Down Expand Up @@ -76,7 +77,7 @@ from location in this.locationSource

from employee in this.employeeSource

select (TestPermission)new SampleSystemTestPermission(SecurityRole.Administrator, fbu, mbu, location, employee);
select (TestPermission)new SampleSystemTestPermission(SampleSystemSecurityRole.TestPerformance, fbu, mbu, location, employee);

this.AuthHelper.SetUserRole(PrincipalName, request.ToArray());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

using SampleSystem.Domain;
using SampleSystem.IntegrationTests.__Support.TestData;
using SampleSystem.Security;
using SampleSystem.WebApiCore.Controllers.Main;

using PersistentDomainObjectBase = SampleSystem.Domain.PersistentDomainObjectBase;
Expand Down Expand Up @@ -59,7 +60,7 @@ from mbuIdent in genMbu

var testPrincipal = new Principal { Name = TestUser };

var adminRole = ctx.Authorization.Logics.BusinessRole.GetByName(SecurityRole.Administrator.Name);
var adminRole = ctx.Authorization.Logics.BusinessRole.GetByName(SampleSystemSecurityRole.TestPerformance.Name);

foreach (var genObjectSubEnumerable in genObjects.Split(SplitBy))
{
Expand Down

0 comments on commit a938f3d

Please sign in to comment.