Align NTFS ensure SID arguments
This commit is contained in:
@@ -975,15 +975,15 @@ namespace C4IT.LIAM.Activities
|
||||
|
||||
[Category("Input")]
|
||||
[DisplayName("Owner SIDs")]
|
||||
public InArgument<string> OwnerSids { get; set; }
|
||||
public InArgument<IEnumerable<string>> OwnerSids { get; set; }
|
||||
|
||||
[Category("Input")]
|
||||
[DisplayName("Reader SIDs")]
|
||||
public InArgument<string> ReaderSids { get; set; }
|
||||
public InArgument<IEnumerable<string>> ReaderSids { get; set; }
|
||||
|
||||
[Category("Input")]
|
||||
[DisplayName("Writer SIDs")]
|
||||
public InArgument<string> WriterSids { get; set; }
|
||||
public InArgument<IEnumerable<string>> WriterSids { get; set; }
|
||||
|
||||
[Category("Input")]
|
||||
[DisplayName("Ensure Traverse")]
|
||||
@@ -1016,38 +1016,29 @@ namespace C4IT.LIAM.Activities
|
||||
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(
|
||||
folderPath,
|
||||
null,
|
||||
ParseSidList(OwnerSids.Get(context)),
|
||||
ParseSidList(ReaderSids.Get(context)),
|
||||
ParseSidList(WriterSids.Get(context)),
|
||||
NormalizeSidList(ownerSids),
|
||||
NormalizeSidList(readerSids),
|
||||
NormalizeSidList(writerSids),
|
||||
EnsureTraverse.Get(context)).GetAwaiter().GetResult();
|
||||
|
||||
Success.Set(context, result != null && result.resultErrorId == 0);
|
||||
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>();
|
||||
|
||||
var trimmed = raw.Trim();
|
||||
if (trimmed.StartsWith("["))
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<List<string>>(trimmed) ?? Enumerable.Empty<string>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return trimmed
|
||||
.Split(new[] { ';', ',', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(i => i.Trim())
|
||||
return rawSids
|
||||
.Select(i => i?.Trim())
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user