forked from hannonhill/Webservices-PHP-Sample-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
read-access-rights.php
40 lines (34 loc) · 1.1 KB
/
read-access-rights.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$soapURL = "http://localhost:8080/ws/services/AssetOperationService?wsdl";
$client = new SoapClient
(
$soapURL,
array ('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL))
);
$auth = array ('username' => 'admin', 'password' => 'admin' );
$identifier = array
(
'path' => array('path' => '/my-xml-block'),
'type' => 'block'
);
$readParams = array ('authentication' => $auth, 'identifier' => $identifier);
$reply = $client->readAccessRights($readParams);
if ($reply->readAccessRightsReturn->success=='true')
{
$aclEntries = $reply->readAccessRightsReturn->accessRightsInformation->aclEntries->aclEntry;
if (!is_array($aclEntries)) // For less than 2 elements, the returned object isn't an array
$aclEntries=array($aclEntries);
for($i=0; $i<sizeof($aclEntries); $i++)
{
$aclEntry = $aclEntries[$i];
if ($aclEntry->name=='admin' && $aclEntry->type=='user')
{
echo 'User admin has acl entry level of '.$aclEntry->level;
exit;
}
}
echo 'Could not find an acl entry for user admin';
}
else
echo "Error occurred: " . $reply->readAccessRightsReturn->message;
?>