Răsfoiți Sursa

[beeswax] Run table example creation as the current user

Romain Rigaux 12 ani în urmă
părinte
comite
1e5a830f87

+ 3 - 3
apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py

@@ -49,13 +49,13 @@ class Command(NoArgsCommand):
     exception = None
 
     try:
-      user = install_sample_user()
-      self._install_tables(user, options['app_name'])
+      install_sample_user() # Documents will belong to this user but we run the install as the current user
+      self._install_tables(options['user'], options['app_name'])
     except Exception, ex:
       exception = ex
 
     try:
-      self._install_queries(user, options['app_name'])
+      self._install_queries(options['user'], options['app_name'])
     except Exception, ex:
       exception = ex
 

+ 1 - 1
apps/beeswax/src/beeswax/views.py

@@ -828,7 +828,7 @@ def install_examples(request):
   if request.method == 'POST':
     try:
       app_name = get_app_name(request)
-      beeswax.management.commands.beeswax_install_examples.Command().handle_noargs(app_name=app_name)
+      beeswax.management.commands.beeswax_install_examples.Command().handle_noargs(app_name=app_name, user=request.user)
       response['status'] = 0
     except Exception, err:
       LOG.exception(err)