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:28 UTC
[6/7] airavata-php-gateway git commit: AIRAVATA-2190 Only show
writeable projects when creating experiment
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);
- }
}
}