Example #1
0
def main():
    # Instantiate a dummy authorizer for managing 'virtual' users
    authorizer = DummyAuthorizer()
    # Define a new user having full r/w permissions
    authorizer.add_user('user_name',
                        'pass_word',
                        './',
                        perm='elradfmwM',
                        msg_login='******',
                        msg_quit='bye')
    # Define a read-only anonymous user
    authorizer.add_anonymous('./')

    # Instantiate FTP handler class
    handler = FTPHandler
    handler.authorizer = authorizer
    handler.max_login_attempts = 3
    handler.permit_foreign_addresses = True
    handler.tcp_no_delay = True

    # Define a customized banner (string returned when client connects)
    handler.banner = "Welcome to my FTP."

    # Instantiate FTP server class and listen on 127.0.0.1:21
    address = ('0.0.0.0', 2121)
    server = FTPServer(address, handler)

    # set a limit for connections
    server.max_cons = 128
    server.max_cons_per_ip = 2

    absfs = AbstractedFS(u"./", handler)
    absfs.cwd = u"/bbb/ss/"
    # start ftp server
    server.serve_forever()
Example #2
0
def main():
    # Instantiate a dummy authorizer for managing 'virtual' users
    authorizer = DummyAuthorizer()
    # Define a new user having full r/w permissions
    authorizer.add_user("user_name", "pass_word", "./", perm="elradfmwM", msg_login="******", msg_quit="bye")
    # Define a read-only anonymous user
    authorizer.add_anonymous("./")

    # Instantiate FTP handler class
    handler = FTPHandler
    handler.authorizer = authorizer
    handler.max_login_attempts = 3
    handler.permit_foreign_addresses = True
    handler.tcp_no_delay = True

    # Define a customized banner (string returned when client connects)
    handler.banner = "Welcome to my FTP."

    # Instantiate FTP server class and listen on 127.0.0.1:21
    address = ("0.0.0.0", 2121)
    server = FTPServer(address, handler)

    # set a limit for connections
    server.max_cons = 128
    server.max_cons_per_ip = 2

    absfs = AbstractedFS(u"./", handler)
    absfs.cwd = u"/bbb/ss/"
    # start ftp server
    server.serve_forever()
Example #3
0
 def test_validpath(self):
     # Tests for validpath method.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     self.assertTrue(fs.validpath(HOME))
     self.assertTrue(fs.validpath(HOME + '/'))
     self.assertFalse(fs.validpath(HOME + 'bar'))
Example #4
0
 def __init__(self, root, cmd_channel):
     assert isinstance(root, unicode), root
     AbstractedFS.__init__(self, root, cmd_channel)
     bucket_name = root.strip('/')
     bucket_info = cmd_channel.authorizer.get_bucket_info(bucket_name)
     access_key_id, access_key_secret= bucket_info.access_key.items()[0]
     endpoint = bucket_info.endpoint
     self.obs_fs_callback = FTPOpCallback.FTPOpCallback(bucket_name, endpoint, access_key_id, access_key_secret)
Example #5
0
 def __init__(self, root, cmd_channel):
     assert isinstance(root, unicode), root
     AbstractedFS.__init__(self, root, cmd_channel)
     bucket_name = root.strip('/')
     bucket_info = cmd_channel.authorizer.get_bucket_info(bucket_name)
     access_key_id, access_key_secret= bucket_info.access_key.items()[0]
     endpoint = bucket_info.endpoint
     self.oss_fs_impl = oss_fs_impl.OssFsImpl(bucket_name, endpoint, access_key_id, access_key_secret)
Example #6
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     testfn = self.get_testfn()
     testfn2 = self.get_testfn()
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     touch(testfn)
     os.symlink(testfn, testfn2)
     self.assertTrue(fs.validpath(u(testfn)))
Example #7
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
Example #8
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
Example #9
0
    def open(self, filename, mode):
        path, name = os.path.split(filename)
        name = text.get_valid_filename(name)

        if "w" in mode:
            if self.has_access(path, Access.UPLOAD):
                return AbstractedFS.open(self, filename, mode)
            else:
                raise FilesystemError("invalid path")
        else:
            if self.has_access(path, Access.FETCH):
                return AbstractedFS.open(self, filename, mode)
            else:
                raise FilesystemError("invalid path")
