-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathedit-access-rights.php
46 lines (39 loc) · 1.44 KB
/
edit-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
41
42
43
44
45
46
<?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', 'siteName' => 'nameOfSite'),
'type' => 'block'
);
$readParams = array ('authentication' => $auth, 'identifier' => $identifier);
$reply = $client->readAccessRights($readParams);
if ($reply->readAccessRightsReturn->success=='true')
{
$accessRightsInformation = $reply->readAccessRightsReturn->accessRightsInformation;
$aclEntries = $accessRightsInformation->aclEntries->aclEntry;
if (sizeof($aclEntries)==0)
$aclEntries = array();
else if (!is_array($aclEntries)) // For less than 2 eleements, the returned object isn't an array
$aclEntries=array($aclEntries);
$aclEntries[] = array('level' => 'read', 'type' => 'user', 'name' => 'admin');
$accessRightsInformation->aclEntries->aclEntry=$aclEntries;
$editParams = array
(
'authentication' => $auth,
'accessRightsInformation' => $accessRightsInformation
);
$reply = $client->editAccessRights($editParams);
if ($reply->editAccessRightsReturn->success=='true')
echo "Success.";
else
echo "Error occurred when editing access rights: " . $reply->editAccessRightsReturn->message;
}
else
echo "Error occurred: " . $reply->readAccessRightsReturn->message;
?>