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]);
        }
Exemple #2
0
        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");
        }
        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));
        }
        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));
        }
        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);
        }