Example #10
0
 def __init__(self, root, cmd_channel):
     assert isinstance(root, unicode), root
     AbstractedFS.__init__(self, root, cmd_channel)
     bucket_name = root.strip('/')
     if bucket_name.find('/') > -1:
         index = bucket_name.find('/')
         bucket_name = bucket_name[:index]
     bucket_info = cmd_channel.authorizer.get_bucket_info(bucket_name)
     access_key_id, access_key_secret = list(
         bucket_info.access_key.items())[0]
     endpoint = bucket_info.endpoint
     self.oss_fs_impl = oss_fs_impl.OssFsImpl(bucket_name, endpoint,
                                              access_key_id,
                                              access_key_secret)
Example #11
0
 def test_validpath_external_symlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # outside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     # tempfile should create our file in /tmp directory
     # which should be outside the user root.  If it is
     # not we just skip the test.
     with tempfile.NamedTemporaryFile() as file:
         try:
             if HOME == os.path.dirname(file.name):
                 return
             os.symlink(file.name, TESTFN)
             self.assertFalse(fs.validpath(u(TESTFN)))
         finally:
             safe_remove(TESTFN)
Example #12
0
 def test_validpath_external_symlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # outside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     # tempfile should create our file in /tmp directory
     # which should be outside the user root.  If it is
     # not we just skip the test.
     with tempfile.NamedTemporaryFile() as file:
         try:
             if HOME == os.path.dirname(file.name):
                 return
             os.symlink(file.name, TESTFN)
             self.assertFalse(fs.validpath(u(TESTFN)))
         finally:
             safe_remove(TESTFN)
Example #13
0
 def remove(self, path):
     """Handle operations of same name"""
     ftp_path = self.fs2ftp(path)
     # Prevent removal of special files
     if in_vgrid_share(configuration, path) == ftp_path[1:]:
         logger.error("remove on vgrid src %s :: %s" % (ftp_path, path))
         raise FilesystemError("requested remove not allowed")
     return AbstractedFS.remove(self, path)
