public IEnumerable<ObjectType> CreateObjectTypeByCombinationOfEntities(fileeffectiverights53_object objectType, IEnumerable<string> filepaths, IEnumerable<string> filenames, IEnumerable<string> paths, IEnumerable<string> trusteeSIDs) { List<ObjectType> fileContentObjects = new List<ObjectType>(); fileContentObjects.AddRange(this.CreateFileObjects(objectType, filepaths, filenames, paths, trusteeSIDs)); return fileContentObjects; }
private void CreateFileObjectsWithFilePath(fileeffectiverights53_object objectType, IEnumerable<string> filepaths, IEnumerable<string> trusteeSIDs, List<ObjectType> fileEffectiveRightsObjects) { foreach (string filepath in filepaths) foreach (string trusteeSID in trusteeSIDs) fileEffectiveRightsObjects.Add(this.CreateObjectTypeFrom(objectType, filepath, null, null, trusteeSID)); }
private fileeffectiverights53_object CreateFileObject(EntityObjectStringType filePath, EntityObjectStringType fileName, EntityObjectStringType path, EntityObjectStringType trusteeSID) { var newFileEffectiveRights53Object = new fileeffectiverights53_object(); var items = new List<object>(); var itemChoices = new List<fileeffectiverights53_object_ItemsChoices>(); if (filePath == null) { itemChoices.Add(fileeffectiverights53_object_ItemsChoices.path); itemChoices.Add(fileeffectiverights53_object_ItemsChoices.filename); itemChoices.Add(fileeffectiverights53_object_ItemsChoices.trustee_sid); items.Add(path); items.Add(fileName); items.Add(trusteeSID); } else { itemChoices.Add(fileeffectiverights53_object_ItemsChoices.filepath); itemChoices.Add(fileeffectiverights53_object_ItemsChoices.trustee_sid); items.Add(filePath); items.Add(trusteeSID); } newFileEffectiveRights53Object.Items = items.ToArray(); newFileEffectiveRights53Object.Fileeffectiverights53ObjectItemsElementName = itemChoices.ToArray(); return newFileEffectiveRights53Object; }
private IEnumerable<String> EvaluateEntity( fileeffectiverights53_object fileeffectiverights53Object, fileeffectiverights53_object_ItemsChoices entityName, bool isEntityNullable = false) { var entity = fileeffectiverights53Object.GetAllObjectEntities()[entityName.ToString()]; var isNilEntity = (isEntityNullable && (entity == null)); return isNilEntity ? new string[] { "" } : VariableEntityEvaluator.EvaluateVariableForEntity(entity); }
public IEnumerable<ObjectType> CreateFileObjects(fileeffectiverights53_object objectType, IEnumerable<string> filepaths, IEnumerable<string> filenames, IEnumerable<string> paths, IEnumerable<string> trusteeSIDs) { List<ObjectType> fileEffectiveRightsObjects = new List<ObjectType>(); if (!objectType.IsFilePathDefined()) this.CreateFileObjectsWithoutFilePath(objectType, filenames, paths, trusteeSIDs, fileEffectiveRightsObjects); else this.CreateFileObjectsWithFilePath(objectType, filepaths, trusteeSIDs, fileEffectiveRightsObjects); return fileEffectiveRightsObjects; }
private ObjectType CreateObjectTypeFrom(fileeffectiverights53_object objectType, string filepath, string filename, string path, string trusteeSID) { EntityObjectStringType filePathFrom = null; EntityObjectStringType pathFrom = null; EntityObjectStringType fileNameFrom = null; EntityObjectStringType newFilePath = null; EntityObjectStringType newPath = null; EntityObjectStringType newFileName = null; var trusteeSIDFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.trustee_sid); var newTrusteeSID = this.CreateObjectStringTypeFrom(trusteeSIDFrom); newTrusteeSID.Value = string.IsNullOrEmpty(trusteeSID) ? newTrusteeSID.Value : trusteeSID; if (objectType.IsFilePathDefined()) { filePathFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.filepath); newFilePath = this.CreateObjectStringTypeFrom(filePathFrom); newFilePath.Value = string.IsNullOrEmpty(filepath) ? newFilePath.Value : filepath; return this.CreateFileObject(newFilePath, null, null, newTrusteeSID); } else { pathFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.path); fileNameFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.filename); newPath = this.CreateObjectStringTypeFrom(pathFrom); newPath.Value = string.IsNullOrEmpty(path) ? newPath.Value: path; var isNil = ((fileNameFrom == null) && filename.Trim().Equals(string.Empty)); newFileName = this.CreateObjectStringTypeFrom(fileNameFrom, isNil); newFileName.Value = string.IsNullOrEmpty(filename) ? newFileName.Value : filename; return this.CreateFileObject(null, newFileName, newPath, newTrusteeSID); } }
private void AssertCreatedItemTypeAgainstSourceObjectType( fileeffectiverights53_object sourceObjectType, fileeffectiverights_item createdItemType) { var sourceFilePath = sourceObjectType.GetAllObjectEntities()[fileeffectiverights53_object_ItemsChoices.filepath.ToString()]; var sourcePath = sourceObjectType.GetAllObjectEntities()[fileeffectiverights53_object_ItemsChoices.path.ToString()]; var sourceFileName = sourceObjectType.GetAllObjectEntities()[fileeffectiverights53_object_ItemsChoices.filename.ToString()]; var sourceTrusteeSID = sourceObjectType.GetAllObjectEntities()[fileeffectiverights53_object_ItemsChoices.trustee_sid.ToString()]; this.assertGeneratedEntityItem(createdItemType.filepath, sourceFilePath, "filepath"); this.assertGeneratedEntityItem(createdItemType.path, sourcePath, "path"); this.assertGeneratedEntityItem(createdItemType.filename, sourceFileName, "filename"); this.assertGeneratedEntityItem(createdItemType.trustee_sid, sourceTrusteeSID, "trusteeSID"); }
private void AssertCorrectnessOfFileEntities(fileeffectiverights53_object createdObjectType) { if (createdObjectType.IsFilePathDefined()) { Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.PathEntityName]); Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.FilenameEntityName]); return; } Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.FilepathEntityName]); }
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; }
public IEnumerable<ItemType> ProcessOperation(fileeffectiverights53_object objectToCollect) { IEnumerable<string> filenames = null; IEnumerable<string> paths = null; var allEntities = objectToCollect.GetAllObjectEntities(); var trusteeSID = ((EntityObjectStringType)objectToCollect.GetItemValue(fileeffectiverights53_object_ItemsChoices.trustee_sid)).Value; if (objectToCollect.IsFilePathDefined()) { var filepath = this.GetDictionaryWithElement(fileeffectiverights53_object_ItemsChoices.filepath, allEntities); var filePathOperationResult = this.PathOperatorEvaluator.ProcessOperationFilePath(filepath); paths = filePathOperationResult.Paths; filenames = new List<String>(); foreach (var completeFilepath in filePathOperationResult.FileNames) ((List<String>)filenames).Add(System.IO.Path.GetFileName(completeFilepath)); } else { paths = this.ProcessOperationsPaths(allEntities); filenames = this.ProcessOperationsFileNames(allEntities, paths); } var trusteeSIDNames = this.ProcessOperationsTrusteeSID(objectToCollect); return CreateFileEffectiveRightsItemTypeFactory() .CreateFileItemTypesByCombinationOfEntitiesFrom(paths, filenames, trusteeSIDNames); }