private IEnumerable <string> processOperation(Definitions.ObjectType objectType, IEnumerable <String> evalutedVariables) { var groupEntity = ((group_object)objectType).Group; var entityOperation = groupEntity.operation; string[] groupNames = string.IsNullOrEmpty(groupEntity.var_ref) ? new string[] { groupEntity.Value } : evalutedVariables.ToArray(); var operationResult = new List <String>(); foreach (var groupName in groupNames) { string[] valuesToApply = (this.getValuesToApplyOperation(entityOperation, groupName)).ToArray(); if (entityOperation == OperationEnumeration.patternmatch) { var multiLevelOperation = new MultiLevelPatternMatchOperation(FamilyEnumeration.windows); operationResult.AddRange(multiLevelOperation.applyPatternMatch(groupName, valuesToApply)); } else { operationResult.AddRange(this.EvaluateOperationsDifferentsOfPatternMatch(entityOperation, groupName, valuesToApply)); } } return(operationResult); }
private IEnumerable <string> processOperationPatternMatchForTrustName(EntityObjectStringType trustName) { var operationResult = new List <string>(); string[] valuesToApply = this.searchUsers(); var multiLevelOperation = new MultiLevelPatternMatchOperation(FamilyEnumeration.windows); operationResult.AddRange(multiLevelOperation.applyPatternMatch(trustName.Value, valuesToApply)); return(operationResult); }
public void Should_be_possible_to_apply_regex_on_unix_filepath_strings() { var valuesToMatch = new string[] { "/temp/hub1/", "/temp/hub2/", "/temp/hub3/" }; var multiLevelPatterOperator = new MultiLevelPatternMatchOperation(FamilyEnumeration.unix); var result = multiLevelPatterOperator.applyPatternMatch(@"/temp/.*/usb/", valuesToMatch); Assert.AreEqual(3, result.Count()); Assert.AreEqual("temp/hub1/usb", result.ElementAt(0), UNEXPECTED_MATCH_VALUE_WAS_FOUND); Assert.AreEqual("temp/hub2/usb", result.ElementAt(1), UNEXPECTED_MATCH_VALUE_WAS_FOUND); Assert.AreEqual("temp/hub3/usb", result.ElementAt(2), UNEXPECTED_MATCH_VALUE_WAS_FOUND); }
public void Should_be_possible_to_apply_regex_on_windows_filepath_strings() { var valuesToMatch = new string[] { "c:\\temp\\hub1\\", "c:\\temp\\hub2\\", "c:\\temp\\hub3\\" }; var multiLevelPatterOperator = new MultiLevelPatternMatchOperation(FamilyEnumeration.windows); var result = multiLevelPatterOperator.applyPatternMatch(@"c:\temp\.*\usb\", valuesToMatch); Assert.AreEqual(3, result.Count()); Assert.AreEqual("c:\\temp\\hub1\\usb", result.ElementAt(0), UNEXPECTED_MATCH_VALUE_WAS_FOUND); Assert.AreEqual("c:\\temp\\hub2\\usb", result.ElementAt(1), UNEXPECTED_MATCH_VALUE_WAS_FOUND); Assert.AreEqual("c:\\temp\\hub3\\usb", result.ElementAt(2), UNEXPECTED_MATCH_VALUE_WAS_FOUND); }
private IEnumerable <string> EvaluateOperations(OperationEnumeration operation, string entityValue, IEnumerable <string> valuesToMatch) { if (operatorHelper.IsRegularExpression(operation)) { var multiLevelPatternMatchOperator = new MultiLevelPatternMatchOperation(GetPlatform()); return(multiLevelPatternMatchOperator.applyPatternMatch(entityValue, valuesToMatch)); } else { return(this.EvaluateOperationsDifferentsOfPatternMatch(operation, entityValue, valuesToMatch)); } }
private IEnumerable <String> ProcessOperationsTrusteeSID(fileeffectiverights53_object objectToCollect) { var trusteeSIDEntityName = fileeffectiverights53_object_ItemsChoices.trustee_sid.ToString(); var trusteeSIDEntity = objectToCollect.GetAllObjectEntities()[trusteeSIDEntityName]; var derivedTrusteeSIDs = new List <String>(); if (trusteeSIDEntity.operation == OperationEnumeration.equals) { derivedTrusteeSIDs.Add(trusteeSIDEntity.Value); } else { this.searchAllUsersOnTarget(); derivedTrusteeSIDs = new MultiLevelPatternMatchOperation(FamilyEnumeration.windows) .applyPatternMatch(trusteeSIDEntity.Value, allUsersSID).ToList(); } return(derivedTrusteeSIDs); }