Passed
Pull Request — master (#7302)
by Angel Fernando Quiroz
09:53
created

UserSchemaControllerTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 273
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 209
c 1
b 0
f 0
dl 0
loc 273
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getUserCoreSchema() 0 271 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Traits\Scim;
8
9
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
10
11
trait UserSchemaControllerTrait
12
{
13
    protected function getUserCoreSchema(): array
14
    {
15
        $location = $this->generateUrl(
0 ignored issues
show
Bug introduced by
It seems like generateUrl() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        /** @scrutinizer ignore-call */ 
16
        $location = $this->generateUrl(
Loading history...
16
            'scim_schema',
17
            ['schemaId' => 'urn:ietf:params:scim:schemas:core:2.0:User'],
18
            UrlGeneratorInterface::ABSOLUTE_URL
19
        );
20
21
        return [
22
            'id' => 'urn:ietf:params:scim:schemas:core:2.0:User',
23
            'name' => 'User',
24
            'description' => 'User Schema',
25
            'attributes' => [
26
                [
27
                    'name' => 'id',
28
                    'type' => 'string',
29
                    'multiValued' => false,
30
                    'description' => 'Unique identifier for the resource as defined by Chamilo.',
31
                    'required' => true,
32
                    'caseExact' => true,
33
                    'mutability' => 'readOnly',
34
                    'returned' => 'default',
35
                    'uniqueness' => 'server',
36
                ],
37
                [
38
                    'name' => 'externalId',
39
                    'type' => 'string',
40
                    'multiValued' => false,
41
                    'description' => 'Unique identifier for the resource as defined by the provisioning client.',
42
                    'required' => false,
43
                    'caseExact' => false,
44
                    'mutability' => 'readWrite',
45
                    'returned' => 'default',
46
                    'uniqueness' => 'none',
47
                ],
48
                [
49
                    'name' => 'userName',
50
                    'type' => 'string',
51
                    'multiValued' => false,
52
                    'description' => 'Unique identifier for the User, typically used by the user to directly authenticate to Chamilo.',
53
                    'required' => true,
54
                    'caseExact' => false,
55
                    'mutability' => 'readWrite',
56
                    'returned' => 'default',
57
                    'uniqueness' => 'server',
58
                ],
59
                [
60
                    'name' => 'displayName',
61
                    'type' => 'string',
62
                    'multiValued' => false,
63
                    'description' => 'The name of the User, suitable for display to end-users.',
64
                    'required' => false,
65
                    'caseExact' => false,
66
                    'mutability' => 'readOnly',
67
                    'returned' => 'default',
68
                    'uniqueness' => 'none',
69
                ],
70
                [
71
                    'name' => 'name',
72
                    'type' => 'complex',
73
                    'multiValued' => false,
74
                    'description' => "The components of the user's real name.",
75
                    'required' => false,
76
                    'mutability' => 'readWrite',
77
                    'returned' => 'default',
78
                    'subAttributes' => [
79
                        [
80
                            'name' => 'familyName',
81
                            'type' => 'string',
82
                            'description' => "The family name of the User, or last name in most Western languages (e.g., 'Jensen' given the full name 'Ms. Barbara J Jensen, III').",
83
                            'multiValued' => false,
84
                            'required' => true,
85
                            'mutability' => 'readWrite',
86
                            'returned' => 'default',
87
                        ],
88
                        [
89
                            'name' => 'givenName',
90
                            'type' => 'string',
91
                            'multiValued' => false,
92
                            'description' => "The given name of the User, or first name in most Western languages (e.g., 'Barbara' given the full name 'Ms. Barbara J Jensen, III').",
93
                            'required' => true,
94
                            'mutability' => 'readWrite',
95
                            'returned' => 'default',
96
                        ],
97
                    ],
98
                ],
99
                [
100
                    'name' => 'emails',
101
                    'type' => 'complex',
102
                    'multiValued' => true,
103
                    'description' => 'Email addresses for the user.',
104
                    'required' => true,
105
                    'mutability' => 'readWrite',
106
                    'returned' => 'default',
107
                    'subAttributes' => [
108
                        [
109
                            'name' => 'value',
110
                            'type' => 'string',
111
                            'multiValued' => false,
112
                            'description' => 'Email addresses for the user.',
113
                            'required' => false,
114
                            'mutability' => 'readWrite',
115
                            'returned' => 'default',
116
                        ],
117
                        [
118
                            'name' => 'type',
119
                            'type' => 'string',
120
                            'multiValued' => false,
121
                            'description' => "A label indicating the attribute's function.",
122
                            'required' => false,
123
                            'mutability' => 'readWrite',
124
                            'returned' => 'default',
125
                            'canonicalValues' => [
126
                                'work',
127
                            ],
128
                        ],
129
                        [
130
                            'name' => 'primary',
131
                            'type' => 'boolean',
132
                            'multiValued' => false,
133
                            'description' => "A Boolean value indicating the 'primary' or preferred attribute value for this attribute",
134
                            'required' => false,
135
                            'mutability' => 'readWrite',
136
                            'returned' => 'default',
137
                        ],
138
                    ],
139
                ],
140
                [
141
                    'name' => 'phoneNumbers',
142
                    'type' => 'complex',
143
                    'multiValued' => true,
144
                    'description' => 'Phone numbers for the User.',
145
                    'required' => false,
146
                    'subAttributes' => [
147
                        [
148
                            'name' => 'value',
149
                            'type' => 'string',
150
                            'multiValued' => false,
151
                            'description' => 'Phone number of the User.',
152
                            'required' => false,
153
                            'caseExact' => false,
154
                            'mutability' => 'readWrite',
155
                            'returned' => 'default',
156
                            'uniqueness' => 'none',
157
                        ],
158
                        [
159
                            'name' => 'type',
160
                            'type' => 'string',
161
                            'multiValued' => false,
162
                            'description' => "A label indicating the attribute's function.",
163
                            'required' => false,
164
                            'caseExact' => false,
165
                            'canonicalValues' => [
166
                                'work',
167
                            ],
168
                            'mutability' => 'readWrite',
169
                            'returned' => 'default',
170
                            'uniqueness' => 'none',
171
                        ],
172
                        [
173
                            'name' => 'primary',
174
                            'type' => 'boolean',
175
                            'multiValued' => false,
176
                            'description' => "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.",
177
                            'required' => false,
178
                            'mutability' => 'readWrite',
179
                            'returned' => 'default',
180
                        ],
181
                    ],
182
                    'mutability' => 'readWrite',
183
                    'returned' => 'default',
184
                ],
185
                [
186
                    'name' => 'addresses',
187
                    'type' => 'complex',
188
                    'multiValued' => true,
189
                    'description' => 'A physical mailing address for this User.',
190
                    'required' => false,
191
                    'subAttributes' => [
192
                        [
193
                            'name' => 'formatted',
194
                            'type' => 'string',
195
                            'multiValued' => false,
196
                            'description' => 'The full mailing address, formatted for display or use with a mailing label.',
197
                            'required' => false,
198
                            'caseExact' => false,
199
                            'mutability' => 'readWrite',
200
                            'returned' => 'default',
201
                            'uniqueness' => 'none',
202
                        ],
203
                        [
204
                            'name' => 'type',
205
                            'type' => 'string',
206
                            'multiValued' => false,
207
                            'description' => "A label indicating the attribute's function.",
208
                            'required' => false,
209
                            'caseExact' => false,
210
                            'canonicalValues' => [
211
                                'work',
212
                            ],
213
                            'mutability' => 'readWrite',
214
                            'returned' => 'default',
215
                            'uniqueness' => 'none',
216
                        ],
217
                    ],
218
                    'mutability' => 'readWrite',
219
                    'returned' => 'default',
220
                    'uniqueness' => 'none',
221
                ],
222
                [
223
                    'name' => 'timezone',
224
                    'type' => 'string',
225
                    'multiValued' => false,
226
                    'description' => "The User's time zone in the 'Olson' time zone database format, e.g., 'America/Los_Angeles'.",
227
                    'required' => false,
228
                    'caseExact' => false,
229
                    'mutability' => 'readWrite',
230
                    'returned' => 'default',
231
                    'uniqueness' => 'none',
232
                ],
233
                [
234
                    'name' => 'active',
235
                    'type' => 'boolean',
236
                    'multiValued' => false,
237
                    'description' => "A Boolean value indicating the User's administrative status.",
238
                    'required' => false,
239
                    'mutability' => 'readWrite',
240
                    'returned' => 'default',
241
                ],
242
                [
243
                    'name' => 'meta',
244
                    'type' => 'complex',
245
                    'multiValued' => false,
246
                    'required' => false,
247
                    'mutability' => 'readOnly',
248
                    'returned' => 'default',
249
                    'subAttributes' => [
250
                        [
251
                            'name' => 'resourceType',
252
                            'type' => 'string',
253
                            'multiValued' => false,
254
                            'mutability' => 'readOnly',
255
                            'returned' => 'default',
256
                        ],
257
                        [
258
                            'name' => 'created',
259
                            'type' => 'dateTime',
260
                            'multiValued' => false,
261
                            'mutability' => 'readOnly',
262
                            'returned' => 'default',
263
                        ],
264
                        [
265
                            'name' => 'lastModified',
266
                            'type' => 'dateTime',
267
                            'multiValued' => false,
268
                            'mutability' => 'readOnly',
269
                            'returned' => 'default',
270
                        ],
271
                        [
272
                            'name' => 'location',
273
                            'type' => 'string',
274
                            'multiValued' => false,
275
                            'mutability' => 'readOnly',
276
                            'returned' => 'default',
277
                        ],
278
                    ],
279
                ],
280
            ],
281
            'meta' => [
282
                'resourceType' => 'Schema',
283
                'location' => $location,
284
            ],
285
        ];
286
    }
287
}
288