Beispiel #1
0
def list(	path,
			permissions = None ):
	
	if __check_authentication(path, 'r', permissions): #check permissions to read directory
		return PALDatastore.list_bucket(path) #call into PAL to list bucket

	return False #return false on failure
Beispiel #2
0
def open(	path,
			mode = 'r',
			permissions = None):
	if __check_authentication( path, mode, permissions):
		if check_exists( path, permissions):
			return PALDatastore.open( path, mode )

	return False
Beispiel #3
0
def check_exists (	path,
					permissions):
	if __check_authentication ( path, 'r' , permissions ):
		if PALDatastore.stat( path ) is None :
			return False
		else:
			return True
	else:
		return False
Beispiel #4
0
def delete( path,
			permissions = None,
			allow_dir = False ):
			
	if allow_dir:
		return False
	else:
		if __check_authentication(path, 'd'):
			return PALDatastore.delete(path)

	return False
Beispiel #5
0
def append(	path,
			blob,
			permissions = None	):
	if __check_authentication( path, 'a', permissions):
		if check_exists( path, permissions ):
			file_handle = PALDatastore.open( path, 'a')
			file_handle.write(blob)
			return True
		else:
			return False
	else:
		return False
Beispiel #6
0
def add_file(	path,
				name = None,
				blob = None,
				mode = None,
				permissions = None ):
	if check_exists( path, permissions ):
		return False
	else:
		file_handle = PALDatastore.open(path,'w')
		if file_handle is None:
			return False
		if blob is not None:
			file_handle.write(blob)
		file_handle.close()
		userobj = users.get_current_user()
		permis = Permissions(True,True,True)
		__add_authentication(path, name, userobj, permis)
		if mode is None:
			return False
		else:
			return PALDatastore.open(path, mode)
Beispiel #7
0
def add_directory(	path,
					permissions = None	):
	if check_exists(path, permissions):
		return False
	else:
		if check_exists(get_container(path),permissions):
			file_handle = PALDatastore.open(path, 'w')
			if file_handle is None:
				return False
			else:
				file_handle.close();
				return True
		else:
			return False
Beispiel #8
0
def get_file_info(file_name):
	return PALDatastore.stat(file_name)