You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/11/04 17:55:23 UTC

[1/7] airavata-php-gateway git commit: AIRAVATA-2190 Project no longer automatically shared

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 693db4ee5 -> 35a9e8e50


AIRAVATA-2190 Project no longer automatically shared

When experiment is shared with a user, project is no longer
automatically also shared, which was a workaround on the PGA side for a
data sharing issue that no longer exists with the current implementation.


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/0455ebd7
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/0455ebd7
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/0455ebd7

Branch: refs/heads/develop
Commit: 0455ebd7f3d0a2214e901b9f29b915046b65b620
Parents: 693db4e
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Nov 2 15:58:32 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Nov 2 15:59:55 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  5 ++++-
 app/libraries/ExperimentUtilities.php        | 19 -------------------
 app/views/partials/experiment-info.blade.php |  6 +++++-
 3 files changed, 9 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0455ebd7/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index d7fb40c..4dfc24f 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -123,7 +123,10 @@ class ExperimentController extends BaseController
                 Session::forget("permissionDenied");
 
 
-            $project = ProjectUtilities::get_project($experiment->projectId);
+            $project = null;
+            if (SharingUtilities::userCanRead(Session::get("username"), $experiment->projectId, ResourceType::PROJECT)) {
+                $project = ProjectUtilities::get_project($experiment->projectId);
+            }
             $expVal = ExperimentUtilities::get_experiment_values($experiment);
             $jobDetails = ExperimentUtilities::get_job_details($experiment->experimentId);
 //            var_dump( $jobDetails); exit;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0455ebd7/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 26f555b..32f4323 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -1355,10 +1355,6 @@ class ExperimentUtilities
         $radd = array();
         $rrevoke = array();
 
