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/27 17:05:15 UTC
[07/50] [abbrv] airavata-php-gateway git commit: edits to prepare for
editing sharing privileges
edits to prepare for editing sharing privileges
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/20d46c88
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/20d46c88
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/20d46c88
Branch: refs/heads/develop
Commit: 20d46c8845fffbc4475a96eeaf8b939c07e9ecf8
Parents: 1a0c251
Author: Jeff Kinnison <je...@gmail.com>
Authored: Tue Jul 12 09:32:57 2016 -0400
Committer: Jeff Kinnison <je...@gmail.com>
Committed: Tue Jul 12 09:32:57 2016 -0400
----------------------------------------------------------------------
app/controllers/ExperimentController.php | 18 ++++++++++++++++--
app/controllers/ProjectController.php | 4 ++--
app/libraries/ExperimentUtilities.php | 5 +++++
app/libraries/ProjectUtilities.php | 5 +++++
public/js/sharing/share.js | 13 +++++++++++--
5 files changed, 39 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20d46c88/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 7a49e6f..3e0bc1e 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -28,7 +28,7 @@ class ExperimentController extends BaseController
$uids = GrouperUtilities::getAllGatewayUsers();
$users = array();
foreach ($uids as $uid) {
- if (WSIS::usernameExists($uid)) {
+ if ($uid !== Session::get('username') && WSIS::usernameExists($uid)) {
$users[$uid] = WSIS::getUserProfile($uid);
}
}
@@ -78,7 +78,21 @@ class ExperimentController extends BaseController
"allowedFileSize" => $allowedFileSize
);
- return View::make("experiment/create-complete", array("expInputs" => $experimentInputs));
+ $s_users = json_decode($_POST['share-settings']);
+
+ $uids = GrouperUtilities::getAllGatewayUsers();
+ $users = array();
+ foreach ($uids as $uid) {
+ if (WSIS::usernameExists($uid) && $uid !== Session::get('username')) {
+ $users[$uid] = WSIS::getUserProfile($uid);
+ }
+ }
+
+ foreach ($s_users as $uid => $perms) {
+ $users[$uid]['access'] = $perms;
+ }
+
+ return View::make("experiment/create-complete", array("expInputs" => $experimentInputs, "users" => json_encode($users)));
} else if (isset($_POST['save']) || isset($_POST['launch'])) {
$expId = ExperimentUtilities::create_experiment();
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20d46c88/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php
index dbeb668..7492102 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -28,12 +28,12 @@ class ProjectController extends BaseController
$uids = GrouperUtilities::getAllGatewayUsers();
$users = array();
foreach ($uids as $uid) {
- if (WSIS::usernameExists($uid)) {
+ if ($uid !== Session::get('username') && WSIS::usernameExists($uid)) {
$users[$uid] = WSIS::getUserProfile($uid);
}
}
//var_dump($users);exit;
- return View::make("project/create", array("users" => json_encode($users)));
+ return View::make("project/create", array("users" => json_encode($users), "shared" => array()));
}
public function createSubmit()
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20d46c88/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index d365b04..c6e3e79 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -1309,6 +1309,11 @@ class ExperimentUtilities
echo '</select>';
}
+ /**
+ * Set sharing privileges for a given experiment.
+ * @param $expId
+ * @param $users A map of username => {read_permission, write_permission}
+ */
private static function share_experiment($expId, $users) {
$wadd = array();
$wrevoke = array();
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20d46c88/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index ad015dc..96415b9 100644
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -272,6 +272,11 @@ class ProjectUtilities
return $projects;
}
+ /**
+ * Set sharing settings for a given project.
+ * @param projectId
+ * @param $users A map of username => {read_permission, write_permission}
+ */
private static function share_project($projectId, $users) {
$wadd = array();
$wrevoke = array();
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20d46c88/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index b417b7c..90e52e3 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -149,7 +149,7 @@ $(function() {
}
var createTestData = function () {
- var $users, $share, $user, data;
+ var $users, $share, $user, data, access;
$users = $('#share-box-users');
$share = $('#share-box-share');
@@ -157,7 +157,16 @@ $(function() {
for (var user in users) {
if (users.hasOwnProperty(user)) {
data = users[user];
- $user = createThumbnail(user, data.firstname, data.lastname, data.email, access_enum.NONE);
+ access = access_enum.NONE;
+ if (data.hasOwnProperty(access)) {
+ if (data.access.write) {
+ access = access_enum.WRITE;
+ }
+ else if (data.access.read) {
+ access = access_enu.READ;
+ }
+ }
+ $user = createThumbnail(user, data.firstname, data.lastname, data.email, access);
$user.addClass('user-thumbnail');
$user.addClass('share-box-users-item');
$users.append($user);