(self, dsDatabase, dsRecordId)
Constructor
Constructor
Constructor
def __init__(self, dsDatabase, dsRecordId):
        '''
        Constructor
        '''
        dsObject.__init__(self, dsDatabase, dsRecordId)
        
        self.SID = SID(self.Record[ntds.dsfielddictionary.dsSIDIndex])
        self.SAMAccountName = self.Record[ntds.dsfielddictionary.dsSAMAccountNameIndex]
        self.PrincipalName = self.Record[ntds.dsfielddictionary.dsUserPrincipalNameIndex]
        if self.Record[ntds.dsfielddictionary.dsSAMAccountTypeIndex] != "":
            self.SAMAccountType = int(self.Record[ntds.dsfielddictionary.dsSAMAccountTypeIndex])
        
        if self.Record[ntds.dsfielddictionary.dsUserAccountControlIndex] != "":
            self.UserAccountControl = int(self.Record[ntds.dsfielddictionary.dsUserAccountControlIndex])
        
        if self.UserAccountControl != -1:
            if self.UserAccountControl & int("0x10", 16) == int("0x10", 16):
                self.isLocked = True
            if self.UserAccountControl & int("0x2", 16) == int("0x2", 16):
                self.isDisabled = True
            if not self.isLocked and not self.isDisabled:
                self.isActive = True
        
        if self.Record[ntds.dsfielddictionary.dsPrimaryGroupIdIndex] != "":
            self.PrimaryGroupID = int(self.Record[ntds.dsfielddictionary.dsPrimaryGroupIdIndex])
        if self.Record[ntds.dsfielddictionary.dsLogonCountIndex] != "":
            self.LogonCount = int(self.Record[ntds.dsfielddictionary.dsLogonCountIndex])
        else:
            self.BadPwdCount = -1
        if self.Record[ntds.dsfielddictionary.dsBadPwdCountIndex] != "":
            self.BadPwdCount = int(self.Record[ntds.dsfielddictionary.dsBadPwdCountIndex])
        else:
            self.BadPwdCount = -1
                        
        self.LastLogon = dsVerifyDSTimeStamp(self.Record[ntds.dsfielddictionary.dsLastLogonIndex])
        
        self.LastLogonTimeStamp = dsVerifyDSTimeStamp(self.Record[ntds.dsfielddictionary.dsLastLogonTimeStampIndex])
        
        self.PasswordLastSet = dsVerifyDSTimeStamp(self.Record[ntds.dsfielddictionary.dsPasswordLastSetIndex])
        
        self.AccountExpires = dsVerifyDSTimeStamp(self.Record[ntds.dsfielddictionary.dsAccountExpiresIndex])
        
        self.BadPwdTime = dsVerifyDSTimeStamp(self.Record[ntds.dsfielddictionary.dsBadPwdTimeIndex])
        
        if self.Record[ntds.dsfielddictionary.dsDialInAccessPermission] != "":
            self.DialInAccessPermission = int(self.Record[ntds.dsfielddictionary.dsDialInAccessPermission])
        else:
            self.DialInAccessPermission = -1
def __init__ ( self , dsDatabase , dsRecordId ) : dsObject . __init__ ( self , dsDatabase , dsRecordId ) self . SID = SID ( self . Record [ ntds . dsfielddictionary . dsSIDIndex ] ) self . SAMAccountName = self . Record [ ntds . dsfielddictionary . dsSAMAccountNameIndex ] self . PrincipalName = self . Record [ ntds . dsfielddictionary . dsUserPrincipalNameIndex ] if self . Record [ ntds . dsfielddictionary . dsSAMAccountTypeIndex ] != "" : self . SAMAccountType = int ( self . Record [ ntds . dsfielddictionary . dsSAMAccountTypeIndex ] ) if self . Record [ ntds . dsfielddictionary . dsUserAccountControlIndex ] != "" : self . UserAccountControl = int ( self . Record [ ntds . dsfielddictionary . dsUserAccountControlIndex ] ) if self . UserAccountControl != - 1 : if self . UserAccountControl & int ( "0x10" , 16 ) == int ( "0x10" , 16 ) : self . isLocked = True if self . UserAccountControl & int ( "0x2" , 16 ) == int ( "0x2" , 16 ) : self . isDisabled = True if not self . isLocked and not self . isDisabled : self . isActive = True if self . Record [ ntds . dsfielddictionary . dsPrimaryGroupIdIndex ] != "" : self . PrimaryGroupID = int ( self . Record [ ntds . dsfielddictionary . dsPrimaryGroupIdIndex ] ) if self . Record [ ntds . dsfielddictionary . dsLogonCountIndex ] != "" : self . LogonCount = int ( self . Record [ ntds . dsfielddictionary . dsLogonCountIndex ] ) else : self . BadPwdCount = - 1 if self . Record [ ntds . dsfielddictionary . dsBadPwdCountIndex ] != "" : self . BadPwdCount = int ( self . Record [ ntds . dsfielddictionary . dsBadPwdCountIndex ] ) else : self . BadPwdCount = - 1 self . LastLogon = dsVerifyDSTimeStamp ( self . Record [ ntds . dsfielddictionary . dsLastLogonIndex ] ) self . LastLogonTimeStamp = dsVerifyDSTimeStamp ( self . Record [ ntds . dsfielddictionary . dsLastLogonTimeStampIndex ] ) self . PasswordLastSet = dsVerifyDSTimeStamp ( self . Record [ ntds . dsfielddictionary . dsPasswordLastSetIndex ] ) self . AccountExpires = dsVerifyDSTimeStamp ( self . Record [ ntds . dsfielddictionary . dsAccountExpiresIndex ] ) self . BadPwdTime = dsVerifyDSTimeStamp ( self . Record [ ntds . dsfielddictionary . dsBadPwdTimeIndex ] ) if self . Record [ ntds . dsfielddictionary . dsDialInAccessPermission ] != "" : self . DialInAccessPermission = int ( self . Record [ ntds . dsfielddictionary . dsDialInAccessPermission ] ) else : self . DialInAccessPermission = - 1