-        $projperms = GrouperUtilities::getAllAccessibleUsers($experiment->projectId, ResourceType::PROJECT, ResourcePermissionType::READ);
-        $prrevoke = array();
-        $pwrevoke = array();
-
         foreach ($users as $user => $perms) {
             if ($perms->write) {
                 $wadd[$user] = ResourcePermissionType::WRITE;
@@ -1373,11 +1369,6 @@ class ExperimentUtilities
             else {
                 $rrevoke[$user] = ResourcePermissionType::READ;
             }
-
-            if (array_search($user, $projperms) === false) {
-                $prrevoke[$user] = ResourcePermissionType::READ;
-                $pwrevoke[$user] = ResourcePermissionType::WRITE;
-            }
         }
 
         GrouperUtilities::shareResourceWithUsers($expId, ResourceType::EXPERIMENT, $wadd);
@@ -1385,15 +1376,5 @@ class ExperimentUtilities
 
         GrouperUtilities::shareResourceWithUsers($expId, ResourceType::EXPERIMENT, $radd);
         GrouperUtilities::revokeSharingOfResourceFromUsers($expId, ResourceType::EXPERIMENT, $rrevoke);
-
-        GrouperUtilities::shareResourceWithUsers($experiment->projectId, ResourceType::PROJECT, $radd);
-
-        $experiments = ProjectUtilities::get_experiments_in_project($experiment->projectId);
-        foreach ($experiments as $exp) {
-            if ($exp->experimentId !== $expId) {
-                GrouperUtilities::revokeSharingOfResourceFromUsers($exp->experimentId, ResourceType::EXPERIMENT, $prrevoke);
-                GrouperUtilities::revokeSharingOfResourceFromUsers($exp->experimentId, ResourceType::EXPERIMENT, $pwrevoke);
-            }
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0455ebd7/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 2bba34c..d66e8b7 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -46,7 +46,11 @@
         </tr>
         <tr>
             <td><strong>Project</strong></td>
-            <td><?php echo $project->name; ?></td>
+            @if (isset($project))
+            <td>{{{ $project->name }}}</td>
+            @else
+            <td><em>You don't have access to this project.</em></td>
+            @endif
         </tr>
         <tr>
             <td><strong>Owner</strong></td>


[3/7] airavata-php-gateway git commit: AIRAVATA-2190 Updating Thrift stubs

Posted by sc...@apache.org.
AIRAVATA-2190 Updating Thrift stubs


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/0d58af52
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/0d58af52
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/0d58af52

Branch: refs/heads/develop
Commit: 0d58af524d86fefb9566008aab7ab0e39bc571bd
Parents: 071a027
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Nov 4 12:11:37 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Nov 4 12:11:37 2016 -0400

----------------------------------------------------------------------
 app/libraries/Airavata/API/Airavata.php         | 65 +++++++++++++-
 .../Model/AppCatalog/AppDeployment/Types.php    | 92 ++++++++++++++++++++
 .../Model/AppCatalog/ComputeResource/Types.php  | 92 ++++++++++++++++++++
 3 files changed, 245 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0d58af52/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index 7d5325a..5739ce5 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -1225,6 +1225,9 @@ interface AiravataIf {
    *    Once an experiment is cloned, to disambiguate, the users are suggested to provide new metadata. This will again require
    *      the basic experiment metadata like the name and description, intended user, the gateway identifier and if the experiment
    *      should be shared public by default.
+   * @param newExperimentProjectId
+   *    The project in which to create the cloned experiment. This is optional and if null the experiment will be created
+   *      in the same project as the existing experiment.
    * 
    * @return
    *   The server-side generated.airavata.registry.core.experiment.globally unique identifier (Experiment ID) for the newly cloned experiment.
@@ -1256,14 +1259,16 @@ interface AiravataIf {
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $existingExperimentID
    * @param string $newExperimentName
+   * @param string $newExperimentProjectId
    * @return string
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\ExperimentNotFoundException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
+   * @throws \Airavata\API\Error\ProjectNotFoundException
    */
-  public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName);
+  public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId);
   /**
    * 
    * Terminate a running Experiment.
@@ -7066,18 +7071,19 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getJobDetails failed: unknown result");
   }
 
-  public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName)
+  public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId)
   {
-    $this->send_cloneExperiment($authzToken, $existingExperimentID, $newExperimentName);
+    $this->send_cloneExperiment($authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId);
     return $this->recv_cloneExperiment();
   }
 
-  public function send_cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName)
+  public function send_cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId)
   {
     $args = new \Airavata\API\Airavata_cloneExperiment_args();
     $args->authzToken = $authzToken;
     $args->existingExperimentID = $existingExperimentID;
     $args->newExperimentName = $newExperimentName;
+    $args->newExperimentProjectId = $newExperimentProjectId;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -7131,6 +7137,9 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     if ($result->ae !== null) {
       throw $result->ae;
     }
+    if ($result->pnfe !== null) {
+      throw $result->pnfe;
+    }
     throw new \Exception("cloneExperiment failed: unknown result");
   }
 
@@ -29465,6 +29474,10 @@ class Airavata_cloneExperiment_args {
    * @var string
    */
   public $newExperimentName = null;
+  /**
+   * @var string
+   */
+  public $newExperimentProjectId = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -29482,6 +29495,10 @@ class Airavata_cloneExperiment_args {
           'var' => 'newExperimentName',
           'type' => TType::STRING,
           ),
+        4 => array(
+          'var' => 'newExperimentProjectId',
+          'type' => TType::STRING,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -29494,6 +29511,9 @@ class Airavata_cloneExperiment_args {
       if (isset($vals['newExperimentName'])) {
         $this->newExperimentName = $vals['newExperimentName'];
       }
+      if (isset($vals['newExperimentProjectId'])) {
+        $this->newExperimentProjectId = $vals['newExperimentProjectId'];
+      }
     }
   }
 
@@ -29538,6 +29558,13 @@ class Airavata_cloneExperiment_args {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->newExperimentProjectId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -29569,6 +29596,11 @@ class Airavata_cloneExperiment_args {
       $xfer += $output->writeString($this->newExperimentName);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->newExperimentProjectId !== null) {
+      $xfer += $output->writeFieldBegin('newExperimentProjectId', TType::STRING, 4);
+      $xfer += $output->writeString($this->newExperimentProjectId);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -29603,6 +29635,10 @@ class Airavata_cloneExperiment_result {
    * @var \Airavata\API\Error\AuthorizationException
    */
   public $ae = null;
+  /**
+   * @var \Airavata\API\Error\ProjectNotFoundException
+   */
+  public $pnfe = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -29636,6 +29672,11 @@ class Airavata_cloneExperiment_result {
           'type' => TType::STRUCT,
           'class' => '\Airavata\API\Error\AuthorizationException',
           ),
+        6 => array(
+          'var' => 'pnfe',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\ProjectNotFoundException',
+          ),
         );
     }
     if (is_array($vals)) {
@@ -29657,6 +29698,9 @@ class Airavata_cloneExperiment_result {
       if (isset($vals['ae'])) {
         $this->ae = $vals['ae'];
       }
+      if (isset($vals['pnfe'])) {
+        $this->pnfe = $vals['pnfe'];
+      }
     }
   }
 
@@ -29726,6 +29770,14 @@ class Airavata_cloneExperiment_result {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 6:
+          if ($ftype == TType::STRUCT) {
+            $this->pnfe = new \Airavata\API\Error\ProjectNotFoundException();
+            $xfer += $this->pnfe->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -29769,6 +29821,11 @@ class Airavata_cloneExperiment_result {
       $xfer += $this->ae->write($output);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->pnfe !== null) {
+      $xfer += $output->writeFieldBegin('pnfe', TType::STRUCT, 6);
+      $xfer += $this->pnfe->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0d58af52/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
index 29965e7..03d1121 100644
--- a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
@@ -493,6 +493,22 @@ class ApplicationDeploymentDescription {
    * @var \Airavata\Model\AppCatalog\AppDeployment\CommandObject[]
    */
   public $postJobCommands = null;
+  /**
+   * @var string
+   */
+  public $defaultQueueName = null;
+  /**
+   * @var int
+   */
+  public $defaultNodeCount = null;
+  /**
+   * @var int
+   */
+  public $defaultCPUCount = null;
+  /**
+   * @var bool
+   */
+  public $editableByUser = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -575,6 +591,22 @@ class ApplicationDeploymentDescription {
             'class' => '\Airavata\Model\AppCatalog\AppDeployment\CommandObject',
             ),
           ),
+        13 => array(
+          'var' => 'defaultQueueName',
+          'type' => TType::STRING,
+          ),
+        14 => array(
+          'var' => 'defaultNodeCount',
+          'type' => TType::I32,
+          ),
+        15 => array(
+          'var' => 'defaultCPUCount',
+          'type' => TType::I32,
+          ),
+        16 => array(
+          'var' => 'editableByUser',
+          'type' => TType::BOOL,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -614,6 +646,18 @@ class ApplicationDeploymentDescription {
       if (isset($vals['postJobCommands'])) {
         $this->postJobCommands = $vals['postJobCommands'];
       }
+      if (isset($vals['defaultQueueName'])) {
+        $this->defaultQueueName = $vals['defaultQueueName'];
+      }
+      if (isset($vals['defaultNodeCount'])) {
+        $this->defaultNodeCount = $vals['defaultNodeCount'];
+      }
+      if (isset($vals['defaultCPUCount'])) {
+        $this->defaultCPUCount = $vals['defaultCPUCount'];
+      }
+      if (isset($vals['editableByUser'])) {
+        $this->editableByUser = $vals['editableByUser'];
+      }
     }
   }
 
@@ -786,6 +830,34 @@ class ApplicationDeploymentDescription {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 13:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->defaultQueueName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 14:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultNodeCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 15:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultCPUCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 16:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->editableByUser);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -931,6 +1003,26 @@ class ApplicationDeploymentDescription {
       }
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->defaultQueueName !== null) {
+      $xfer += $output->writeFieldBegin('defaultQueueName', TType::STRING, 13);
+      $xfer += $output->writeString($this->defaultQueueName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultNodeCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultNodeCount', TType::I32, 14);
+      $xfer += $output->writeI32($this->defaultNodeCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultCPUCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultCPUCount', TType::I32, 15);
+      $xfer += $output->writeI32($this->defaultCPUCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->editableByUser !== null) {
+      $xfer += $output->writeFieldBegin('editableByUser', TType::BOOL, 16);
+      $xfer += $output->writeBool($this->editableByUser);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0d58af52/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
index 71b4fd7..39acd3c 100644
--- a/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/ComputeResource/Types.php
@@ -522,6 +522,22 @@ class BatchQueue {
    * @var int
    */
   public $maxMemory = null;
+  /**
+   * @var int
+   */
+  public $cpuPerNode = null;
+  /**
+   * @var int
+   */
+  public $defaultNodeCount = null;
+  /**
+   * @var int
+   */
+  public $defaultCPUCount = null;
+  /**
+   * @var bool
+   */
+  public $isDefaultQueue = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -554,6 +570,22 @@ class BatchQueue {
           'var' => 'maxMemory',
           'type' => TType::I32,
           ),
+        8 => array(
+          'var' => 'cpuPerNode',
+          'type' => TType::I32,
+          ),
+        9 => array(
+          'var' => 'defaultNodeCount',
+          'type' => TType::I32,
+          ),
+        10 => array(
+          'var' => 'defaultCPUCount',
+          'type' => TType::I32,
+          ),
+        11 => array(
+          'var' => 'isDefaultQueue',
+          'type' => TType::BOOL,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -578,6 +610,18 @@ class BatchQueue {
       if (isset($vals['maxMemory'])) {
         $this->maxMemory = $vals['maxMemory'];
       }
+      if (isset($vals['cpuPerNode'])) {
+        $this->cpuPerNode = $vals['cpuPerNode'];
+      }
+      if (isset($vals['defaultNodeCount'])) {
+        $this->defaultNodeCount = $vals['defaultNodeCount'];
+      }
+      if (isset($vals['defaultCPUCount'])) {
+        $this->defaultCPUCount = $vals['defaultCPUCount'];
+      }
+      if (isset($vals['isDefaultQueue'])) {
+        $this->isDefaultQueue = $vals['isDefaultQueue'];
+      }
     }
   }
 
@@ -649,6 +693,34 @@ class BatchQueue {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 8:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->cpuPerNode);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultNodeCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 10:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->defaultCPUCount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 11:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->isDefaultQueue);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -697,6 +769,26 @@ class BatchQueue {
       $xfer += $output->writeI32($this->maxMemory);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->cpuPerNode !== null) {
+      $xfer += $output->writeFieldBegin('cpuPerNode', TType::I32, 8);
+      $xfer += $output->writeI32($this->cpuPerNode);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultNodeCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultNodeCount', TType::I32, 9);
+      $xfer += $output->writeI32($this->defaultNodeCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->defaultCPUCount !== null) {
+      $xfer += $output->writeFieldBegin('defaultCPUCount', TType::I32, 10);
+      $xfer += $output->writeI32($this->defaultCPUCount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isDefaultQueue !== null) {
+      $xfer += $output->writeFieldBegin('isDefaultQueue', TType::BOOL, 11);
+      $xfer += $output->writeBool($this->isDefaultQueue);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;


[6/7] airavata-php-gateway git commit: AIRAVATA-2190 Only show writeable projects when creating experiment

Posted by sc...@apache.org.
AIRAVATA-2190 Only show writeable projects when creating experiment

Also removed older project sharing code that is no longer applicable.


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/81f3b130
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/81f3b130
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/81f3b130

Branch: refs/heads/develop
Commit: 81f3b130ee77462bfd898fadfc638aaeeddb2ef7
Parents: 61e36dd
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Nov 4 12:49:50 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Nov 4 12:49:50 2016 -0400

----------------------------------------------------------------------
 app/libraries/ProjectUtilities.php | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/81f3b130/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index d1d7600..eeeadb2 100755
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -91,8 +91,12 @@ class ProjectUtilities
     public static function create_project_select($projectId = null, $editable = true)
     {
         $editable ? $disabled = '' : $disabled = 'disabled';
-        // TODO: this should only return projects the user can write
-        $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
+        if ($editable) {
+            // this should only return projects the user can write
+            $userProjects = ProjectUtilities::get_all_user_writeable_projects(Session::get("gateway_id"), Session::get('username'));
+        } else {
+            $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
+        }
 
         echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
         if (sizeof($userProjects) > 0) {
@@ -320,10 +324,8 @@ class ProjectUtilities
 
         $wadd = array();
         $wrevoke = array();
-        $ewrevoke = array();
         $radd = array();
         $rrevoke = array();
-        $errevoke = array();
 
         foreach ($users as $user => $perms) {
             if ($perms->write) {
@@ -339,11 +341,6 @@ class ProjectUtilities
             else {
                 $rrevoke[$user] = ResourcePermissionType::READ;
             }
-
-            if (!$perms->read && !$perms->write) {
-                $ewrevoke[$user] = ResourcePermissionType::WRITE;
-                $errevoke[$user] = ResourcePermissionType::READ;
-            }
         }
 
         GrouperUtilities::shareResourceWithUsers($projectId, ResourceType::PROJECT, $wadd);
@@ -351,13 +348,5 @@ class ProjectUtilities
 
         GrouperUtilities::shareResourceWithUsers($projectId, ResourceType::PROJECT, $radd);
         GrouperUtilities::revokeSharingOfResourceFromUsers($projectId, ResourceType::PROJECT, $rrevoke);
-
-        // TODO: get rid of the experiment revocation stuff
-        $experiments = ProjectUtilities::get_experiments_in_project($projectId);
-
-        foreach ($experiments as $exp) {
-            GrouperUtilities::revokeSharingOfResourceFromUsers($exp->experimentId, ResourceType::EXPERIMENT, $ewrevoke);
-            GrouperUtilities::revokeSharingOfResourceFromUsers($exp->experimentId, ResourceType::EXPERIMENT, $errevoke);
-        }
     }
 }


[7/7] airavata-php-gateway git commit: AIRAVATA-2190 Check data-sharing-enabled flag

Posted by sc...@apache.org.
AIRAVATA-2190 Check data-sharing-enabled flag


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/35a9e8e5
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/35a9e8e5
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/35a9e8e5

Branch: refs/heads/develop
Commit: 35a9e8e50ecc427e88bf121d5ec42615bea18448
Parents: 81f3b13
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Nov 4 13:04:27 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Nov 4 13:04:27 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/35a9e8e5/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 004b27d..aab0ae9 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -124,7 +124,11 @@ class ExperimentController extends BaseController
 
 
             $project = null;
-            if (SharingUtilities::userCanRead(Session::get("username"), $experiment->projectId, ResourceType::PROJECT)) {
+            if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
+                if (SharingUtilities::userCanRead(Session::get("username"), $experiment->projectId, ResourceType::PROJECT)) {
+                    $project = ProjectUtilities::get_project($experiment->projectId);
+                }
+            } else {
                 $project = ProjectUtilities::get_project($experiment->projectId);
             }
             $expVal = ExperimentUtilities::get_experiment_values($experiment);


[2/7] airavata-php-gateway git commit: AIRAVATA-2190 Must have write perm to edit/cancel

Posted by sc...@apache.org.
AIRAVATA-2190 Must have write perm to edit/cancel


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/071a027a
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/071a027a
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/071a027a

Branch: refs/heads/develop
Commit: 071a027a134037ef63192e1e3dd99172fa306518
Parents: 0455ebd
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Nov 2 16:34:47 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Nov 2 16:34:47 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  4 ++++
 app/libraries/ExperimentUtilities.php        | 19 ++++++++-----------
 app/views/partials/experiment-info.blade.php | 17 ++++++-----------
 3 files changed, 18 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/071a027a/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 4dfc24f..e6803a9 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -155,13 +155,17 @@ class ExperimentController extends BaseController
                 $users = SharingUtilities::getProfilesForSharedUsers(Input::get("expId"), ResourceType::EXPERIMENT);
 
                 $owner = array();
+                $is_owner = false;
                 if (strcmp(Session::get("username"), $experiment->userName) !== 0) {
                     $owner[$experiment->userName] = $users[$experiment->userName];
                     $users = array_diff_key($users, $owner);
+                } else {
+                    $is_owner = true;
                 }
                 $data['can_write'] = SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT);
                 $data["users"] = json_encode($users);
                 $data["owner"] = json_encode($owner);
+                $data["is_owner"] = $is_owner;
             }
 
             if( Input::has("dashboard"))

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/071a027a/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 32f4323..3b803b5 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -948,6 +948,12 @@ class ExperimentUtilities
         $expVal["taskStates"] = TaskState::$__names;
         $expVal["taskTypes"] = TaskTypes::$__names;
 
+        if(Config::get('pga_config.airavata')["data-sharing-enabled"]) {
+            $can_write = SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT);
+        } else {
+            $can_write = true;
+        }
+
 
         if( is_array( $experiment->experimentStatus ) )
             $experimentStatusString = $expVal["experimentStates"][$experiment->experimentStatus[0]->state];
@@ -956,15 +962,6 @@ class ExperimentUtilities
         }
 
         $expVal["experimentStatusString"] = $experimentStatusString;
-        if ( $experimentStatusString == ExperimentState::FAILED)
-            $expVal["editable"] = false;
-
-        $expVal["cancelable"] = false;
-        if ( $experimentStatusString == ExperimentState::LAUNCHED
-            || $experimentStatusString == ExperimentState::EXECUTING)
-            $expVal["cancelable"] = true;
-
-
         if ($experiment->experimentStatus != null) {
             $experimentStatus = $experiment->experimentStatus;
 
@@ -999,7 +996,7 @@ class ExperimentUtilities
             case 'CREATED':
             case 'VALIDATED':
             case 'SCHEDULED':
-                $expVal["editable"] = true;
+                $expVal["editable"] = true && $can_write;
                 break;
             default:
                 $expVal["editable"] = false;
@@ -1012,7 +1009,7 @@ class ExperimentUtilities
             case 'SCHEDULED':
             case 'LAUNCHED':
             case 'EXECUTING':
-                $expVal["cancelable"] = true;
+                $expVal["cancelable"] = true && $can_write;
                 break;
             default:
                 $expVal["cancelable"] = false;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/071a027a/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index d66e8b7..8236a49 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -217,7 +217,7 @@
 
         <div class="form-group">
         @if(Config::get('pga_config.airavata')["data-sharing-enabled"])
-            @if($can_write === true)
+            @if($is_owner)
             <!-- Only allow editing sharing here if the experiment isn't editable -->
             @include('partials/sharing-display-body', array("form" => !$expVal["editable"]))
             @else
@@ -235,8 +235,8 @@
                class="btn btn-default" onclick="return confirm('Are you sure you want to cancel this experiment?')"
                role="button"
                title="Cancel experiment" @if (!$expVal["cancelable"]) style="display: none" @endif>
-                <input name="cancel" type="submit" class="btn btn-warning"
-                       value="Cancel" <?php if (!$expVal["cancelable"]) echo 'disabled'; ?> >
+                <span class="glyphicon glyphicon-remove"></span>
+                Cancel
             </a>
 <!--            <input name="clone"-->
 <!--                   type="submit"-->
@@ -253,8 +253,6 @@
                 Clone
             </a>
             <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
-            @if(Config::get('pga_config.airavata')["data-sharing-enabled"])
-            @if($can_write === true)
             <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}&savedExp=true"
                class="btn btn-default"
                role="button"
@@ -262,10 +260,7 @@
                 <span class="glyphicon glyphicon-pencil"></span>
                 Edit
             </a>
-            @endif
-            @endif
-            <!-- Only owner can update sharing -->
-            @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && Session::get('username') === $experiment->userName && !$expVal["editable"])
+            @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && $is_owner && !$expVal["editable"])
             <button name="update-sharing"
                    type="submit"
                    class="btn btn-primary"
@@ -361,8 +356,8 @@
 </div>
 @endif
 
-@if(Config::get('pga_config.airavata')["data-sharing-enabled"] and isset($can_write))
-    @if($can_write === true)
+@if(Config::get('pga_config.airavata')["data-sharing-enabled"] and isset($is_owner))
+    @if($is_owner)
     @include('partials/sharing-form-modal')
     @endif
 @endif


[5/7] airavata-php-gateway git commit: AIRAVATA-2190 Handling errors when cloning

Posted by sc...@apache.org.
AIRAVATA-2190 Handling errors when cloning


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/61e36dd0
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/61e36dd0
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/61e36dd0

Branch: refs/heads/develop
Commit: 61e36dd04d6fb28231103cc4ba5345b2fb1773ad
Parents: f76343d
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Nov 4 12:39:30 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Nov 4 12:39:30 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     | 12 ++++++++----
 app/views/partials/experiment-info.blade.php | 10 +++++++++-
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/61e36dd0/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 7b8e101..004b27d 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -289,10 +289,14 @@ class ExperimentController extends BaseController
 
     public function cloneExperiment()
     {
-        // TODO: catch and handle errors when cloning fails
-        $cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
-
-        return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
+        try{
+            $cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
+            return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
+        }catch (Exception $ex){
+            // Redirect to summary page and scroll down to clone panel
+            return Redirect::to("experiment/summary?expId=" . Input::get('expId') . "#clone-panel")
+                ->with("cloning-error", "Failed to clone experiment: " . $ex->getMessage());
+        }
     }
 
     public function editSubmit()

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/61e36dd0/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 0d7b621..8856cc7 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -263,11 +263,19 @@
             @endif
         </div>
     </form>
-    <div class="panel panel-default">
+    <div id="clone-panel" class="panel panel-default">
         <div class="panel-heading">
             <h3 class="panel-title">Clone Experiment</h3>
         </div>
         <div class="panel-body">
+            @if( Session::has("cloning-error"))
+            <div class="alert alert-danger alert-dismissible" role="alert">
+                <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span
+                        class="sr-only">Close</span></button>
+                {{{ Session::get("cloning-error") }}}
+            </div>
+            {{ Session::forget("cloning-error") }}
+            @endif
             <form class="form-inline" action="{{ URL::to('/') }}/experiment/clone" method="post">
                 <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
                 <div class="form-group">


[4/7] airavata-php-gateway git commit: AIRAVATA-2190 Select project when cloning experiment

Posted by sc...@apache.org.
AIRAVATA-2190 Select project when cloning experiment


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/f76343df
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/f76343df
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/f76343df

Branch: refs/heads/develop
Commit: f76343df20524fcf8e8595f519555c0de33f4df4
Parents: 0d58af5
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Nov 4 12:12:47 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Nov 4 12:12:47 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     | 17 +++-----
 app/libraries/ExperimentUtilities.php        |  4 +-
 app/libraries/ProjectUtilities.php           | 15 +++++++
 app/routes.php                               |  2 +-
 app/views/partials/experiment-info.blade.php | 51 ++++++++++++++++-------
 5 files changed, 60 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f76343df/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index e6803a9..7b8e101 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -141,7 +141,7 @@ class ExperimentController extends BaseController
             }
             $expVal["jobDetails"] = $jobDetails;
 
-
+            $writeableProjects = ProjectUtilities::get_all_user_writeable_projects(Session::get("gateway_id"), Session::get("username"));
 
             $data = array(
                 "expId" => Input::get("expId"),
@@ -149,7 +149,8 @@ class ExperimentController extends BaseController
                 "project" => $project,
                 "jobDetails" => $jobDetails,
                 "expVal" => $expVal,
-                "autoRefresh"=> $autoRefresh
+                "autoRefresh"=> $autoRefresh,
+                "writeableProjects" => $writeableProjects
             );
             if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
                 $users = SharingUtilities::getProfilesForSharedUsers(Input::get("expId"), ResourceType::EXPERIMENT);
@@ -288,16 +289,10 @@ class ExperimentController extends BaseController
 
     public function cloneExperiment()
     {
-        if (isset($_GET['expId'])) {
-            $cloneId = ExperimentUtilities::clone_experiment($_GET['expId']);
-            $experiment = ExperimentUtilities::get_experiment($cloneId);
-            $project = ProjectUtilities::get_project($experiment->projectId);
-
-            $expVal = ExperimentUtilities::get_experiment_values($experiment);
-            $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment);
+        // TODO: catch and handle errors when cloning fails
+        $cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
 
-            return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
-        }
+        return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
     }
 
     public function editSubmit()

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f76343df/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 3b803b5..fb0d363 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -581,12 +581,12 @@ class ExperimentUtilities
      * Clone the experiment with the given ID
      * @param $expId
      */
-    public static function clone_experiment($expId)
+    public static function clone_experiment($expId, $projectId)
     {
         try {
             //create new experiment to receive the clone
             $experiment = Airavata::getExperiment(Session::get('authz-token'), $expId);
-            $cloneId = Airavata::cloneExperiment(Session::get('authz-token'), $expId, 'Clone of ' . $experiment->experimentName);
+            $cloneId = Airavata::cloneExperiment(Session::get('authz-token'), $expId, 'Clone of ' . $experiment->experimentName, $projectId);
             //updating the experiment inputs and output path
             $experiment = Airavata::getExperiment(Session::get('authz-token'), $cloneId);
             $experimentInputs = $experiment->experimentInputs;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f76343df/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index 1a58c61..d1d7600 100755
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -46,6 +46,19 @@ class ProjectUtilities
         return $userProjects;
     }
 
+    public static function get_all_user_writeable_projects($gatewayId, $username)
+    {
+        $writeableProjects = array();
+        $userProjects = ProjectUtilities::get_all_user_projects($gatewayId, $username);
+        foreach($userProjects as $project) {
+            if (SharingUtilities::userCanWrite($username, $project->projectID, ResourceType::PROJECT)) {
+                $writeableProjects[] = $project;
+            }
+        }
+
+        return $writeableProjects;
+    }
+
     /**
      * Get the project with the given ID
      * @param $projectId
@@ -78,6 +91,7 @@ class ProjectUtilities
     public static function create_project_select($projectId = null, $editable = true)
     {
         $editable ? $disabled = '' : $disabled = 'disabled';
+        // TODO: this should only return projects the user can write
         $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
 
         echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
@@ -338,6 +352,7 @@ class ProjectUtilities
         GrouperUtilities::shareResourceWithUsers($projectId, ResourceType::PROJECT, $radd);
         GrouperUtilities::revokeSharingOfResourceFromUsers($projectId, ResourceType::PROJECT, $rrevoke);
 
+        // TODO: get rid of the experiment revocation stuff
         $experiments = ProjectUtilities::get_experiments_in_project($projectId);
 
         foreach ($experiments as $exp) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f76343df/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index a087339..6fc817b 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -102,7 +102,7 @@ Route::get("experiment/summary", "ExperimentController@summary");
 
 Route::post("experiment/summary", "ExperimentController@expChange");
 
-Route::get("experiment/clone", "ExperimentController@cloneExperiment");
+Route::post("experiment/clone", "ExperimentController@cloneExperiment");
 
 Route::get("experiment/edit", "ExperimentController@editView");
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f76343df/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 8236a49..0d7b621 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -1,4 +1,9 @@
 {{ HTML::style('css/sharing.css') }}
+<style>
+#experiment-form {
+    margin-bottom: 20px;
+}
+</style>
 <div class="container" style="max-width: 750px;">
     <!--
     @if(isset( $invalidExperimentId ) )
@@ -213,7 +218,7 @@
 
     @if( !isset( $dashboard))
 
-    <form action="{{URL::to('/') }}/experiment/summary" method="post" role="form">
+    <form id="experiment-form" action="{{URL::to('/') }}/experiment/summary" method="post" role="form">
 
         <div class="form-group">
         @if(Config::get('pga_config.airavata')["data-sharing-enabled"])
@@ -238,20 +243,6 @@
                 <span class="glyphicon glyphicon-remove"></span>
                 Cancel
             </a>
-<!--            <input name="clone"-->
-<!--                   type="submit"-->
-<!--                   class="btn btn-primary"-->
-<!--                   value="Clone"-->
-<!--                   title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings-->
-<!--                    after it has been launched.">-->
-            <a href="{{URL::to('/') }}/experiment/clone?expId={{ $experiment->experimentId }}"
-               class="btn btn-primary"
-               role="button"
-               title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings
-                    after it has been launched." target="_blank">
-                <span class="glyphicon glyphicon-pencil"></span>
-                Clone
-            </a>
             <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
             <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}&savedExp=true"
                class="btn btn-default"
@@ -272,6 +263,36 @@
             @endif
         </div>
     </form>
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">Clone Experiment</h3>
+        </div>
+        <div class="panel-body">
+            <form class="form-inline" action="{{ URL::to('/') }}/experiment/clone" method="post">
+                <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
+                <div class="form-group">
+                    <label for="projectId">Project</label>
+                    <select class="form-control" name="projectId" required>
+                        @foreach($writeableProjects as $project)
+                        <option value="{{{ $project->projectID }}}"
+                            @if( $project->projectID == $experiment->projectId)
+                            selected
+                            @endif
+                        >{{{ $project->name }}}</option>
+                        @endforeach
+                    </select>
+                </div>
+
+                <button type="submit"
+                   class="btn btn-primary"
+                   role="button"
+                   title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings after it has been launched.">
+                    <span class="glyphicon glyphicon-pencil"></span>
+                    Clone
+                </a>
+            </form>
+        </div>
+    </div>
     @endif
     <input type="hidden" id="lastModifiedTime" value="{{ $expVal['experimentTimeOfStateChange'] }}"/>