Exemplo n.º 1
0
        private IEnumerable <ItemType> ProcessOperation(fileauditedpermissions53_object objectToCollect)
        {
            this.checkPathOperatorInstance();

            IEnumerable <string> processedFilenames = null;
            IEnumerable <string> processedPaths     = null;

            if (objectToCollect.IsFilePathDefined())
            {
                var filepath = this.GetDictionaryWithElement(fileauditedpermissions53_objectItemsChoices.filepath, objectToCollect.GetAllObjectEntities());
                var filePathOperationResult = this.PathOperatorEvaluator.ProcessOperationFilePath(filepath);
                processedPaths = filePathOperationResult.Paths;

                processedFilenames = new List <String>();
                foreach (var completeFilepath in filePathOperationResult.FileNames)
                {
                    ((List <String>)processedFilenames).Add(System.IO.Path.GetFileName(completeFilepath));
                }
            }
            else
            {
                var paths = this.GetDictionaryWithElement(fileauditedpermissions53_objectItemsChoices.path, objectToCollect.GetAllObjectEntities());
                processedPaths = this.PathOperatorEvaluator.ProcessOperationsPaths(paths);

                var fileNames = this.GetDictionaryWithElement(fileauditedpermissions53_objectItemsChoices.filename, objectToCollect.GetAllObjectEntities());
                processedFilenames = this.PathOperatorEvaluator.ProcessOperationFileName(fileNames, processedPaths, false);
            }

            var trusteeSID = ((EntitySimpleBaseType)objectToCollect.GetItemValue(fileauditedpermissions53_objectItemsChoices.trustee_sid));
            var xpaths     = new string[] { trusteeSID.Value };

            return(this.CreateFileItemTypesByCombinationOfEntitiesFrom(processedPaths, processedFilenames, xpaths));
        }
        private IEnumerable <String> EvaluateEntity(
            fileauditedpermissions53_object fileAuditedPermissions53Object,
            fileauditedpermissions53_objectItemsChoices entityName)
        {
            var entity = fileAuditedPermissions53Object.GetAllObjectEntities()[entityName.ToString()];

            return(this.VariableEntityEvaluator.EvaluateVariableForEntity(entity));
        }
 private void CreateFileObjectsWithFilePath(fileauditedpermissions53_object objectType,
                                            string[] filepaths, string[] trusteeSIDs, List <ObjectType> fileAuditedObjects)
 {
     foreach (string filepath in filepaths)
     {
         foreach (string trusteeSID in trusteeSIDs)
         {
             fileAuditedObjects.Add(this.CreateObjectTypeFrom(objectType, filepath, null, null, trusteeSID));
         }
     }
 }
        public IEnumerable <ObjectType> CreateFileAuditedPermissions53Objects(
            fileauditedpermissions53_object objectType,
            string[] filepaths, string[] paths, string[] filenames, string[] trusteeSIDs)
        {
            var objects = new List <ObjectType>();

            if (!objectType.IsFilePathDefined())
            {
                this.CreateFileObjectsWithoutFilePath(objectType, filenames, paths, trusteeSIDs, objects);
            }
            else
            {
                this.CreateFileObjectsWithFilePath(objectType, filepaths, trusteeSIDs, objects);
            }

            return(objects);
        }
        private ObjectType CreateObjectTypeFrom(fileauditedpermissions53_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(fileauditedpermissions53_objectItemsChoices.trustee_sid);
            var newTrusteeSID  = this.CreateObjectStringTypeFrom(trusteeSIDfrom);

            newTrusteeSID.Value = string.IsNullOrEmpty(trusteeSID) ? newTrusteeSID.Value : trusteeSID;

            if (objectType.IsFilePathDefined())
            {
                filePathFrom      = (EntityObjectStringType)objectType.GetItemValue(fileauditedpermissions53_objectItemsChoices.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(fileauditedpermissions53_objectItemsChoices.path);
                fileNameFrom = (EntityObjectStringType)objectType.GetItemValue(fileauditedpermissions53_objectItemsChoices.filename);

                newPath       = this.CreateObjectStringTypeFrom(pathFrom);
                newPath.Value = string.IsNullOrEmpty(path) ? newPath.Value : path;

                newFileName       = this.CreateObjectStringTypeFrom(fileNameFrom);
                newFileName.Value = string.IsNullOrEmpty(filename) ? newFileName.Value : filename;

                return(this.CreateFileObject(null, newFileName, newPath, newTrusteeSID));
            }
        }