This commit is contained in:
master
2026-02-04 19:59:20 +02:00
parent 557feefdc3
commit 5548cf83bf
1479 changed files with 53557 additions and 40339 deletions

View File

@@ -0,0 +1,46 @@
using StellaOps.AirGap.Bundle.Models;
namespace StellaOps.AirGap.Bundle.Services;
public static partial class LocalRbacBundleExtensions
{
/// <summary>
/// Checks if a bundle manifest contains local RBAC policy.
/// </summary>
/// <param name="manifest">Bundle manifest to check.</param>
/// <returns>True if the manifest contains local RBAC policy.</returns>
public static bool HasLocalRbacPolicy(this BundleManifest manifest)
{
ArgumentNullException.ThrowIfNull(manifest);
foreach (var policy in manifest.Policies)
{
if (policy.Type == PolicyType.LocalRbac)
{
return true;
}
}
return false;
}
/// <summary>
/// Gets the local RBAC policy component from a bundle manifest.
/// </summary>
/// <param name="manifest">Bundle manifest to search.</param>
/// <returns>The local RBAC policy component, or null if not found.</returns>
public static PolicyComponent? GetLocalRbacPolicy(this BundleManifest manifest)
{
ArgumentNullException.ThrowIfNull(manifest);
foreach (var policy in manifest.Policies)
{
if (policy.Type == PolicyType.LocalRbac)
{
return policy;
}
}
return null;
}
}