Completed
Push — master ( 78a8ff...f55562 )
by Christopher
02:55
created

ADUser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 309
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 309
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 11 3
1
<?php
2
/**
3
 * @link      https://github.com/chrmorandi/yii2-ldap for the canonical source repository
4
 * @package   yii2-ldap
5
 * @author    Christopher Mota <[email protected]>
6
 * @license   MIT License - view the LICENSE file that was distributed with this source code.
7
 */
8
9
namespace chrmorandi\ldap\schemas;
10
11
use DateTime;
12
use ReflectionClass;
13
use ReflectionProperty;
14
15
/**
16
 *
17
 * @since 1.0.0
18
 */
19
class ADUser
20
{
21
    
22
    /**
23
     * The LDAP API references an LDAP object by its distinguished name (DN).
24
     * A DN is a sequence of relative distinguished names (RDN) connected by commas.
25
     *
26
     * @link https://msdn.microsoft.com/en-us/library/aa366101(v=vs.85).aspx
27
     * @var  string
28
     */
29
    public $dn;
30
31
    /**
32
     * Contain the object class for make user in AD
33
     * User: This class is used to store information about an employee or contractor who works for an organization. 
34
     * It is also possible to apply this class to long term visitors.
35
     * Person: Contains personal information about a user.
36
     * OrganizationalPerson: This class is used for objects that contain organizational information about a user, such 
37
     * as the employee number, department, manager, title, office address, and so on.
38
     * Top: The top level class from which all classes are derived.
39
     * @link https://msdn.microsoft.com/en-us/library/ms680932(v=vs.85).aspx
40
     * @var array 
41
     */
42
    public $objectClass = ['user', 'person', 'organizationalPerson', 'top'];
43
    
44
    /**
45
     * The date when the account expires. This value represents the number of 100-nanosecond
46
     * intervals since January 1, 1601 (UTC). A value of 0 or 0x7FFFFFFFFFFFFFFF
47
     * (9223372036854775807) indicates that the account never expires.
48
     * @link https://msdn.microsoft.com/en-us/library/ms675098(v=vs.85).aspx
49
     * @var DateTime|false
50
     */
51
    public $accountExpires = 9223372036854775807;
52
    
53
    /**
54
     * The number of times the user tried to log on to the account using
55
     * an incorrect password. A value of 0 indicates that the
56
     * value is unknown.
57
     * @link https://msdn.microsoft.com/en-us/library/ms675244(v=vs.85).aspx
58
     * @var int
59
     */
60
    public $badPwdCount;
61
    
62
    /**
63
     * The user's company name.
64
     * @link https://msdn.microsoft.com/en-us/library/ms675457(v=vs.85).aspx
65
     * @var string
66
     */
67
    public $company;
68
    
69
    /**
70
     * The entry's country attribute.
71
     * @link https://msdn.microsoft.com/en-us/library/ms675432(v=vs.85).aspx
72
     * @var string
73
     */
74
    public $c;
75
    
76
    /**
77
     * The name that represents an object. Used to perform searches.
78
     * @link https://msdn.microsoft.com/en-us/library/ms675449(v=vs.85).aspx
79
     * @var string
80
     */
81
    public $cn;
82
    
83
    /**
84
     * Contains the name for the department in which the user works.
85
     * @link https://msdn.microsoft.com/en-us/library/ms675490(v=vs.85).aspx
86
     * @var string
87
     */
88
    public $department;
89
    
90
    /**
91
     * Contains the description to display for an object. This value is restricted
92
     * as single-valued for backward compatibility in some cases but
93
     * is allowed to be multi-valued in others.
94
     * @link https://msdn.microsoft.com/en-us/library/ms675492(v=vs.85).aspx
95
     * @var string
96
     */
97
    public $description;
98
    
99
    /**
100
     * The display name for an object. This is usually the combination
101
     * of the users first name, middle initial, and last name.
102
     * @link https://msdn.microsoft.com/en-us/library/ms675514(v=vs.85).aspx
103
     * @var string
104
     */
105
    public $displayName;
106
    
107
    /**
108
     * The user's division.
109
     * @link https://msdn.microsoft.com/en-us/library/ms675518(v=vs.85).aspx
110
     * @var string 
111
     */
112
    public $division;
113
    
114
    /**
115
     * The ID of an employee.
116
     * @link https://msdn.microsoft.com/en-us/library/ms675662(v=vs.85).aspx
117
     * @var string 
118
     */
119
    public $employeeID;
120
    
121
    /**
122
     * The number assigned to an employee other than the ID.
123
     * @link https://msdn.microsoft.com/en-us/library/ms675663(v=vs.85).aspx
124
     * @var string 
125
     */
126
    public $employeeNumber;
127
    
128
    /**
129
     * The job category for an employee.
130
     * @link https://msdn.microsoft.com/en-us/library/ms675664(v=vs.85).aspx
131
     * @var string 
132
     */
133
    public $employeeType;
134
    
135
    /**
136
     * Contains the given name (first name) of the user.
137
     * @link https://msdn.microsoft.com/en-us/library/ms675719(v=vs.85).aspx
138
     * @var string
139
     */
140
    public $givenName;
141
    
142
    /**
143
     * The user's main home phone number.
144
     * @link https://msdn.microsoft.com/en-us/library/ms676192(v=vs.85).aspx
145
     * @var string
146
     */
147
    public $homePhone;
148
    
149
    /**
150
     * Contains the initials for parts of the user's full name. This may be used as 
151
     * the middle initial in the Windows Address Book.
152
     * @link https://msdn.microsoft.com/en-us/library/ms676202(v=vs.85).aspx
153
     * @var string
154
     */
155
    public $initials;
156
    
157
    /**
158
     * The TCP/IP address for the phone. Used by Telephony.
159
     * @link https://msdn.microsoft.com/en-us/library/ms676213(v=vs.85).aspx
160
     * @var string
161
     */
162
    public $ipPhone;
163
    
164
    /**
165
     * The date and time (UTC) that this account was locked out. This value is stored 
166
     * as a large integer that represents the number of 100-nanosecond intervals since 
167
     * January 1, 1601 (UTC). A value of zero means that the account is not currently 
168
     * locked out.
169
     * @link https://msdn.microsoft.com/en-us/library/ms676843(v=vs.85).aspx
170
     * @var DateTime|false
171
     */
172
    public $lockoutTime;
173
    
174
    /**
175
     * The list of email addresses for a contact.
176
     * @link https://msdn.microsoft.com/en-us/library/ms676855(v=vs.85).aspx
177
     * @var string
178
     */
179
    public $mail;
180
    
181
    /**
182
     * Contains the distinguished name of the user who is the user's manager. 
183
     * The manager's user object contains a directReports property that contains 
184
     * references to all user objects that have their manager properties set to this 
185
     * distinguished name.
186
     * @link https://msdn.microsoft.com/en-us/library/ms676859(v=vs.85).aspx
187
     * @var string
188
     */
189
    public $manager;
190
    
191
    /**
192
     * The distinguished name of the groups to which this object belongs.
193
     * @link https://msdn.microsoft.com/en-us/library/ms677099(v=vs.85).aspx
194
     * @var array 
195
     */
196
    public $memberOf;
197
    
198
    /**
199
     * The primary mobile phone number.
200
     * @link https://msdn.microsoft.com/en-us/library/ms677119(v=vs.85).aspx
201
     * @var string
202
     */
203
    public $mobile;
204
    
205
    /**
206
     * The name of the company or organization.
207
     * @link https://msdn.microsoft.com/en-us/library/ms679009(v=vs.85).aspx
208
     * @var string
209
     */
210
    public $o;
211
    
212
    /**
213
     * The unique identifier for an object.
214
     * @link https://msdn.microsoft.com/en-us/library/ms679021(v=vs.85).aspx
215
     * @var type 
216
     */
217
    public $objectGuid;    
218
    
219
    /**
220
     * A binary value that specifies the security identifier (SID) of the user. The SID is a unique value used to
221
     * identify the user as a security principal.
222
     * @link https://msdn.microsoft.com/en-us/library/ms679024(v=vs.85).aspx
223
     * @var string
224
     */
225
    public $objectSid;
226
    
227
    /**
228
     * The date and time that the password for this account was last changed. This value is stored as a large
229
     * integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC). If this value
230
     * is set to 0 and the User-Account-Control attribute does not contain the UF_DONT_EXPIRE_PASSWD
231
     * flag, then the user must set the password at the next logon.
232
     * @link https://msdn.microsoft.com/en-us/library/ms679430(v=vs.85).aspx
233
     * @var type 
234
     */
235
    public $pwdLastSet;
236
    
237
    /**
238
     * The logon name used to support clients and servers running earlier versions of the operating system, such
239
     * as Windows NT 4.0, Windows 95, Windows 98, and LAN Manager.
240
     * @link https://msdn.microsoft.com/en-us/library/ms679635(v=vs.85).aspx
241
     * @var type 
242
     */
243
    public $sAMAccountName;
244
    
245
    /**
246
     * The name of a user's state or province.
247
     * @link https://msdn.microsoft.com/en-us/library/ms679880(v=vs.85).aspx
248
     * @var string
249
     */
250
    public $st;
251
    
252
    /**
253
     * The street address.
254
     * @link https://msdn.microsoft.com/en-us/library/ms679882(v=vs.85).aspx
255
     * @var string
256
     */
257
    public $streetAddress;
258
259
    /**
260
     * This attribute contains the family or last name for a user.
261
     * @link https://msdn.microsoft.com/en-us/library/ms679872(v=vs.85).aspx
262
     * @var string
263
     */
264
    public $sn;
265
    
266
    /**
267
     * The primary telephone number.
268
     * @link https://msdn.microsoft.com/en-us/library/ms680027(v=vs.85).aspx
269
     * @return string
270
     */
271
    public $telephoneNumber;
272
    
273
    /**
274
     * Contains the user's job title. This property is commonly used to indicate the formal job title, such as Senior
275
     * Programmer, rather than occupational class, such as programmer. It is not typically used for suffix titles
276
     * such as Esq. or DDS.
277
     * @link https://msdn.microsoft.com/en-us/library/ms680037(v=vs.85).aspx
278
     * @var type 
279
     */
280
    public $title;
281
282
    /**
283
     * Flags that control the behavior of the user account.
284
     * @link https://msdn.microsoft.com/en-us/library/ms680832(v=vs.85).aspx
285
     * @return string
286
     */
287
    public $userAccountControl;
288
    
289
    /**
290
     * his attribute contains the UPN that is an Internet-style login name for
291
     * a user based on the Internet standard RFC 822.
292
     * @link https://msdn.microsoft.com/en-us/library/ms680857(v=vs.85).aspx
293
     * @return string
294
     */
295
    public $userPrincipalName;
296
    
297
    /**
298
     * The entry's created at attribute.
299
     * @link https://msdn.microsoft.com/en-us/library/ms680924(v=vs.85).aspx
300
     * @var DateTime
301
     */
302
    public $whenCreated;
303
    
304
    /**
305
     * A web page that is the primary landing page of a website.
306
     * @link https://msdn.microsoft.com/en-us/library/ms680927(v=vs.85).aspx
307
     * @var string 
308
     */
309
    public $wWWHomePage;
310
    
311
    /**
312
     * 
313
     * @return array of attributes
314
     */
315
    public function getAttributes() {
316
        $class = new ReflectionClass(self::class);
317
        $names = [];
318
        foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
319
            if (!$property->isStatic()) {
320
                $names[] = $property->getName();
321
            }
322
        }
323
324
        return $names;
325
    }
326
    
327
}
328