Align NTFS ensure SID arguments

This commit is contained in:
Meik
2026-03-13 12:46:37 +01:00
parent ccfd26c0cf
commit daa70c982b

View File

@@ -975,15 +975,15 @@ namespace C4IT.LIAM.Activities
[Category("Input")] [Category("Input")]
[DisplayName("Owner SIDs")] [DisplayName("Owner SIDs")]
public InArgument<string> OwnerSids { get; set; } public InArgument<IEnumerable<string>> OwnerSids { get; set; }
[Category("Input")] [Category("Input")]
[DisplayName("Reader SIDs")] [DisplayName("Reader SIDs")]
public InArgument<string> ReaderSids { get; set; } public InArgument<IEnumerable<string>> ReaderSids { get; set; }
[Category("Input")] [Category("Input")]
[DisplayName("Writer SIDs")] [DisplayName("Writer SIDs")]
public InArgument<string> WriterSids { get; set; } public InArgument<IEnumerable<string>> WriterSids { get; set; }
[Category("Input")] [Category("Input")]
[DisplayName("Ensure Traverse")] [DisplayName("Ensure Traverse")]
@@ -1016,38 +1016,29 @@ namespace C4IT.LIAM.Activities
return; return;
} }
var ownerSids = OwnerSids.Expression != null ? OwnerSids.Get(context) : null;
var readerSids = ReaderSids.Expression != null ? ReaderSids.Get(context) : null;
var writerSids = WriterSids.Expression != null ? WriterSids.Get(context) : null;
var result = provider.EnsureMissingPermissionGroupsAsync( var result = provider.EnsureMissingPermissionGroupsAsync(
folderPath, folderPath,
null, null,
ParseSidList(OwnerSids.Get(context)), NormalizeSidList(ownerSids),
ParseSidList(ReaderSids.Get(context)), NormalizeSidList(readerSids),
ParseSidList(WriterSids.Get(context)), NormalizeSidList(writerSids),
EnsureTraverse.Get(context)).GetAwaiter().GetResult(); EnsureTraverse.Get(context)).GetAwaiter().GetResult();
Success.Set(context, result != null && result.resultErrorId == 0); Success.Set(context, result != null && result.resultErrorId == 0);
ResultToken.Set(context, JsonValue.Parse(JsonConvert.SerializeObject(result))); ResultToken.Set(context, JsonValue.Parse(JsonConvert.SerializeObject(result)));
} }
private IEnumerable<string> ParseSidList(string raw) private IEnumerable<string> NormalizeSidList(IEnumerable<string> rawSids)
{ {
if (string.IsNullOrWhiteSpace(raw)) if (rawSids == null)
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
var trimmed = raw.Trim(); return rawSids
if (trimmed.StartsWith("[")) .Select(i => i?.Trim())
{
try
{
return JsonConvert.DeserializeObject<List<string>>(trimmed) ?? Enumerable.Empty<string>();
}
catch
{
}
}
return trimmed
.Split(new[] { ';', ',', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
.Select(i => i.Trim())
.Where(i => !string.IsNullOrWhiteSpace(i)) .Where(i => !string.IsNullOrWhiteSpace(i))
.Distinct(StringComparer.OrdinalIgnoreCase); .Distinct(StringComparer.OrdinalIgnoreCase);
} }