Beispiel #1
0
 def ShareTool(self, tool_id, user_name, permissions):
     tool = self.GetTool(tool_id)
     user = User.objects.get(username=user_name)
     
     Tools.ShareTool(self.user, tool, user, Run=permissions["Run"], 
         Export=permissions["Export"], Publish=permissions["Publish"], 
         Edit=permissions["Edit"], Admin=permissions["Admin"]
     )
Beispiel #2
0
 def AddTool(self, tool):
     with transaction.atomic():
         #create the tool
         tool = Tools.AddTool(self.user, tool["ToolName"], 
             tool["Category"], tool["ToolDescription"], False)
         
         #create the development tool version
         toolversion = ToolVersions.AddToolVersion(self.user, tool, "dev", 
             tool.ToolDescription, "")
         
         self.make_tool_directory(tool.ToolID, toolversion.ToolVersionNum)
     
     return toolversion
Beispiel #3
0
 def UpdateTool(self, tool_id, version):
     tool = self.GetTool(tool_id)
     with transaction.atomic():
         #update tool details
         tool_details = version["Tool"]
         tool = Tools.UpdateTool(self.user, tool, 
             ToolName=tool_details["ToolName"], 
             CategoryID=tool_details["CategoryID"],
             ToolDescription=version["ShortDescription"]
         )
         
         #update version details
         tool_version = self.GetToolVersion(tool, "dev")
         tool_version = ToolVersions.UpdateToolVersion(self.user,
             tool_version, version["ShortDescription"], 
             version["LongDescription"], version["Command"]
         )
         
         #update parameters
         for i, p in enumerate(version["Parameters"]):
             parameter = self.UpdateParameter(p, i)
         
         #update/add expected outputs
         for o in version["ExpectedOutputs"]:
             if o["ExpectedOutputID"]:
                 self.UpdateExpectedOutput(o)
             else:
                 self.AddExpectedOutput(tool, o)
         
         #update/add default resources
         Resources.UpdateResources(self.user, tool_version, 
             settings.JMS_SETTINGS["resource_manager"]["name"],
             version["Resources"]
         )
         
     return tool
Beispiel #4
0
 def UnshareTool(self, tool_id, user_name):
     tool = self.GetTool(tool_id)
     user = User.objects.get(username=user_name)
     Tools.UnshareTool(self.user, tool, user)
Beispiel #5
0
 def DeleteToolFile(self, tool_id, filename):
     path = os.path.join(self.base_dir, "tools/%s/dev/%s" % (tool_id, filename))
     Tools.DeleteFile(self.user, tool_id, path)
Beispiel #6
0
 def ReadToolFile(self, tool_id, filename):
     path = os.path.join(self.base_dir, "tools/%s/dev/%s" % (tool_id, filename))
     return Tools.ReadFile(self.user, tool_id, path)
Beispiel #7
0
 def SaveToolFile(self, tool_id, filename, content):
     tool_dir = self.make_tool_directory(int(tool_id), "dev")
     path = os.path.join(tool_dir, filename)
     Tools.SaveFile(self.user, tool_id, path, content)
Beispiel #8
0
 def UploadToolFiles(self, tool_id, file_dict):
     path = self.make_tool_directory(int(tool_id), "dev")
     return Tools.UploadFiles(self.user, tool_id, path, file_dict)
Beispiel #9
0
 def GetToolFiles(self, tool_id):
     path = self.make_tool_directory(int(tool_id), "dev")
     return Tools.GetFileList(self.user, tool_id, path)
Beispiel #10
0
 def AddParameter(self, tool_id, parameter_name, parent_id=None):
     tool = Tools.GetTool(self.user, tool_id)
     return Parameters.AddParameter(self.user, tool, parameter_name, parent_id)
Beispiel #11
0
 def UpdateToolAvailability(self, tool_id, publicInd):
     tool = self.GetTool(tool_id)
     return Tools.UpdateAvailability(self.user, tool, publicInd)
Beispiel #12
0
 def DeleteTool(self, tool_id):
     Tools.DeleteTool(self.user, tool_id)
Beispiel #13
0
 def GetTool(self, tool_id):
     return Tools.GetTool(self.user, tool_id)
Beispiel #14
0
 def GetTools(self):
     tools = Tools.GetTools(self.user)
     return tools