|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Soheilrt\AdobeConnectClient\Client\Commands; |
|
4
|
|
|
|
|
5
|
|
|
use Soheilrt\AdobeConnectClient\Client\Abstracts\Command; |
|
6
|
|
|
use Soheilrt\AdobeConnectClient\Client\Contracts\ArrayableInterface; |
|
7
|
|
|
use Soheilrt\AdobeConnectClient\Client\Converter\Converter; |
|
8
|
|
|
use Soheilrt\AdobeConnectClient\Client\Entities\Principal; |
|
9
|
|
|
use Soheilrt\AdobeConnectClient\Client\Helpers\SetEntityAttributes as FillObject; |
|
10
|
|
|
use Soheilrt\AdobeConnectClient\Client\Helpers\StatusValidate; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Provides a complete list of users and groups, including primary groups. |
|
14
|
|
|
* |
|
15
|
|
|
* More info see {@link https://helpx.adobe.com/adobe-connect/webservices/principal-list.html} |
|
16
|
|
|
*/ |
|
17
|
|
|
class PrincipalList extends Command |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var array |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $parameters; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var Principal|mixed |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $principal; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param int $groupId The Principal ID of a group. If indicate will be possible filter by isMember. |
|
31
|
|
|
* @param ArrayableInterface|null $filter |
|
32
|
|
|
* @param ArrayableInterface|null $sorter |
|
33
|
|
|
*/ |
|
34
|
|
|
public function __construct($groupId = 0, ArrayableInterface $filter = null, ArrayableInterface $sorter = null) |
|
35
|
|
|
{ |
|
36
|
|
|
$this->parameters = [ |
|
37
|
|
|
'action' => 'principal-list', |
|
38
|
|
|
]; |
|
39
|
|
|
|
|
40
|
|
|
if ($groupId) { |
|
41
|
|
|
$this->parameters['group-id'] = $groupId; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
if ($filter) { |
|
45
|
|
|
$this->parameters += $filter->toArray(); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
if ($sorter) { |
|
49
|
|
|
$this->parameters += $sorter->toArray(); |
|
50
|
|
|
} |
|
51
|
|
|
$this->principal = $this->getEntity('principal'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* {@inheritdoc} |
|
56
|
|
|
* |
|
57
|
|
|
* @return Principal[] |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function process() |
|
60
|
|
|
{ |
|
61
|
|
|
$response = Converter::convert( |
|
62
|
|
|
$this->client->doGet( |
|
|
|
|
|
|
63
|
|
|
$this->parameters + ['session' => $this->client->getSession()] |
|
|
|
|
|
|
64
|
|
|
) |
|
65
|
|
|
); |
|
66
|
|
|
|
|
67
|
|
|
StatusValidate::validate($response['status']); |
|
68
|
|
|
|
|
69
|
|
|
$principals = []; |
|
70
|
|
|
|
|
71
|
|
|
foreach ($response['principalList'] as $principalAttributes) { |
|
72
|
|
|
$principal = new $this->principal(); |
|
73
|
|
|
FillObject::setAttributes($principal, $principalAttributes); |
|
74
|
|
|
$principals[] = $principal; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
return $principals; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.