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/07 19:21:01 UTC

airavata-php-gateway git commit: adding project utilities

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/grouper-integration 6ebf242ea -> 14f4f01a9


adding project utilities


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

Branch: refs/heads/grouper-integration
Commit: 14f4f01a9a65f9c56ce10f878f3fb290522c519c
Parents: 6ebf242
Author: scnakandala <su...@gmail.com>
Authored: Thu Jul 7 15:20:55 2016 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Thu Jul 7 15:20:55 2016 -0400

----------------------------------------------------------------------
 app/controllers/ProjectController.php |  4 ++--
 app/libraries/GrouperUtilities.php    | 22 ++++++++++++++++++++++
 app/libraries/ProjectUtilities.php    |  8 ++++----
 3 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/14f4f01a/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php
index f46cc0f..fe3a35d 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -87,10 +87,10 @@ class ProjectController extends BaseController
 
         $searchValue = Input::get("search-value");
         if(!empty($searchValue)){
-            $projects = ProjectUtilities::get_projsearch_results_with_pagination(Input::get("search-key"),
+            $projects = ProjectUtilities::get_proj_search_results_with_pagination(Input::get("search-key"),
                 Input::get("search-value"), $this->limit, ($pageNo - 1) * $this->limit);
         }else{
-            $projects = ProjectUtilities::get_all_user_projects_with_pagination($this->limit, ($pageNo - 1) * $this->limit);
+            $projects = ProjectUtilities::get_all_user_accessible_projects_with_pagination($this->limit, ($pageNo - 1) * $this->limit);
         }
 
         return View::make('project/browse', array(

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/14f4f01a/app/libraries/GrouperUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/GrouperUtilities.php b/app/libraries/GrouperUtilities.php
new file mode 100644
index 0000000..d09acaf
--- /dev/null
+++ b/app/libraries/GrouperUtilities.php
@@ -0,0 +1,22 @@
+<?php
+
+use Airavata\Model\Group\ResourceType;
+use Airavata\Model\Group\ResourcePermissionType;
+
+class GrouperUtilities
+{
+    public static function shareResourceWithUsers($resourceId, $dataResourceType, $userPermissionMap)
+    {
+        Airavata::shareResourceWithUsers(Session::get('authz-token'), $resourceId, $dataResourceType, $userPermissionMap);
+    }
+
+    public static function revokeSharingOfResourceFromUsers($resourceId, $dataResourceType, $userPermissionMap)
+    {
+        Airavata::revokeSharingOfResourceFromUsers(Session::get('authz-token'), $resourceId, $dataResourceType, $userPermissionMap);
+    }
+
+    public static function getAllAccessibleUsers($resourceId, $dataResourceType, $permissionType)
+    {
+        return Airavata::getAllAccessibleUsers($resourceId, $dataResourceType, $permissionType);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/14f4f01a/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index 95fe488..f4821c6 100644
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -199,14 +199,14 @@ class ProjectUtilities
     }
 
 
-    public static function get_all_user_projects_with_pagination($limit, $offset)
+    public static function get_all_user_accessible_projects_with_pagination($limit, $offset)
     {
 
         $projects = array();
 
         try {
-            $projects = Airavata::getUserProjects(Session::get('authz-token'), Session::get("gateway_id"),
-                Session::get("username"), $limit, $offset);
+            $projects = $projects = Airavata::searchProjects(Session::get('authz-token'), Session::get("gateway_id"),
+                Session::get("username"), [], $limit, $offset);
         } catch (InvalidRequestException $ire) {
             CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
         } catch (AiravataClientException $ace) {
@@ -228,7 +228,7 @@ class ProjectUtilities
     }
 
 
-    public static function get_projsearch_results_with_pagination($searchKey, $searchValue, $limit, $offset)
+    public static function get_proj_search_results_with_pagination($searchKey, $searchValue, $limit, $offset)
     {
 
         $projects = array();