Skip to content
Snippets Groups Projects
Commit 45007b78 authored by Martin Haase's avatar Martin Haase
Browse files

The registerResource.php lets you decide which WSDL you want to use. And the...

The registerResource.php lets you decide which WSDL you want to use. And the function filterBySid is now much faster by avoiding the rbac abstraction layers.

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@1539 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent 41177dea
No related branches found
No related tags found
No related merge requests found
......@@ -265,25 +265,54 @@ class TgExtra {
}
try {
// If we do not free some memory we might
// consume enormous resources
unset( $inResuest->resource );
for( $i = 0; $i < sizeof( $res ); $i++ ) {
if( $this->rbac->checkAccess( $inRequest->auth, $inRequest->operation, $res[$i] ) ) {
// Get all roles activated in the session
// (internal representation)
$arrRole = $this->rbac->sessionRoles( $inRequest->auth, false );
$filterBySidResult[] = $res[$i];
}
// Construct a filter with all resources and
// all roles/permissions
$filter = "(&(objectClass=rbacResource)(|";
}
for( $i = 0; $i < sizeof( $res ); $i++ ) {
$result->resource = $filterBySidResult;
$filter .= "(tgResourceURI=" . $res[$i] . ")";
}
catch( RBACException $e ) {
return new SoapFault( "rbacFault", $e->getCode(), get_class( $this->rbac ), $e->getMessage() );
$filter .= ")(|";
for( $i = 0; $i < sizeof( $arrRole ); $i++ ) {
$filter .= "(rbacPermission=" . $arrRole[$i] . ":-:" . $inRequest->operation . ")";
}
$filter .= "(TgIsPublic=TRUE)))";
// If we do not free some memory we might
// consume enormous resources
unset( $arrRole );
unset( $res );
$arrResult = $this->connection['resource']->search( $this->rbac->getConfiguration()->getValue( "resource", "base" ),
$filter, "sub", Array( "tgResourceURI" ) );
for( $i = 0; $i < sizeof( $arrResult ); $i++ ) {
$result->resource[] = $arrResult[$i]['tgresourceuri'][0];
}
......
......@@ -2,25 +2,37 @@
// #######################################################
// Author: Markus Widmer
// Creation date: 18.07.2007
// Modification date: 18.07.2007
// Modification date: 18.07.2008
// Version: 0.1.0
// #######################################################
require_once( "../soapTypes.inc.php" );
require_once( "wsdlDefinition.include.php" );
// -----------------------------------------------------
// You'll need these services
// -----------------------------------------------------
$soapExtra = new SoapClient( "http://rbac.textgrid.daasi.de/wsdl/tgextra.wsdl" );
echo "<BODY><HTML>";
echo "<HTML><BODY>";
echo "<HEAD><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></HEAD>\n";
if( isset( $_POST['wsdl'] ) ) {
$soapExtra = new SoapClient( $arrExtraWsdl[$_POST['wsdl']]['url'] );
}
else {
$soapExtra = new SoapClient( $arrExtraWsdl[0]['url'] );
}
if( isset( $_POST['auth'] ) ) {
......@@ -31,6 +43,7 @@ if( isset( $_POST['auth'] ) ) {
$creReq = new createProjectRequest();
$creReq->auth = $_POST['auth'];
$creReq->log = "";
$creReq->name = $_POST['name'];
$creReq->description = $_POST['description'];
......@@ -63,8 +76,19 @@ if( isset( $_POST['auth'] ) ) {
echo "<FORM action=\"createProject.php\" method=\"post\" enctype=\"multipart/form-data\">\n";
echo "Target: ";
echo "<SELECT name=\"wsdl\">\n";
for( $i = 0; $i < sizeof( $arrExtraWsdl ); $i++ ) {
echo "<OPTION value=\"" . $i . "\">" . $arrExtraWsdl[$i]['name'] . "</OPTION>\n";
}
echo "</SELECT><BR>\n";
echo "Auth: <INPUT type=\"text\" name=\"auth\" value=\"\"><BR>\n";
echo "Project-description: <INPUT type=\"text\" name=\"description\" value=\"\"><BR>\n";
echo "Project name: <INPUT type=\"text\" name=\"name\" value=\"\"><BR>\n";
echo "Project description: <INPUT type=\"text\" name=\"description\" value=\"\"><BR>\n";
echo "<INPUT type=\"submit\" value=\"Commit...\">\n";
echo "</FORM>\n";
......
......@@ -2,23 +2,33 @@
// #######################################################
// Author: Markus Widmer
// Creation date: 18.07.2007
// Modification date: 18.07.2007
// Version: 0.1.0
// Modification date: 18.07.2008
// Version: 0.1.1
// #######################################################
require_once( "../soapTypes.inc.php" );
require_once( "wsdlDefinition.include.php" );
// -----------------------------------------------------
// You'll need these services
// -----------------------------------------------------
$soapExtra = new SoapClient( "http://rbac.textgrid.daasi.de/wsdl/tgextra.wsdl" );
echo "<BODY><HTML>";
if( isset( $_POST['wsdl'] ) ) {
$soapExtra = new SoapClient( $arrExtraWsdl[$_POST['wsdl']]['url'] );
}
else {
$soapExtra = new SoapClient( $arrExtraWsdl[0]['url'] );
}
......@@ -64,6 +74,16 @@ if( isset( $_POST['auth'] ) ) {
echo "<FORM action=\"registerResource.php\" method=\"post\" enctype=\"multipart/form-data\">\n";
echo "Target: ";
echo "<SELECT name=\"wsdl\">\n";
for( $i = 0; $i < sizeof( $arrExtraWsdl ); $i++ ) {
echo "<OPTION value=\"" . $i . "\">" . $arrExtraWsdl[$i]['name'] . "</OPTION>\n";
}
echo "</SELECT><BR>\n";
echo "Auth: <INPUT type=\"text\" name=\"auth\" value=\"\"><BR>\n";
echo "Project-Name: <INPUT type=\"text\" name=\"project\" value=\"\"><BR>\n";
echo "URI: <INPUT type=\"text\" name=\"uri\" value=\"\"><BR>\n";
......
<?php
$arrExtraWsdl = Array( Array( "name" => "RBAC Test",
"url" => "http://rbac-test.textgrid.daasi.de/wsdl/tgextra.wsdl" ),
Array( "name" => "RBAC",
"url" => "http://rbac.textgrid.daasi.de/wsdl/tgextra.wsdl" ),
Array( "name" => "RBAC Textgrid-WS1",
"url" => "http://textgrid-ws1.gwdg.de/tgauth/rbacSoap/wsdl/tgextra.wsdl" ) );
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment