Commit dcfbde12 authored by Penom Nom's avatar Penom Nom

check user right on project

parent 3f9ab4a9
......@@ -36,14 +36,25 @@ class AddFiles (BasicNG6Workflow):
self.runobj = None
self.analysisobj = None
self.project = None
if self.args['run_id'] :
self.runobj = Run.get_from_id(self.args["run_id"])
self.project = Project.get_from_run_id(self.args["run_id"])
if self.project is not None and not self.project.is_admin(self.args["admin_login"]):
sys.stderr.write( "The user login '" + self.args["admin_login"] + "' is not allowed to add data on project '" + self.project.name + "'.\n" )
sys.exit()
self.metadata.append("run_id="+str(self.args["run_id"]))
add = self.add_component("AddRawFiles", [ self.runobj, files_to_save, self.args["compression"] ] )
elif self.args['analysis_id'] :
self.analysisobj = Analysis.get_from_id(self.args["analysis_id"])
self.project = self.analysisobj.project
if self.project is not None and not self.project.is_admin(self.args["admin_login"]):
sys.stderr.write( "The user login '" + self.args["admin_login"] + "' is not allowed to add data on project '" + self.project.name + "'.\n" )
sys.exit()
self.metadata.append("analysis_id="+str(self.args["analysis_id"]))
add = self.add_component("AddAnalysisFiles", [ self.analysisobj, files_to_save, True if self.args["compression"] == "gz" else False] )
else :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment