From e47c27be97c021cb071b0564a313a4005b2db51b Mon Sep 17 00:00:00 2001
From: Martin Haase <martin.haase@daasi.de>
Date: Mon, 26 May 2008 13:36:45 +0000
Subject: [PATCH] removed timeout bug for getObjects and speeded up
 implementation (now LDAP handles the logic, which does it much faster than
 PHP).

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@1327 7c539038-3410-0410-b1ec-0f2a7bf1c452
---
 .../rbacSoap/TgExtra.class.php                | 34 ++++++++++++++++++-
 .../rbacSoap/TgSystem.class.php               |  2 +-
 .../rbacSoap/phpinfo.php                      |  3 ++
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100755 info.textgrid.middleware.tgauth.rbac/rbacSoap/phpinfo.php

diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
index 6af77aa..d63f949 100755
--- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
+++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
@@ -479,9 +479,41 @@ class TgExtra {
     $result = new resourcesetResponse();  // The return-result
     $filter = "";                         // RBAC-filter
     $arrResource = Array();               // Resoult of the RBAC-search
+    $arrSessionRole = Array();            // The active roles of the session
     $i = 0;                               // Loop
 
 
+    $arrSessionRole = $this->rbac->sessionRoles( $inRequest->auth, false );
+
+
+    $filter  = "(&" . $this->rbac->getConfiguration()->getValue( "resource", "filter" );
+    $filter .= "(tgprojectid=" . $inRequest->project . ")";
+    $filter .= "(|";
+
+
+    for( $i = 0; $i < sizeof( $arrSessionRole ); $i++ ) {
+
+      $filter .= "(rbacPermission=" . $arrSessionRole[$i] . ":-:read)";
+
+    }
+
+
+    $filter .= "))";
+
+
+    $arrResource = $this->connection['resource']->search( $this->rbac->getConfiguration()->getValue( "resource", "base" ),
+                                                          $filter, "sub",
+                                                          Array( $this->rbac->getConfiguration()->getValue( "resource", "aliasattribute" ),
+                                                          $this->rbac->getConfiguration()->getValue( "resource", "namingattribute" ) ) );
+
+    for( $i = 0; $i < sizeof( $arrResource ); $i++ ) {
+
+      $result->resource[] = $arrResource[$i][$this->rbac->getConfiguration()->getValue( "resource", "aliasattribute" )][0];
+
+    }
+
+
+/*
     $filter  = "(&" . $this->rbac->getConfiguration()->getValue( "resource", "filter" );
     $filter .= "(tgprojectid=" . $inRequest->project . "))";
 
@@ -502,7 +534,7 @@ class TgExtra {
       }
 
     }
-
+*/
 
     return $result;
 
diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgSystem.class.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgSystem.class.php
index 6157e34..88d71ef 100755
--- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgSystem.class.php
+++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgSystem.class.php
@@ -62,7 +62,7 @@ class TgSystem {
       // PHP creates an array!
       if( isset( $inRequest->roleset ) ) {
 
-        is_array( $inRequest->roleset ) ? $arrRole = $inRequest->roleset : array_push( &$arrRole, $inRequest->roleset );
+        is_array( $inRequest->roleset ) ? $arrRole = $inRequest->roleset : $arrRole[] = $inRequest->roleset;
 
       }
 
diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/phpinfo.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/phpinfo.php
new file mode 100755
index 0000000..cf60860
--- /dev/null
+++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/phpinfo.php
@@ -0,0 +1,3 @@
+<?php
+phpinfo();
+?>
-- 
GitLab