airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [4/4] airavata-php-gateway git commit: experiment sharing and permissions revocation enabled
Date Wed, 13 Jul 2016 19:38:33 GMT
experiment sharing and permissions revocation enabled


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/91bc869b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/91bc869b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/91bc869b

Branch: refs/heads/grouper-integration
Commit: 91bc869bff0d7e1a7317b552557b1608953c207b
Parents: f53bcb7
Author: Jeff Kinnison <jeffdkinnison@gmail.com>
Authored: Wed Jul 13 15:25:06 2016 -0400
Committer: Jeff Kinnison <jeffdkinnison@gmail.com>
Committed: Wed Jul 13 15:25:06 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php       |  8 ++++++--
 app/libraries/ExperimentUtilities.php          |  5 ++++-
 app/views/experiment/create-complete.blade.php |  4 ----
 app/views/experiment/edit.blade.php            |  3 ---
 app/views/experiment/summary.blade.php         |  4 +---
 app/views/partials/experiment-info.blade.php   | 14 ++++++++++++--
 app/views/partials/experiment-inputs.blade.php |  4 ++++
 app/views/partials/sharing-form-body.blade.php |  4 ++--
 public/js/sharing/share.js                     |  7 +++++--
 public/js/sharing/sharing_utils.js             |  1 +
 10 files changed, 35 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 06026a0..5f1edb2 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -1,6 +1,7 @@
 <?php
 
 use Airavata\Model\Status\JobState;
+use Airavata\Model\Group\ResourceType;
 
 class ExperimentController extends BaseController
 {
@@ -130,13 +131,16 @@ class ExperimentController extends BaseController
             }
             $expVal["jobDetails"] = $jobDetails;
 
+            $users = SharingUtilities::getProfilesForSharedUsers(Input::get("expId"), ResourceType::EXPERIMENT);
+
             $data = array(
                 "expId" => Input::get("expId"),
                 "experiment" => $experiment,
                 "project" => $project,
                 "jobDetails" => $jobDetails,
                 "expVal" => $expVal,
-                "autoRefresh"=> $autoRefresh
+                "autoRefresh"=> $autoRefresh,
+                "users" => json_encode($users)
             );
             if( Input::has("dashboard"))
             {
@@ -233,7 +237,7 @@ class ExperimentController extends BaseController
 
         $users = SharingUtilities::getAllUserProfiles($_GET['expId'], ResourceType::EXPERIMENT);
 
-        return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users"
=> $users));
+        return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users"
=> json_encode($users)));
     }
 
     public function cloneExperiment()

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 4f63480..cc59b68 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -551,6 +551,7 @@ class ExperimentUtilities
      */
     public static function update_experiment($expId, $updatedExperiment)
     {
+        $share = $_POST['share-settings'];
         try {
             Airavata::updateExperiment(Session::get('authz-token'), $expId, $updatedExperiment);
         } catch (InvalidRequestException $ire) {
@@ -570,6 +571,8 @@ class ExperimentUtilities
             Please try again later or submit a bug report using the link in the Help menu.</p>'
.
                 '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
         }
+
+        ExperimentUtilities::share_experiment($expId, json_decode($share));
     }
 
 
@@ -1339,7 +1342,7 @@ class ExperimentUtilities
         GrouperUtilities::shareResourceWithUsers($expId, ResourceType::EXPERIMENT, $wadd);
         GrouperUtilities::revokeSharingOfResourceFromUsers($expId, ResourceType::EXPERIMENT,
$wrevoke);
 
-        GrouperUtilities::shareResourceWithUsers($expId, ResourceType::Experiment, $radd);
+        GrouperUtilities::shareResourceWithUsers($expId, ResourceType::EXPERIMENT, $radd);
         GrouperUtilities::revokeSharingOfResourceFromUsers($expId, ResourceType::EXPERIMENT,
$rrevoke);
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/views/experiment/create-complete.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/create-complete.blade.php b/app/views/experiment/create-complete.blade.php
index 0308ee3..c3976bb 100644
--- a/app/views/experiment/create-complete.blade.php
+++ b/app/views/experiment/create-complete.blade.php
@@ -20,10 +20,6 @@
         @include('partials/experiment-inputs', array("expInputs" => $expInputs, "queueDefaults"
=>
         $expInputs['queueDefaults']) )
 
-        <div class="form-control">
-            @include('partials/sharing-display-body', array("form" => true))
-        </div>
-
         <div class="form-group btn-toolbar">
             <div class="btn-group">
                 <button onclick="disableWarn()" name="save" type="submit" class="btn btn-primary"
value="Save">Save</button>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index 0708e41..a991bd1 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -26,9 +26,6 @@
             @include('partials/experiment-inputs', array( "expInputs", $expInputs))
 
             @if( count( $expInputs['computeResources']) > 0)
-            <div class="form-control">
-            @include('partials/sharing-display-body', array("form" => true))
-            </div>
             <div class="btn-toolbar">
                 <div class="btn-group">
                     <input name="save" type="submit" class="btn btn-primary"

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/views/experiment/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/summary.blade.php b/app/views/experiment/summary.blade.php
index b41fdb5..6c44ede 100755
--- a/app/views/experiment/summary.blade.php
+++ b/app/views/experiment/summary.blade.php
@@ -6,9 +6,7 @@
 
 @section('content')
 @include('partials/experiment-info')