Example #14
0
    def test_fs2ftp(self):
        # Tests for fs2ftp method.
        def join(x, y):
            return os.path.join(x, y.replace('/', os.sep))

        ae = self.assertEqual
        fs = AbstractedFS(u('/'), None)

        def goforit(root):
            fs._root = root
            ae(fs.fs2ftp(root), u('/'))
            ae(fs.fs2ftp(join(root, u('/'))), u('/'))
            ae(fs.fs2ftp(join(root, u('.'))), u('/'))
            # can't escape from root
            ae(fs.fs2ftp(join(root, u('..'))), u('/'))
            ae(fs.fs2ftp(join(root, u('a'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('a/'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('a/..'))), u('/'))
            ae(fs.fs2ftp(join(root, u('a/b'))), u('/a/b'))
            ae(fs.fs2ftp(join(root, u('a/b'))), u('/a/b'))
            ae(fs.fs2ftp(join(root, u('a/b/..'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('/a/b/../..'))), u('/'))
            fs._cwd = u('/sub')
            ae(fs.fs2ftp(join(root, 'a/')), u('/a'))

        if os.sep == '\\':
            goforit(u(r'C:\dir'))
            goforit(u('C:\\'))
            # on DOS-derived filesystems (e.g. Windows) this is the same
            # as specifying the current drive directory (e.g. 'C:\\')
            goforit(u('\\'))
            fs._root = u(r'C:\dir')
            ae(fs.fs2ftp(u('C:\\')), u('/'))
            ae(fs.fs2ftp(u('D:\\')), u('/'))
            ae(fs.fs2ftp(u('D:\\dir')), u('/'))
        elif os.sep == '/':
            goforit(u('/'))
            if os.path.realpath('/__home/user') != '/__home/user':
                self.fail('Test skipped (symlinks not allowed).')
            goforit(u('/__home/user'))
            fs._root = u('/__home/user')
            ae(fs.fs2ftp(u('/__home')), u('/'))
            ae(fs.fs2ftp(u('/')), u('/'))
            ae(fs.fs2ftp(u('/__home/userx')), u('/'))
        else:
            # os.sep == ':'? Don't know... let's try it anyway
            goforit(getcwdu())
Example #15
0
 def test_validpath(self):
     # Tests for validpath method.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     self.assertTrue(fs.validpath(HOME))
     self.assertTrue(fs.validpath(HOME + '/'))
     self.assertFalse(fs.validpath(HOME + 'bar'))
Example #16
0
    def test_ftp2fs(self):
        # Tests for ftp2fs method.
        def join(x, y):
            return os.path.join(x, y.replace('/', os.sep))

        ae = self.assertEqual
        fs = AbstractedFS(u('/'), None)

        def goforit(root):
            fs._root = root
            fs._cwd = u('/')
            ae(fs.ftp2fs(u('')), root)
            ae(fs.ftp2fs(u('/')), root)
            ae(fs.ftp2fs(u('.')), root)
            ae(fs.ftp2fs(u('..')), root)
            ae(fs.ftp2fs(u('a')), join(root, u('a')))
            ae(fs.ftp2fs(u('/a')), join(root, u('a')))
            ae(fs.ftp2fs(u('/a/')), join(root, u('a')))
            ae(fs.ftp2fs(u('a/..')), root)
            ae(fs.ftp2fs(u('a/b')), join(root, u(r'a/b')))
            ae(fs.ftp2fs(u('/a/b')), join(root, u(r'a/b')))
            ae(fs.ftp2fs(u('/a/b/..')), join(root, u('a')))
            ae(fs.ftp2fs(u('/a/b/../..')), root)
            fs._cwd = u('/sub')
            ae(fs.ftp2fs(u('')), join(root, u('sub')))
            ae(fs.ftp2fs(u('/')), root)
            ae(fs.ftp2fs(u('.')), join(root, u('sub')))
            ae(fs.ftp2fs(u('..')), root)
            ae(fs.ftp2fs(u('a')), join(root, u('sub/a')))
            ae(fs.ftp2fs(u('a/')), join(root, u('sub/a')))
            ae(fs.ftp2fs(u('a/..')), join(root, u('sub')))
            ae(fs.ftp2fs(u('a/b')), join(root, 'sub/a/b'))
            ae(fs.ftp2fs(u('a/b/..')), join(root, u('sub/a')))
            ae(fs.ftp2fs(u('a/b/../..')), join(root, u('sub')))
            ae(fs.ftp2fs(u('a/b/../../..')), root)
            # UNC paths must be collapsed
            ae(fs.ftp2fs(u('//a')), join(root, u('a')))

        if os.sep == '\\':
            goforit(u(r'C:\dir'))
            goforit(u('C:\\'))
            # on DOS-derived filesystems (e.g. Windows) this is the same
            # as specifying the current drive directory (e.g. 'C:\\')
            goforit(u('\\'))
        elif os.sep == '/':
            goforit(u('/home/user'))
            goforit(u('/'))
        else:
            # os.sep == ':'? Don't know... let's try it anyway
            goforit(getcwdu())
Example #17
0
    def test_fs2ftp(self):
        # Tests for fs2ftp method.
        def join(x, y):
            return os.path.join(x, y.replace('/', os.sep))

        ae = self.assertEqual
        fs = AbstractedFS(u('/'), None)

        def goforit(root):
            fs._root = root
            ae(fs.fs2ftp(root), u('/'))
            ae(fs.fs2ftp(join(root, u('/'))), u('/'))
            ae(fs.fs2ftp(join(root, u('.'))), u('/'))
            # can't escape from root
            ae(fs.fs2ftp(join(root, u('..'))), u('/'))
            ae(fs.fs2ftp(join(root, u('a'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('a/'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('a/..'))), u('/'))
            ae(fs.fs2ftp(join(root, u('a/b'))), u('/a/b'))
            ae(fs.fs2ftp(join(root, u('a/b'))), u('/a/b'))
            ae(fs.fs2ftp(join(root, u('a/b/..'))), u('/a'))
            ae(fs.fs2ftp(join(root, u('/a/b/../..'))), u('/'))
            fs._cwd = u('/sub')
            ae(fs.fs2ftp(join(root, 'a/')), u('/a'))

        if os.sep == '\\':
            goforit(u(r'C:\dir'))
            goforit(u('C:\\'))
            # on DOS-derived filesystems (e.g. Windows) this is the same
            # as specifying the current drive directory (e.g. 'C:\\')
            goforit(u('\\'))
            fs._root = u(r'C:\dir')
            ae(fs.fs2ftp(u('C:\\')), u('/'))
            ae(fs.fs2ftp(u('D:\\')), u('/'))
            ae(fs.fs2ftp(u('D:\\dir')), u('/'))
        elif os.sep == '/':
            goforit(u('/'))
            if os.path.realpath('/__home/user') != '/__home/user':
                self.fail('Test skipped (symlinks not allowed).')
            goforit(u('/__home/user'))
            fs._root = u('/__home/user')
            ae(fs.fs2ftp(u('/__home')), u('/'))
            ae(fs.fs2ftp(u('/')), u('/'))
            ae(fs.fs2ftp(u('/__home/userx')), u('/'))
        else:
            # os.sep == ':'? Don't know... let's try it anyway
            goforit(getcwdu())
Example #18
0
 def chmod(self, path, mode):
     """Change file/directory mode with MiG restrictions"""
     real_path = self.ftp2fs(path)
     daemon_conf = configuration.daemon_conf
     self.chmod_exceptions = daemon_conf['chmod_exceptions']
     # Only allow change of mode on files and only outside chmod_exceptions
     if self._acceptable_chmod(path, mode):
         # Only allow permission changes that won't give excessive access
         # or remove own access.
         if os.path.isdir(path):
             new_mode = (mode & 0775) | 0750
         else:
             new_mode = (mode & 0775) | 0640
         logger.info("chmod %s (%s) without damage on %s :: %s" % \
                     (new_mode, mode, path, real_path))
         return AbstractedFS.chmod(self, path, new_mode)
     # Prevent users from messing up access modes
     logger.error("chmod %s rejected on path %s :: %s" % (mode, path,
                                                          real_path))
     raise FilesystemError("requested permission change no allowed")
Example #19
0
    def chmod(self, path, mode):
        """Change file/directory mode with MiG restrictions"""
        real_path = self.ftp2fs(path)
        daemon_conf = configuration.daemon_conf
        self.chmod_exceptions = daemon_conf['chmod_exceptions']
        # Only allow change of mode on files and only outside chmod_exceptions
        if not self._acceptable_chmod(path, mode):
            # Prevent users from messing up access modes
            logger.warning("chmod %s rejected on path %s :: %s" %
                           (mode, path, real_path))
            raise FilesystemError("requested permission change not allowed")

        # Only allow permission changes that won't give excessive access
        # or remove own access.
        if os.path.isdir(path):
            new_mode = (mode & 0775) | 0750
        else:
            new_mode = (mode & 0775) | 0640
        logger.info("chmod %s (%s) without damage on %s :: %s" %
                    (new_mode, mode, path, real_path))
        return AbstractedFS.chmod(self, path, new_mode)
Example #20
0
    def __init__(self, *args, **kwargs):
        AbstractedFS.__init__(self, *args, **kwargs)

        self.conn = self.cmd_channel.authorizer.conn
Example #21
0
 def __init__(self, root, cmd_channel):
     AbstractedFS.__init__(self, root, cmd_channel)
     self.fakecloudfs = FakeCloudFS()
     self.user = cmd_channel.authorizer.user
     self.filelist = (None, None)
Example #22
0
 def init_abstracted_fs(self, root, cmd_channel):
     AbstractedFS.__init__(self, root, cmd_channel)
Example #23
0
    def test_ftpnorm(self):
        # Tests for ftpnorm method.
        ae = self.assertEqual
        fs = AbstractedFS(u('/'), None)

        fs._cwd = u('/')
        ae(fs.ftpnorm(u('')), u('/'))
        ae(fs.ftpnorm(u('/')), u('/'))
        ae(fs.ftpnorm(u('.')), u('/'))
        ae(fs.ftpnorm(u('..')), u('/'))
        ae(fs.ftpnorm(u('a')), u('/a'))
        ae(fs.ftpnorm(u('/a')), u('/a'))
        ae(fs.ftpnorm(u('/a/')), u('/a'))
        ae(fs.ftpnorm(u('a/..')), u('/'))
        ae(fs.ftpnorm(u('a/b')), '/a/b')
        ae(fs.ftpnorm(u('a/b/..')), u('/a'))
        ae(fs.ftpnorm(u('a/b/../..')), u('/'))
        fs._cwd = u('/sub')
        ae(fs.ftpnorm(u('')), u('/sub'))
        ae(fs.ftpnorm(u('/')), u('/'))
        ae(fs.ftpnorm(u('.')), u('/sub'))
        ae(fs.ftpnorm(u('..')), u('/'))
        ae(fs.ftpnorm(u('a')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/..')), u('/sub'))
        ae(fs.ftpnorm(u('a/b')), u('/sub/a/b'))
        ae(fs.ftpnorm(u('a/b/')), u('/sub/a/b'))
        ae(fs.ftpnorm(u('a/b/..')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/b/../..')), u('/sub'))
        ae(fs.ftpnorm(u('a/b/../../..')), u('/'))
        ae(fs.ftpnorm(u('//')), u('/'))  # UNC paths must be collapsed
Example #24
0
    def __init__(self, *args, **kwargs):
        AbstractedFS.__init__(self, *args, **kwargs)

        self.conn = self.cmd_channel.authorizer.conn
Example #25
0
def start_transd(type1,ip,port,local):
	global tftpSer
	global ftpSer
	global httpSer
	global socketSer
	global conSer
	global SOC_S
	print(type1,ip,port,local)
	if type1 == "tftp":
		tftpSer = tftp.TftpServer(local)
		tftpSer.listen(ip,int(port))
	elif type1 == "ftp":
		# Instantiate a dummy authorizer for managing 'virtual' users
	    authorizer = DummyAuthorizer()
	    # Define a new user having full r/w permissions
	    authorizer.add_user('user_name', 'pass_word','./', perm='elradfmwM',msg_login='******',msg_quit='bye')
	    # Define a read-only anonymous user
	    authorizer.add_anonymous(local)
	 
	    # Instantiate FTP handler class
	    handler = FTPHandler
	    handler.authorizer = authorizer
	    handler.max_login_attempts = 3
	    handler.permit_foreign_addresses = True
	    handler.tcp_no_delay = True
	 
	    # Define a customized banner (string returned when client connects)
	    handler.banner = "Welcome to my FTP."
	 
	    # Instantiate FTP server class and listen on 127.0.0.1:21
	    address = (ip, int(port))
	    ftpSer = FTPServer(address, handler)
	 
	    # set a limit for connections
	    ftpSer.max_cons = 128 
	    ftpSer.max_cons_per_ip = 2
	 
	    absfs = AbstractedFS(unicode(local),handler)
	    #absfs.cwd = u"/bbb/ss/"
	    # start ftp server
	    ftpSer.serve_forever()
	elif type1 == "http":
		HandlerClass = SimpleHTTPRequestHandler
		ServerClass  = BaseHTTPServer.HTTPServer
		Protocol     = "HTTP/1.0"
		server_address = (ip,int(port))
		HandlerClass.protocol_version = Protocol
		httpSer = ServerClass(server_address, HandlerClass)
		sa = httpSer.socket.getsockname()
		print "Serving HTTP on", sa[0], "port", sa[1], "..."
		httpSer.serve_forever()
	elif type1 == "socket":
		#tcp
		socketSer = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		bi = socketSer.bind((ip,int(port)))
		socketSer.listen(2)
		conSer,addr = socketSer.accept()
		while SOC_S == True:
			try:
				conSer.send("hi")
				rcv = conSer.recv(10240)
				print(rcv)
				#time.sleep(3)
			except Exception, e:
				conSer.close()
				print("s1 error")
				break
		print("socket close")
		conSer.close()
Example #26
0
 def listdir(self, path):
     # do_db_stuff()
     return AbstractedFS.listdir(self, path)
Example #27
0
 def open(self, filename, mode):
     # do_db_stuff()
     return AbstractedFS.open(self, filename, mode)
Example #28
0
 def listdir(self, path):
     """List the content of a directory with MiG restrictions"""
     return [
         i for i in AbstractedFS.listdir(self, path)
         if not invisible_path(i)
     ]
Example #29
0
 def __init__(self, root, cmd_channel):
     AbstractedFS.__init__(self, root, cmd_channel)
Example #30
0
    def test_ftpnorm(self):
        # Tests for ftpnorm method.
        ae = self.assertEqual
        fs = AbstractedFS(u('/'), None)

        fs._cwd = u('/')
        ae(fs.ftpnorm(u('')), u('/'))
        ae(fs.ftpnorm(u('/')), u('/'))
        ae(fs.ftpnorm(u('.')), u('/'))
        ae(fs.ftpnorm(u('..')), u('/'))
        ae(fs.ftpnorm(u('a')), u('/a'))
        ae(fs.ftpnorm(u('/a')), u('/a'))
        ae(fs.ftpnorm(u('/a/')), u('/a'))
        ae(fs.ftpnorm(u('a/..')), u('/'))
        ae(fs.ftpnorm(u('a/b')), '/a/b')
        ae(fs.ftpnorm(u('a/b/..')), u('/a'))
        ae(fs.ftpnorm(u('a/b/../..')), u('/'))
        fs._cwd = u('/sub')
        ae(fs.ftpnorm(u('')), u('/sub'))
        ae(fs.ftpnorm(u('/')), u('/'))
        ae(fs.ftpnorm(u('.')), u('/sub'))
        ae(fs.ftpnorm(u('..')), u('/'))
        ae(fs.ftpnorm(u('a')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/..')), u('/sub'))
        ae(fs.ftpnorm(u('a/b')), u('/sub/a/b'))
        ae(fs.ftpnorm(u('a/b/')), u('/sub/a/b'))
        ae(fs.ftpnorm(u('a/b/..')), u('/sub/a'))
        ae(fs.ftpnorm(u('a/b/../..')), u('/sub'))
        ae(fs.ftpnorm(u('a/b/../../..')), u('/'))
        ae(fs.ftpnorm(u('//')), u('/'))  # UNC paths must be collapsed
 def __init__(self, root, cmd_channel):
     
     # Always use a temporary directory as the FTP root.
     self.ftp_dir = unicode(tempfile.mkdtemp(prefix='zOSFTPSIM_'))
     
     AbstractedFS.__init__(self, self.ftp_dir, cmd_channel)
Example #32
0
 def __init__(self, root, cmd_channel):
     self.devid = root
     AbstractedFS.__init__(self, u'/', cmd_channel)
Example #33
0
 def listdir(self, path):
     """List the content of a directory with MiG restrictions"""
     return [i for i in AbstractedFS.listdir(self, path) if not \
             invisible_path(i)]
Example #34
0
 def init_abstracted_fs(self, root, cmd_channel):
     AbstractedFS.__init__(self, root, cmd_channel)
Example #35
0
 def chdir(self, path):
     if self.has_access(path, [Access.LIST, Access.MKDIR, Access.UPLOAD]):
         return AbstractedFS.chdir(self, path)
     else:
         raise FilesystemError("invalid path")
Example #36
0
 def mkstemp(self, suffix='', prefix='', dir=None, mode='wb'):
     # do_db_stuff()
     return AbstractedFS.mkstemp(self, file, "tmpfile")
Example #37
0
 def mkdir(self, path):
     if self.has_access(path, Access.MKDIR):
         return AbstractedFS.mkdir(self, path)
     else:
         raise FilesystemError("invalid path")
Example #38
0
 def listdir(self):
     abstractedfs = AbstractedFS(users.dir, self.handler)
Example #39
0
 def remove(self, path):
     if self.has_access(path, Access.DELETE):
         return AbstractedFS.remove(self, path)
     else:
         raise FilesystemError("invalid path")