|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the tmilos/scim-schema package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Milos Tomic <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Tmilos\ScimSchema\Model; |
|
13
|
|
|
|
|
14
|
|
|
use Tmilos\ScimSchema\Model\SPC\Bulk; |
|
15
|
|
|
use Tmilos\ScimSchema\ScimConstants; |
|
16
|
|
|
|
|
17
|
|
|
abstract class ServiceProviderConfig extends Resource |
|
18
|
|
|
{ |
|
19
|
|
|
/** @var string */ |
|
20
|
|
|
protected $documentationUri; |
|
21
|
|
|
|
|
22
|
|
|
/** @var SPC\Patch */ |
|
23
|
|
|
protected $patch; |
|
24
|
|
|
|
|
25
|
|
|
/** @var SPC\Bulk */ |
|
26
|
|
|
protected $bulk; |
|
27
|
|
|
|
|
28
|
|
|
/** @var SPC\Filter */ |
|
29
|
|
|
protected $filter; |
|
30
|
|
|
|
|
31
|
|
|
/** @var SPC\ETag */ |
|
32
|
|
|
protected $eTag; |
|
33
|
|
|
|
|
34
|
|
|
/** @var SPC\ChangePassword */ |
|
35
|
|
|
protected $changePassword; |
|
36
|
|
|
|
|
37
|
|
|
/** @var SPC\Sort */ |
|
38
|
|
|
protected $sort; |
|
39
|
|
|
|
|
40
|
|
|
/** @var SPC\AuthenticationScheme[] */ |
|
41
|
|
|
protected $authenticationSchemes; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param string $documentationUri |
|
45
|
|
|
* @param bool $patchSupported |
|
46
|
|
|
* @param bool $bulkSupported |
|
47
|
|
|
* @param int $bulkMaxOperations |
|
48
|
|
|
* @param int $bulkMaxPayloadSize |
|
49
|
|
|
* @param false $filterSupported |
|
50
|
|
|
* @param int $filterMaxResults |
|
51
|
|
|
* @param bool $eTagSupported |
|
52
|
|
|
* @param bool $changePasswordSupported |
|
53
|
|
|
* @param bool $sortSupported |
|
54
|
|
|
* @param SPC\AuthenticationScheme[] $authenticationSchemes |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct($documentationUri, $patchSupported, $bulkSupported, $bulkMaxOperations, $bulkMaxPayloadSize, $filterSupported, $filterMaxResults, $eTagSupported, $changePasswordSupported, $sortSupported, array $authenticationSchemes) |
|
57
|
|
|
{ |
|
58
|
|
|
parent::__construct('ServiceProviderConfig'); |
|
59
|
|
|
|
|
60
|
|
|
$this->documentationUri = $documentationUri; |
|
61
|
|
|
$this->patch = new SPC\Patch($patchSupported); |
|
62
|
|
|
$this->bulk = new SPC\Bulk($bulkSupported, $bulkMaxOperations, $bulkMaxPayloadSize); |
|
63
|
|
|
$this->filter = new SPC\Filter($filterSupported, $filterMaxResults); |
|
64
|
|
|
$this->eTag = new SPC\ETag($eTagSupported); |
|
65
|
|
|
$this->changePassword = new SPC\ChangePassword($changePasswordSupported); |
|
66
|
|
|
$this->sort = new SPC\Sort($sortSupported); |
|
67
|
|
|
$this->authenticationSchemes = $authenticationSchemes; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getResourceType() |
|
71
|
|
|
{ |
|
72
|
|
|
return ScimConstants::RESOURCE_TYPE_SERVICE_PROVIDER_CONFIG; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return string |
|
77
|
|
|
*/ |
|
78
|
|
|
public function getDocumentationUri() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->documentationUri; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return SPC\Patch |
|
85
|
|
|
*/ |
|
86
|
|
|
public function getPatch() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->patch; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @return Bulk |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getBulk() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->bulk; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return SPC\Filter |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getFilter() |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->filter; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @return SPC\ETag |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getETag() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->eTag; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return SPC\ChangePassword |
|
117
|
|
|
*/ |
|
118
|
|
|
public function getChangePassword() |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->changePassword; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @return SPC\Sort |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getSort() |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->sort; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @return SPC\AuthenticationScheme[] |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getAuthenticationSchemes() |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->authenticationSchemes; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function serializeObject() |
|
140
|
|
|
{ |
|
141
|
|
|
$result = parent::serializeObject(); |
|
142
|
|
|
unset($result['id']); |
|
143
|
|
|
|
|
144
|
|
|
if ($this->documentationUri) { |
|
145
|
|
|
$result['documentationUri'] = $this->documentationUri; |
|
146
|
|
|
} |
|
147
|
|
|
$result['patch'] = $this->getPatch()->serializeObject(); |
|
148
|
|
|
$result['bulk'] = $this->getBulk()->serializeObject(); |
|
149
|
|
|
$result['filter'] = $this->getFilter()->serializeObject(); |
|
150
|
|
|
$result['etag'] = $this->getETag()->serializeObject(); |
|
151
|
|
|
$result['changePassword'] = $this->getChangePassword()->serializeObject(); |
|
152
|
|
|
$result['sort'] = $this->getSort()->serializeObject(); |
|
153
|
|
|
$result['authenticationSchemes'] = []; |
|
154
|
|
|
foreach ($this->getAuthenticationSchemes() as $authenticationScheme) { |
|
155
|
|
|
$result['authenticationSchemes'][] = $authenticationScheme->serializeObject(); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
return $result; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @param array $data |
|
163
|
|
|
* |
|
164
|
|
|
* @return ServiceProviderConfig |
|
165
|
|
|
*/ |
|
166
|
|
|
public static function deserializeObject(array $data) |
|
167
|
|
|
{ |
|
168
|
|
|
/** @var ServiceProviderConfig $result */ |
|
169
|
|
|
$result = self::deserializeCommonAttributes($data); |
|
170
|
|
|
|
|
171
|
|
|
if (isset($data['documentationUri'])) { |
|
172
|
|
|
$result->documentationUri = $data['documentationUri']; |
|
173
|
|
|
} |
|
174
|
|
|
$result->patch = SPC\Patch::deserializeObject($data['patch']); |
|
175
|
|
|
$result->bulk = SPC\Bulk::deserializeObject($data['bulk']); |
|
176
|
|
|
$result->filter = SPC\Filter::deserializeObject($data['filter']); |
|
177
|
|
|
$result->eTag = SPC\ETag::deserializeObject($data['etag']); |
|
178
|
|
|
$result->changePassword = SPC\ChangePassword::deserializeObject($data['changePassword']); |
|
179
|
|
|
$result->sort = SPC\Sort::deserializeObject($data['sort']); |
|
180
|
|
|
|
|
181
|
|
|
if (isset($data['authenticationSchemes'])) { |
|
182
|
|
|
foreach ($data['authenticationSchemes'] as $authenticationScheme) { |
|
183
|
|
|
$result->authenticationSchemes[] = SPC\AuthenticationScheme::deserializeObject($authenticationScheme); |
|
184
|
|
|
} |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
return $result; |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
|