-<div class="row">
-@include('partials/sharing-display-body')
-</div>
+{{ HTML::image("assets/Profile_avatar_placeholder_large.png", 'placeholder image', array('class'
=> 'baseimage')) }}
 @stop
 
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/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 2d1969d..63c4e06 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -1,3 +1,4 @@
+{{ HTML::style('css/sharing.css') }}
 <div class="container" style="max-width: 750px;">
     <!--
     @if(isset( $invalidExperimentId ) )
@@ -190,6 +191,10 @@
         @endforeach
     </table>
 
+    <div class="form-group">
+    @include('partials/sharing-display-body', array("form" => false))
+    </div>
+
     @if( !isset( $dashboard))
     <form action="{{URL::to('/') }}/experiment/summary" method="post" role="form">
         <div class="btn-toolbar">
@@ -307,7 +312,7 @@
                 </li>
             </ul>
         </li>
-                
+
 
     </ul>
 </div>
@@ -316,5 +321,10 @@
 @section('scripts')
 @parent
 {{ HTML::script('js/time-conversion.js')}}
+<script>
+    var users = {{ $users }};
+</script>
+{{ HTML::script('js/sharing/sharing_utils.js') }}
+{{ HTML::script('js/sharing/share.js') }}
 
-@stop
\ No newline at end of file
+@stop

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index f6e2557..09a546c 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -25,6 +25,10 @@
     {{ ExperimentUtilities::create_application_select($expInputs['application'], false) }}
 </div>
 
+<div class="form-group">
+    @include('partials/sharing-display-body', array("form" => true))
+</div>
+
 <div class="panel panel-default">
     <div class="panel-heading">Application configuration</div>
     <div class="panel-body">

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/app/views/partials/sharing-form-body.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/sharing-form-body.blade.php b/app/views/partials/sharing-form-body.blade.php
index d6387d0..7f9ad99 100644
--- a/app/views/partials/sharing-form-body.blade.php
+++ b/app/views/partials/sharing-form-body.blade.php
@@ -1,7 +1,7 @@
 <label>Click on the users you would like to share with.</label>
 <input id="share-box-filter" class="form-control" type="text" placeholder="Filter the
user list" />
-<label>Show</label>
-<!-- <div id="show-results-group" class="btn-group" role="group" aria-label="Show Groups
or Users">
+<!-- <label>Show</label>
+<div id="show-results-group" class="btn-group" role="group" aria-label="Show Groups or
Users">
     <button type="button" class="show-groups show-results-btn btn btn-primary">Groups</button>
     <button type="button" class="show-users show-results-btn btn btn-default">Users</button>
 </div> -->

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index fdd7c9f..bf9e62c 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -171,11 +171,12 @@ $(function() {
 
     // Save the sharing permissions of each selected user
     $('body').on('click', '#share-box-button', function(e) {
-        var data, resource_id, $share_list, share_settings, access;
+        var data, resource_id, $share_list, $update_list, share_settings, access;
         e.stopPropagation();
         e.preventDefault();
         data = $("#share-box").data()
         $share_list = $("#share-box-share").children();
+        $update_list = $('.sharing-updated');
         share_settings = {};
         if (data.hasOwnProperty('resource_id')) {
             resource_id = data.resource_id;
@@ -185,7 +186,7 @@ $(function() {
             $('#shared-users').empty();
             if ($share_list.filter('.sharing-thumbnail').length > 0) {
                 $share_list.sort(comparator_map.username);
-                $share_list.each(function(index, element) {
+                $update_list.each(function(index, element) {
                     var $e, data, settings;
                     $e = $(element);
                     data = $e.data();
@@ -236,6 +237,7 @@ $(function() {
             $('#shared-users').addClass('text-align-center');
             $('#shared-users').prepend('<p>This project has not been shared</p>');
         }
+        $('.sharing-updated').removeClass('sharing-updated');
         $('#share-box').animate({top: "100%"});
         return false;
     });
@@ -275,6 +277,7 @@ $(function() {
         }
         $parent.find('.sharing-thumbnail-access-text').val(access_text[access]);
         $parent.data(data);
+        $parent.addClass('sharing-updated');
     });
 
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/91bc869b/public/js/sharing/sharing_utils.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/sharing_utils.js b/public/js/sharing/sharing_utils.js
index fcd120b..6b31acd 100644
--- a/public/js/sharing/sharing_utils.js
+++ b/public/js/sharing/sharing_utils.js
@@ -80,6 +80,7 @@ var createThumbnail = function(username, firstname, lastname, email, access
= ac
 var changeShareState = function($target) {
     var data;
     data = $target.data();
+    $target.addClass('sharing-updated');
     if ($target.hasClass('share-box-users-item')) {
         $target.find('.sharing-thumbnail-access').val('1').prop("disabled", false).show();
         $target.find('.sharing-thumbnail-access-text').text(access_text[access_enum.READ]).hide();


Mime
View raw message