Example #1
0
        public virtual bool HasAccess(string path, AccessModes modes)
        {
            if (FileSystem.File.Exists(path))
            {
                return(PermissionHelper.CheckPathAccessModes(
                           new UnixFileInfo(FileSystem.FileInfo.FromFileName(path).FullName).FileAccessPermissions, modes));
            }

            if (!FileSystem.Directory.Exists(path))
            {
                throw new FileNotFoundException();
            }

            return(PermissionHelper.CheckPathAccessModes(
                       new UnixDirectoryInfo(
                           FileSystem.DirectoryInfo.FromDirectoryName(path).FullName
                           ).FileAccessPermissions,
                       modes
                       ));
        }
        public override bool HasAccess(string path, AccessModes modes)
        {
            var path_enc = GetEncryptedPath(path, true);

            if (string.IsNullOrEmpty(path_enc))
            {
                return(false);
            }

            if (FileSystem.File.Exists(path))
            {
                return(PermissionHelper.CheckPathAccessModes(
                           new UnixFileInfo(path_enc.GetPath(_source)).FileAccessPermissions,
                           modes
                           ));
            }
            return(PermissionHelper.CheckPathAccessModes(
                       new UnixDirectoryInfo(path_enc.GetPath(_source)).FileAccessPermissions,
                       modes
                       ));
        }