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/07/14 21:50:30 UTC
[4/7] airavata-php-gateway git commit: made groups inherit sharing
privileges from project
made groups inherit sharing privileges from project
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/8f4fd5f1
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8f4fd5f1
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8f4fd5f1
Branch: refs/heads/grouper-integration
Commit: 8f4fd5f1ac479f7f089b8f5858a7893882abbacf
Parents: fdbbe95
Author: Jeff Kinnison <je...@gmail.com>
Authored: Thu Jul 14 16:31:36 2016 -0400
Committer: Jeff Kinnison <je...@gmail.com>
Committed: Thu Jul 14 16:31:36 2016 -0400
----------------------------------------------------------------------
app/controllers/ExperimentController.php | 4 ++--
app/libraries/SharingUtilities.php | 14 ++++++++++++--
public/js/sharing/share.js | 8 ++++++--
3 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8f4fd5f1/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 677aa0e..57538c2 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -73,7 +73,7 @@ class ExperimentController extends BaseController
"allowedFileSize" => $allowedFileSize
);
- $users = SharingUtilities::mixProjectPermissionsWithExperiment($_POST['project']);
+ $users = SharingUtilities::getAllUserProfiles($_POST['project'], ResourceType::PROJECT);
return View::make("experiment/create-complete", array("expInputs" => $experimentInputs, "users" => json_encode($users)));
} else if (isset($_POST['save']) || isset($_POST['launch'])) {
@@ -236,7 +236,7 @@ class ExperimentController extends BaseController
'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]
);
- $users = SharingUtilities::mixProjectPermissionsWithExperiment($experiment->project, $_GET['expId']);
+ $users = SharingUtilities::getAllUserProfiles($_GET['expId'], ResourceType::EXPERIMENT);
return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users" => json_encode($users)));
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8f4fd5f1/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
index 027355b..02832ac 100644
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -139,9 +139,9 @@ class SharingUtilities {
return $profs;
}
- public static function mixProjectPermissionsWithExperiment($projectId, $expId=null) {
+ public static function mixProjectPermissionsWithExperiment($projectId, $expId) {
$proj = SharingUtilities::getProfilesForSharedUsers($projectId, ResourceType::PROJECT);
- $exp = SharingUtilities::getAllUserProfiles($expId, ResourceType::EXPERIMENT);
+ $exp = SharingUtilities::getProfilesForSharedUsers($expId, ResourceType::EXPERIMENT);
foreach ($proj as $uid => $prof) {
if (!array_key_exists($uid, $exp)) {
@@ -151,6 +151,16 @@ class SharingUtilities {
return $exp;
}
+
+ public static function updateAllUsersListWithPrivileges($shared) {
+ $users = SharingUtilities::getAllUserProfiles();
+
+ foreach ($shared as $uid => $prof) {
+ $users[$uid] = $shared[$uid];
+ }
+
+ return $users;
+ }
}
?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8f4fd5f1/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index 12fd195..0aae840 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -17,11 +17,13 @@ $(function() {
/* Share box functions */
var createTestData = function () {
- var $users, $share, $user;
+ var $users, $share, $user, share_settings;
$users = $('#share-box-users');
$share = $('#shared-users');
+ share_settings = {};
+
for (var user in users) {
if (users.hasOwnProperty(user)) {
var data = users[user];
@@ -46,7 +48,8 @@ $(function() {
}
else {
console.log("adding shared user");
- $user.addClass('share-box-share-item');
+ $user.addClass('share-box-share-item sharing-updated');
+ share_settings[user] = data.access;
$share.append($user);
}
}
@@ -72,6 +75,7 @@ $(function() {
if ($share.children().length === 0) {
$share.append($('<p>This has not been shared</p>')).addClass('text-align-center');
}
+ $('#share-settings').val(JSON.stringify(share_settings));
$('.user-thumbnail').show();
//$('.group-thumbnail').show();
}