diff fetch_organism_jbrowse.py @ 5:950fb2bf116d draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
author gga
date Fri, 31 Aug 2018 09:33:38 -0400
parents b4a85d0c85b8
children c3b5bc8b4080
line wrap: on
line diff
--- a/fetch_organism_jbrowse.py	Mon Mar 12 06:31:27 2018 -0400
+++ b/fetch_organism_jbrowse.py	Fri Aug 31 09:33:38 2018 -0400
@@ -9,7 +9,7 @@
 import sys
 import time
 
-from webapollo import GuessOrg, OrgOrGuess, WAAuth, WebApolloInstance
+from webapollo import GuessOrg, OrgOrGuess, PermissionCheck, WAAuth, WebApolloInstance
 logging.basicConfig(level=logging.INFO)
 log = logging.getLogger(__name__)
 
@@ -55,6 +55,7 @@
     WAAuth(parser)
     OrgOrGuess(parser)
     parser.add_argument('target_dir', help='Target directory')
+    parser.add_argument('email', help='User Email')
 
     args = parser.parse_args()
 
@@ -65,6 +66,14 @@
         org_cn = org_cn[0]
     org = wa.organisms.findOrganismByCn(org_cn)
 
+    # User must have an account, if not, create it
+    gx_user = wa.users.assertOrCreateUser(args.email)
+
+    # User must have READ access
+
+    if not PermissionCheck(gx_user, org_cn, "READ"):
+        raise Exception("READ permissions are required for this action")
+
     if not os.path.exists(args.target_dir):
         os.makedirs(args.target_dir)