mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
both permitted_actions and groups are set appropriately on datasets. Somewhat tested and mostly working, but needs more testing. Greg: If a userless session has a history, if that user logs in, the DefaultHistoryGroupAssociation for the current history as well as the datasets in that history are supposed to be updated with the permissions in DefaultUserGroupAssociation, but this isn't happening. Possibly because the default permissions on userless histories create datasets in the public group with only the DATASET_ACCESS permission (or possibly for another reason). What are the implications of giving public users DATASET_MANAGE_PERMISSIONS?
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
import pkg_resources; pkg_resources.require( "bx-python" )
|
|
from bx.align import maf
|
|
from galaxy import datatypes, config, jobs
|
|
from shutil import move
|
|
|
|
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
|
|
output_data = out_data.items()[0][1]
|
|
history = output_data.history
|
|
if history == None:
|
|
print "unknown history!"
|
|
return
|
|
new_stdout = ""
|
|
split_stdout = stdout.split("\n")
|
|
basic_name = output_data.name
|
|
output_data_list = []
|
|
for line in split_stdout:
|
|
if line.startswith("#FILE1"):
|
|
fields = line.split("\t")
|
|
dbkey = fields[1]
|
|
filepath = fields[2]
|
|
output_data.dbkey = dbkey
|
|
output_data.name = basic_name + " (" + dbkey + ")"
|
|
output_data.flush()
|
|
app.model.flush()
|
|
output_data_list.append(output_data)
|
|
elif line.startswith("#FILE"):
|
|
fields = line.split("\t")
|
|
dbkey = fields[1]
|
|
filepath = fields[2]
|
|
newdata = app.model.HistoryDatasetAssociation( create_dataset = True )
|
|
newdata.extension = "bed"
|
|
newdata.name = basic_name + " (" + dbkey + ")"
|
|
newdata.flush()
|
|
history.add_dataset( newdata )
|
|
app.security_agent.set_dataset_permissions( newdata.dataset, output_data.dataset.groups )
|
|
newdata.flush()
|
|
history.flush()
|
|
app.model.flush()
|
|
try:
|
|
move(filepath,newdata.file_name)
|
|
newdata.info = newdata.name
|
|
newdata.state = newdata.states.OK
|
|
except:
|
|
newdata.info = "The requested file is missing from the system."
|
|
newdata.state = newdata.states.ERROR
|
|
newdata.dbkey = dbkey
|
|
newdata.init_meta()
|
|
newdata.set_peek()
|
|
newdata.set_size()
|
|
app.model.flush()
|
|
output_data_list.append(newdata)
|
|
else:
|
|
new_stdout = new_stdout + line
|
|
for data in output_data_list:
|
|
if data.state == data.states.OK:
|
|
data.info = new_stdout
|
|
data.flush()
|