-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathservicePackAssignment.php
More file actions
27 lines (27 loc) · 1.04 KB
/
Copy pathservicePackAssignment.php
File metadata and controls
27 lines (27 loc) · 1.04 KB
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
<?php
/**
* Service Packs assignment per user in service provider
* Date: 24/03/14
* Time: 12:30
*/
require_once 'config.php';
Factory::getOCISchemaSystem();
$client = CoreFactory::getOCIClient(OCIP_HOST);
$client->login(OCIP_USER, OCIP_PASS);
if (!isset($argv[1])) die("No service provider name provided as argument to script\n");
if ($client->send(OCISchemaUser::UserGetListInServiceProviderRequest($argv[1]))) {
if (!$client->getResponse()) die("No users in $argv[1]\n");
foreach ($client->getResponse()->userTable['row'] as $item) {
$userId = $item['col'][0];
$client->send(OCISchemaUser::UserServiceGetAssignmentListRequest($userId));
$sps = null;
foreach ($client->getResponse()->servicePacksAssignmentTable['row'] as $row) {
if (array_key_exists('col', $row)) {
if ($row['col'][1] == 'true') $sps[] = $row['col'][0];
} else {
if ($row[1] == 'true') $sps[] = $row[0];
}
}
if ($sps) echo "$userId,".implode(',',$sps)."\n";
}
}